Skip to content

Commit

Permalink
Add group in manageiq payload for ansible automation.
Browse files Browse the repository at this point in the history
Need to catch the group that the user is in when the job is launched in a multiple groups context.

https://bugzilla.redhat.com/show_bug.cgi?id=1480019
  • Loading branch information
lfu committed Aug 10, 2017
1 parent 2597fbb commit 5b76396
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/service_ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def manageiq_extra_vars(action)
'api_token' => Api::UserTokenService.new.generate_token(evm_owner.userid, 'api'),
'service' => href_slug,
'user' => evm_owner.href_slug,
'group' => miq_group.href_slug,
'action' => action
}.merge(request_options_extra_vars)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/models/service_ansible_playbook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@
miq_request_task = FactoryGirl.create(:miq_request_task)
miq_request_task.update_attributes(:options => {:request_options => {:manageiq_extra_vars => control_extras}})
loaded_service.update_attributes(:evm_owner => FactoryGirl.create(:user),
:miq_group => FactoryGirl.create(:miq_group),
:miq_request_task => miq_request_task)
end

it 'creates an Ansible Tower job' do
expect(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Job).to receive(:create_job) do |jobtemp, opts|
expect(jobtemp).to eq(tower_job_temp)
exposed_miq = %w(api_url api_token service user) + control_extras.keys
exposed_miq = %w(api_url api_token service user group) + control_extras.keys
expect(opts[:extra_vars].delete('manageiq').keys).to include(*exposed_miq)

expected_opts = provision_options[:provision_job_options].except(:hosts)
Expand Down

0 comments on commit 5b76396

Please sign in to comment.