Skip to content

Commit

Permalink
Use EmbeddedAnsible service constant over ENV variable for provider url
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed Jan 10, 2018
1 parent c3da7df commit 2068bdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/embedded_ansible_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def provider_url

def provider_uri_hash
if MiqEnvironment::Command.is_container?
{:scheme => "https", :host => ENV["ANSIBLE_SERVICE_HOST"], :path => "/api/v1"}
{:scheme => "https", :host => ContainerEmbeddedAnsible::ANSIBLE_SERVICE_NAME, :path => "/api/v1"}
elsif Rails.env.development?
{:scheme => "http", :host => "localhost", :path => "/api/v1", :port => 54321}
else
Expand Down
8 changes: 1 addition & 7 deletions spec/models/embedded_ansible_worker/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@
expect(MiqEnvironment::Command).to receive(:is_container?).and_return(true)
end

around do |example|
ENV["ANSIBLE_SERVICE_HOST"] = "192.0.2.1"
example.run
ENV.delete("ANSIBLE_SERVICE_HOST")
end

it "creates the provider with the service name for the URL" do
expect(worker).to receive(:remove_demo_data).with(api_connection)
expect(worker).to receive(:ensure_initial_objects)
Expand All @@ -121,7 +115,7 @@

provider = ManageIQ::Providers::EmbeddedAnsible::Provider.first
expect(provider.zone).to eq(miq_server.zone)
expect(provider.default_endpoint.url).to eq("https://192.0.2.1/api/v1")
expect(provider.default_endpoint.url).to eq("https://ansible/api/v1")
userid, password = provider.auth_user_pwd
expect(userid).to eq("admin")
expect(password).to eq("secret")
Expand Down

0 comments on commit 2068bdf

Please sign in to comment.