mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 21: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
|
@ -52,7 +52,7 @@ class Cli(object):
|
|||
parser = OptionParser(usage = 'ansible <host-pattern> [options]')
|
||||
parser.add_option("-a", "--args", dest="module_args",
|
||||
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
|
||||
parser.add_option("-B", "--background", dest="seconds", default=0,
|
||||
parser.add_option("-B", "--background", dest="seconds", type='int', default=0,
|
||||
help="run asynchronously, failing after X seconds")
|
||||
parser.add_option('-f','--forks', dest='forks', default=C.DEFAULT_FORKS, type='int',
|
||||
help='number of parallel processes to use')
|
||||
|
@ -66,6 +66,8 @@ class Cli(object):
|
|||
help="module name to execute", default=C.DEFAULT_MODULE_NAME)
|
||||
parser.add_option('-o', '--one-line', dest='one_line', action='store_true',
|
||||
help="condense output")
|
||||
parser.add_option('-P', '--poll', default=C.DEFAULT_POLL_INTERVAL, type='int',
|
||||
dest='poll_interval', help="set the poll interval if using -B")
|
||||
parser.add_option('-t', '--tree', dest='tree', default=None,
|
||||
help="log output to this directory")
|
||||
parser.add_option('-T', '--timeout', default=C.DEFAULT_TIMEOUT, type='int',
|
||||
|
@ -99,6 +101,8 @@ class Cli(object):
|
|||
timeout=options.timeout,
|
||||
forks=options.forks,
|
||||
background=options.seconds,
|
||||
poll_interval=options.poll_interval,
|
||||
async_poll_callback=async_poll_status,
|
||||
pattern=pattern,
|
||||
verbose=True,
|
||||
).run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue