diff options
author | Jay Faulkner <jay@jvf.cc> | 2014-09-15 14:39:57 -0700 |
---|---|---|
committer | Jay Faulkner <jay@jvf.cc> | 2014-09-15 14:39:57 -0700 |
commit | fa7b60d5269cb76c4205b4709bd3048e14b9a0c7 (patch) | |
tree | 2d40f130216b7a3b1ee80d193170e5138d543b53 | |
parent | 6386accbf4933ecb368d2f32b7db95583e03b525 (diff) | |
download | vyos-cloud-init-fa7b60d5269cb76c4205b4709bd3048e14b9a0c7.tar.gz vyos-cloud-init-fa7b60d5269cb76c4205b4709bd3048e14b9a0c7.zip |
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.
-rw-r--r-- | cloudinit/config/cc_resizefs.py | 4 | ||||
-rw-r--r-- | cloudinit/util.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index 667d5977..a6280e6c 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -154,8 +154,8 @@ def handle(name, cfg, _cloud, log, args): # Fork to a child that will run # the resize command util.fork_cb( - util.log_time(logfunc=log.debug, msg="backgrounded Resizing", - func=do_resize, args=(resize_cmd, log))) + util.log_time, logfunc=log.debug, msg="backgrounded Resizing", + func=do_resize, args=(resize_cmd, log)) else: util.log_time(logfunc=log.debug, msg="Resizing", func=do_resize, args=(resize_cmd, log)) diff --git a/cloudinit/util.py b/cloudinit/util.py index 0821901a..f0fa7a19 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -193,11 +193,11 @@ def ExtendedTemporaryFile(**kwargs): return fh -def fork_cb(child_cb, *args): +def fork_cb(child_cb, *args, **kwargs): fid = os.fork() if fid == 0: try: - child_cb(*args) + child_cb(*args, **kwargs) os._exit(0) # pylint: disable=W0212 except: logexc(LOG, "Failed forking and calling callback %s", |