restart-hosts: new options and a timeout
This commit is contained in:
parent
a5bd3b4495
commit
81eb30d5ce
3 changed files with 60 additions and 19 deletions
|
|
@ -1030,6 +1030,10 @@ def handle_restart_hosts(options, session, args):
|
|||
help=_("Do not print the task information"), default=options.quiet)
|
||||
parser.add_option("--force", action="store_true",
|
||||
help=_("Ignore checks and force operation"))
|
||||
parser.add_option("--channel", help=_("Only hosts in this channel"))
|
||||
parser.add_option("--arch", "-a", action="append", default=[],
|
||||
help=_("Limit to hosts of this architecture (can be "
|
||||
"given multiple times)"))
|
||||
(my_opts, args) = parser.parse_args(args)
|
||||
|
||||
activate_session(session, options)
|
||||
|
|
@ -1048,7 +1052,16 @@ def handle_restart_hosts(options, session, args):
|
|||
print('Use --force to run anyway')
|
||||
return 1
|
||||
|
||||
task_id = session.restartHosts()
|
||||
callopts = {}
|
||||
if my_opts.channel:
|
||||
callopts['channel'] = my_opts.channel
|
||||
if my_opts.arch:
|
||||
callopts['arches'] = my_opts.arch
|
||||
if callopts:
|
||||
task_id = session.restartHosts(options=callopts)
|
||||
else:
|
||||
# allow default case to work with older hub
|
||||
task_id = session.restartHosts()
|
||||
if my_opts.wait or (my_opts.wait is None and not _running_in_bg()):
|
||||
session.logout()
|
||||
return watch_tasks(session, [task_id], quiet=my_opts.quiet,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue