Skip to content

Commit

Permalink
Merge pull request #17184 from lfu/ansible_vault_credential
Browse files Browse the repository at this point in the history
Add vault credential support to Ansible playbook service template.
  • Loading branch information
gmcculloug authored Mar 21, 2018
2 parents 9b54d98 + 635d8ca commit f2ad37a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/service_template_ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def self.build_parameter_list(name, description, info)
end.to_json
end

[: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(info[cred_sym]).manager_ref if info[cred_sym]
end
Expand Down
5 changes: 4 additions & 1 deletion spec/models/service_template_ansible_playbook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
let(:user) { FactoryGirl.create(:user_with_group) }
let(:auth_one) { FactoryGirl.create(:authentication, :manager_ref => 6) }
let(:auth_two) { FactoryGirl.create(:authentication, :manager_ref => 10) }
let(:auth_three) { FactoryGirl.create(:authentication, :manager_ref => 14) }

let(:script_source) { FactoryGirl.create(:configuration_script_source, :manager => ems) }

Expand Down Expand Up @@ -35,6 +36,7 @@
:verbosity => 3,
:credential_id => auth_one.id,
:network_credential_id => auth_two.id,
:vault_credential_id => auth_three.id,
:playbook_id => playbook.id
},
}
Expand Down Expand Up @@ -134,7 +136,8 @@
:become_enabled => true,
:verbosity => 3,
:credential => '6',
:network_credential => '10'
:network_credential => '10',
:vault_credential => '14'
)

expect(params.keys).to_not include(:extra_vars, :cloud_credentials)
Expand Down

0 comments on commit f2ad37a

Please sign in to comment.