Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vault credential support to Ansible playbook service template. #17184

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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