Skip to content

Commit

Permalink
Fix URI parse handling for SERVICE_URI
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed Oct 27, 2020
1 parent 4ef0e67 commit 929ab71
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tasks/provision_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
include PuppetLitmus::InventoryManipulation

def default_uri
URI.parse('https://facade-release-6f3kfepqcq-ew.a.run.app/v1/provision')
'https://facade-release-6f3kfepqcq-ew.a.run.app/v1/provision'
end

def platform_to_cloud_request_parameters(platform, cloud, region, zone)
Expand Down Expand Up @@ -66,11 +66,10 @@ def provision(platform, inventory_location, vars)
# Call the provision service with the information necessary and write the inventory file locally

job_url = ENV['GITHUB_URL'] || "https://api.github.com/repos/#{ENV['GITHUB_REPOSITORY']}/actions/runs/#{ENV['GITHUB_RUN_ID']}"
uri = ENV['SERVICE_URL']
uri = URI.parse(ENV['SERVICE_URL'] || default_uri)
cloud = ENV['CLOUD']
region = ENV['REGION']
zone = ENV['ZONE']
uri = default_uri if uri.nil?
if job_url.nil?
data = JSON.parse(vars.tr(';', ','))
job_url = data['job_url']
Expand Down Expand Up @@ -102,8 +101,7 @@ def provision(platform, inventory_location, vars)

def tear_down(platform, inventory_location, _vars)
# remove all provisioned resources
uri = ENV['SERVICE_URL']
uri = default_uri if uri.nil?
uri = URI.parse(ENV['SERVICE_URL'] || default_uri)

inventory_full_path = File.join(inventory_location, 'inventory.yaml')
# rubocop:disable Style/GuardClause
Expand Down

0 comments on commit 929ab71

Please sign in to comment.