Fix bug 1338614
util.log_time()'s return value was what was being sent to fork_cb. This means the resize ran in parallel and the call to fork_cb threw a traceback (trying to call Nonetype). By permitting fork_cb to take kwargs, and using the correct method syntax, this now forks and resizes in the background as appropriate.
This commit is contained in:
parent
6e2c5b6209
commit
170dbd50eb
@ -154,8 +154,8 @@ def handle(name, cfg, _cloud, log, args):
|
|||||||
# Fork to a child that will run
|
# Fork to a child that will run
|
||||||
# the resize command
|
# the resize command
|
||||||
util.fork_cb(
|
util.fork_cb(
|
||||||
util.log_time(logfunc=log.debug, msg="backgrounded Resizing",
|
util.log_time, logfunc=log.debug, msg="backgrounded Resizing",
|
||||||
func=do_resize, args=(resize_cmd, log)))
|
func=do_resize, args=(resize_cmd, log))
|
||||||
else:
|
else:
|
||||||
util.log_time(logfunc=log.debug, msg="Resizing",
|
util.log_time(logfunc=log.debug, msg="Resizing",
|
||||||
func=do_resize, args=(resize_cmd, log))
|
func=do_resize, args=(resize_cmd, log))
|
||||||
|
@ -193,11 +193,11 @@ def ExtendedTemporaryFile(**kwargs):
|
|||||||
return fh
|
return fh
|
||||||
|
|
||||||
|
|
||||||
def fork_cb(child_cb, *args):
|
def fork_cb(child_cb, *args, **kwargs):
|
||||||
fid = os.fork()
|
fid = os.fork()
|
||||||
if fid == 0:
|
if fid == 0:
|
||||||
try:
|
try:
|
||||||
child_cb(*args)
|
child_cb(*args, **kwargs)
|
||||||
os._exit(0) # pylint: disable=W0212
|
os._exit(0) # pylint: disable=W0212
|
||||||
except:
|
except:
|
||||||
logexc(LOG, "Failed forking and calling callback %s",
|
logexc(LOG, "Failed forking and calling callback %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user