Skip to content

Commit

Permalink
Merge pull request #23035 from agrare/fix_embedded_ansible_playbook_z…
Browse files Browse the repository at this point in the history
…ero_min_timeout

Don't send a 0.minute timeout for EmbeddedAnsible Playbook run if execution_ttl is not passed
  • Loading branch information
bdunne authored May 14, 2024
2 parents 6fb7857 + bc4b02e commit 9c9dd1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def run(vars = {}, _userid = nil)
credentials = collect_credentials(vars)

kwargs = {:become_enabled => vars[:become_enabled]}
kwargs[:timeout] = vars[:execution_ttl].to_i.minutes
kwargs[:verbosity] = vars[:verbosity].to_i if vars[:verbosity].present?
kwargs[:timeout] = vars[:execution_ttl].to_i.minutes if vars[:execution_ttl].present?
kwargs[:verbosity] = vars[:verbosity].to_i if vars[:verbosity].present?

workflow.create_job({}, extra_vars, playbook_vars, vars[:hosts], credentials, **kwargs).tap(&:signal_start)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
expect(job.options[:verbosity]).to eq(5)
end

it "defaults to timeout 1.hour with execution_ttl is not passed" do
job = playbook.run

expect(job).to be_a(ManageIQ::Providers::AnsiblePlaybookWorkflow)
expect(job.options[:timeout]).to eq(1.hour)
end

it "passes become_enabled to the job when specified" do
job = playbook.run(:become_enabled => true)

Expand Down

0 comments on commit 9c9dd1c

Please sign in to comment.