Skip to content

Commit

Permalink
Merge pull request #17192 from lfu/ansible_vault_credential_2
Browse files Browse the repository at this point in the history
Add vault credential support to automat playbook method.
(cherry picked from commit 6f201d8)

https://bugzilla.redhat.com/show_bug.cgi?id=1559479
  • Loading branch information
gmcculloug authored and simaishi committed Mar 26, 2018
1 parent d583069 commit 85a4f9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def build_parameter_list(options)
:extra_vars => options[:extra_vars].try(:to_json)
}

%i(credential cloud_credential network_credential).each do |credential|
%i(credential vault_credential cloud_credential network_credential).each do |credential|
cred_sym = "#{credential}_id".to_sym
params[credential] = Authentication.find(options[cred_sym]).manager_ref if options[cred_sym]
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook do
let(:manager) { FactoryGirl.create(:embedded_automation_manager_ansible) }
let(:auth_one) { FactoryGirl.create(:authentication, :manager_ref => 6) }
let(:auth_two) { FactoryGirl.create(:authentication, :manager_ref => 8) }
subject { FactoryGirl.create(:embedded_playbook, :manager => manager) }

describe '#run' do
Expand All @@ -13,12 +15,14 @@

describe '#raw_create_job_template' do
it 'delegates request to job template raw creation' do
options = {:inventory => 'inv', :extra_vars => {'a' => 'x'} }
options = {:inventory => 'inv', :extra_vars => {'a' => 'x'}, :credential_id => auth_one.id, :vault_credential_id => auth_two.id }
option_matcher = hash_including(
:inventory => 'inv',
:extra_vars => '{"a":"x"}',
:playbook => subject.name,
:project => 'mref'
:inventory => 'inv',
:extra_vars => '{"a":"x"}',
:playbook => subject.name,
:project => 'mref',
:credential => '6',
:vault_credential => '8'
)

allow(subject).to receive(:configuration_script_source).and_return(double(:manager_ref => 'mref'))
Expand Down

0 comments on commit 85a4f9f

Please sign in to comment.