summaryrefslogtreecommitdiff
path: root/cloudinit/analyze/show.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/analyze/show.py')
-rw-r--r--cloudinit/analyze/show.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/cloudinit/analyze/show.py b/cloudinit/analyze/show.py
index abfa0913..04621f12 100644
--- a/cloudinit/analyze/show.py
+++ b/cloudinit/analyze/show.py
@@ -8,7 +8,6 @@ import base64
import datetime
import json
import os
-import sys
import time
from cloudinit import subp, util
@@ -257,25 +256,21 @@ def gather_timestamps_using_systemd():
status = SUCCESS_CODE
# lxc based containers do not set their monotonic zero point to be when
# the container starts, instead keep using host boot as zero point
- # time.CLOCK_MONOTONIC_RAW is only available in python 3.3
if util.is_container():
# clock.monotonic also uses host boot as zero point
- if sys.version_info >= (3, 3):
- base_time = float(time.time()) - float(time.monotonic())
- # TODO: lxcfs automatically truncates /proc/uptime to seconds
- # in containers when https://github.com/lxc/lxcfs/issues/292
- # is fixed, util.uptime() should be used instead of stat on
- try:
- file_stat = os.stat("/proc/1/cmdline")
- kernel_start = file_stat.st_atime
- except OSError as err:
- raise RuntimeError(
- "Could not determine container boot "
- "time from /proc/1/cmdline. ({})".format(err)
- ) from err
- status = CONTAINER_CODE
- else:
- status = FAIL_CODE
+ base_time = float(time.time()) - float(time.monotonic())
+ # TODO: lxcfs automatically truncates /proc/uptime to seconds
+ # in containers when https://github.com/lxc/lxcfs/issues/292
+ # is fixed, util.uptime() should be used instead of stat on
+ try:
+ file_stat = os.stat("/proc/1/cmdline")
+ kernel_start = file_stat.st_atime
+ except OSError as err:
+ raise RuntimeError(
+ "Could not determine container boot "
+ "time from /proc/1/cmdline. ({})".format(err)
+ ) from err
+ status = CONTAINER_CODE
kernel_end = base_time + delta_k_end
cloudinit_sysd = base_time + delta_ci_s