summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorHarm Weites <harm@weites.com>2013-12-14 17:38:04 +0000
committerHarm Weites <harm@weites.com>2013-12-14 17:38:04 +0000
commitddec564518c9aeb8bfaac713956ea0baf460a8ce (patch)
tree8f59d74e91337d278e2e4b5adda147b0fc0d7aea /cloudinit/util.py
parentab2bf49eecede2fe0ce4f7685f751c64b20dd390 (diff)
downloadvyos-cloud-init-ddec564518c9aeb8bfaac713956ea0baf460a8ce.tar.gz
vyos-cloud-init-ddec564518c9aeb8bfaac713956ea0baf460a8ce.zip
fix: Log the used method as well.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 8b77b163..e24e6d8d 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1418,12 +1418,15 @@ def time_rfc2822():
def uptime():
uptime_str = '??'
+ method = 'unknown'
try:
if os.path.exists("/proc/uptime"):
+ method = '/proc/uptime'
contents = load_file("/proc/uptime").strip()
if contents:
uptime_str = contents.split()[0]
else:
+ method = 'ctypes'
libc = ctypes.CDLL('/lib/libc.so.7')
size = ctypes.c_size_t()
buf = ctypes.c_int()
@@ -1434,7 +1437,7 @@ def uptime():
uptime_str = now - bootup
except:
- logexc(LOG, "Unable to read uptime")
+ logexc(LOG, "Unable to read uptime using method: %s" % method)
return uptime_str