diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-09-11 08:30:35 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-09-11 08:30:35 -0400 |
commit | 89cc478ee56a3f05ee4b810f8c969af9367bd034 (patch) | |
tree | c99b7ca65d7fadd38701d4f68841395528248f8b /cloudinit/util.py | |
parent | d3a341dc6e2fcb4efd00a44d8f5a4524e64c4d27 (diff) | |
parent | 2a07fcd6444c7deb09063dff6b2f2d6e5385f355 (diff) | |
download | vyos-cloud-init-89cc478ee56a3f05ee4b810f8c969af9367bd034.tar.gz vyos-cloud-init-89cc478ee56a3f05ee4b810f8c969af9367bd034.zip |
merge from trunk
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index e1c51f31..d50d3e18 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -1798,15 +1798,19 @@ def log_time(logfunc, msg, func, args=None, kwargs=None, get_uptime=False): 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: |