Skip to content

Commit

Permalink
Add hack to get EmbeddedAnsible provider working on dev machines
Browse files Browse the repository at this point in the history
This really just assumes that a dev environment isn't multi-appliance
and isn't fronted by our httpd configuration.

This means that we always go to localhost, use http over https and
hardcode the port and path.
  • Loading branch information
carbonin committed Dec 6, 2017
1 parent 1ed4128 commit b015723
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/models/embedded_ansible_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ def message_sync_config(*_args); end
private

def provider_url
server = MiqServer.my_server(true)
URI::Generic.build(provider_uri_hash).to_s
end

def provider_uri_hash
if MiqEnvironment::Command.is_container?
host = ENV["ANSIBLE_SERVICE_HOST"]
path = "/api/v1"
{:scheme => "https", :host => ENV["ANSIBLE_SERVICE_HOST"], :path => "/api/v1"}
elsif Rails.env.development?
{:scheme => "http", :host => "localhost", :path => "/api/v1", :port => 54321}
else
host = server.hostname || server.ipaddress
path = "/ansibleapi/v1"
server = MiqServer.my_server(true)
{:scheme => "https", :host => server.hostname || server.ipaddress, :path => "/ansibleapi/v1"}
end

URI::HTTPS.build(:host => host, :path => path).to_s
end

def raise_role_notification(notification_type)
Expand Down

0 comments on commit b015723

Please sign in to comment.