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

[WIP] [Ansible::Runner] wait on artifacts/ to exist #20667

Closed
Closed
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
8 changes: 8 additions & 0 deletions lib/ansible/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def run_via_cli(hosts, credentials, env_vars, extra_vars, tags: nil, ansible_run
begin
fetch_galaxy_roles(playbook_or_role_args)
result = AwesomeSpawn.run("ansible-runner", :env => env_vars_hash, :params => params)
wait_on(File.join(base_dir, "artifacts"))
res = response(base_dir, ansible_runner_method, result)
ensure
# Clean up the tmp dir for the sync method, for async we will clean it up after the job is finished and we've
Expand Down Expand Up @@ -377,6 +378,13 @@ def python3_modules_path
def determine_existing_python_paths_for(*paths)
paths.select { |path| File.exist?(path) }
end

def wait_on(dir)
100.times do
Dir.exist?(dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you wanted break if Dir.exist? ?

Copy link
Member Author

@NickLaMuro NickLaMuro Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are correct... how did I miss that...

Anyway, thanks, will change in the new PR.

Edit: This is what I get for having to re-write something I tested in-place as a POC... without the raise though, it ✌️ technically ✌️ had the same effect...

sleep(0.1)
end
end
end
end
end