cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00312
[Merge] lp:~harlowja/cloud-init/udelta-verify into lp:cloud-init
Joshua Harlow has proposed merging lp:~harlowja/cloud-init/udelta-verify into lp:cloud-init.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/udelta-verify/+merge/184422
Ensure that udelta is valid before including it as a float.
--
https://code.launchpad.net/~harlowja/cloud-init/udelta-verify/+merge/184422
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/udelta-verify into lp:cloud-init.
=== modified file 'cloudinit/util.py'
--- cloudinit/util.py 2013-07-30 18:28:09 +0000
+++ cloudinit/util.py 2013-09-07 07:11:07 +0000
@@ -1791,15 +1791,19 @@
ret = func(*args, **kwargs)
finally:
delta = time.time() - start
+ udelta = None
if ustart is not None:
try:
udelta = float(uptime()) - ustart
except ValueError:
- udelta = "N/A"
+ pass
tmsg = " took %0.3f seconds" % delta
if get_uptime:
- tmsg += "(%0.2f)" % udelta
+ if isinstance(udelta, (float)):
+ tmsg += " (%0.2f)" % udelta
+ else:
+ tmsg += " (N/A)"
try:
logfunc(msg + tmsg)
except:
Follow ups