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

No need to call normalized_status #16578

Merged
merged 1 commit into from
Dec 1, 2017
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_ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def log_stdout(action)
log_option = options.fetch_path(:config_info, action.downcase.to_sym, :log_output) || 'on_error'
return unless %(on_error always).include?(log_option)
job = job(action)
return if log_option == 'on_error' && job.raw_status.normalized_status.succeeded?
return if log_option == 'on_error' && job.raw_status.succeeded?
_log.info("Stdout from ansible job #{job.name}: #{job.raw_stdout('txt_download')}")
rescue => err
_log.error("Failed to get stdout from ansible job #{job.name}")
Expand Down
13 changes: 13 additions & 0 deletions spec/models/service_ansible_playbook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@
executed_service.postprocess(action)
end
end

context 'require log stdout when job failed' do
before do
status = ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Job::Status.new('failed', nil)
allow(tower_job).to receive(:raw_status).and_return(status)
end

it 'writes stdout to log' do
expect(tower_job).to receive(:raw_stdout).with('txt_download')
expect(executed_service).to receive(:delete_inventory)
executed_service.postprocess(action)
end
end
end

describe '#on_error' do
Expand Down