Skip to content

Commit

Permalink
Don't fail if the EmbeddedAnsible instance can't create the playbook …
Browse files Browse the repository at this point in the history
…repo

This is currently the case for DockerEmbeddedAnsible and ContainerEmbeddedAnsible
so this will allow those cases to continue without the default project
  • Loading branch information
carbonin committed May 17, 2018
1 parent 9b6fe1e commit f8568b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
7 changes: 5 additions & 2 deletions app/models/embedded_ansible_worker/object_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def ensure_initial_objects(provider, connection)
ensure_credential(provider, connection)
ensure_inventory(provider, connection)
ensure_host(provider, connection)
ensure_plugin_playbooks_project_seeded(provider, connection) unless MiqEnvironment::Command.is_container?
ensure_plugin_playbooks_project_seeded(provider, connection)
end

def remove_demo_data(connection)
Expand Down Expand Up @@ -56,7 +56,10 @@ def ensure_host(provider, connection)
end

def ensure_plugin_playbooks_project_seeded(provider, connection)
EmbeddedAnsible.new.create_local_playbook_repo
ea = EmbeddedAnsible.new
return unless ea.respond_to?(:create_local_playbook_repo)

ea.create_local_playbook_repo

project = find_default_project(connection, provider.default_project)
if project
Expand Down
11 changes: 0 additions & 11 deletions spec/models/embedded_ansible_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@

subject.ensure_initial_objects(provider, api_connection)
end

it "skips playbook seeding for containers" do
allow(MiqEnvironment::Command).to receive(:is_container?).and_return(true)
expect(org_collection).to receive(:create!).and_return(org_resource)
expect(cred_collection).to receive(:create!).and_return(cred_resource)
expect(inv_collection).to receive(:create!).and_return(inv_resource)
expect(host_collection).to receive(:create!).and_return(host_resource)
expect(subject).to receive(:ensure_plugin_playbooks_project_seeded).never

subject.ensure_initial_objects(provider, api_connection)
end
end

describe "#remove_demo_data" do
Expand Down

0 comments on commit f8568b9

Please sign in to comment.