mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Add async polling logic to runner. Will add to playbook shortly, have to diagnose why paramiko
is not letting async_wrapper daemonize itself when it does work fine when directly executed.
This commit is contained in:
parent
60a13cf540
commit
5be1a612d3
5 changed files with 54 additions and 9 deletions
|
@ -167,6 +167,7 @@ def prepare_writeable_dir(tree):
|
|||
exit("Cannot write to path %s" % tree)
|
||||
|
||||
def path_dwim(basedir, given):
|
||||
''' make relative paths work like folks expect '''
|
||||
if given.startswith("/"):
|
||||
return given
|
||||
elif given.startswith("~/"):
|
||||
|
@ -174,4 +175,12 @@ def path_dwim(basedir, given):
|
|||
else:
|
||||
return os.path.join(basedir, given)
|
||||
|
||||
|
||||
def async_poll_status(runner, clock, poll_interval, ok, host, jid, result):
|
||||
if ok and 'finished' in result:
|
||||
print "<job %s> finished on %s, %s" % (jid, host, result)
|
||||
elif not ok or 'failed' in result:
|
||||
print "<job %s> FAILED on %s, %s" % (jid, host, result)
|
||||
else:
|
||||
print "<job %s> polling on %s, %s remaining" % (jid, host, clock)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue