summaryrefslogtreecommitdiff
path: root/cloud-init.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloud-init.py')
-rwxr-xr-xcloud-init.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/cloud-init.py b/cloud-init.py
index c92f07cd..68cc30bc 100755
--- a/cloud-init.py
+++ b/cloud-init.py
@@ -21,11 +21,24 @@ import sys
import cloudinit
import cloudinit.util as util
+import time
def warn(str):
sys.stderr.write(str)
def main():
+ now = time.strftime("%a, %d %b %Y %H:%M:%S %z")
+ try:
+ uptimef=open("/proc/uptime")
+ uptime=uptimef.read().split(" ")[0]
+ uptimef.close()
+ except IOError as e:
+ warn("unable to open /proc/uptime\n")
+ uptime = "na"
+
+ sys.stderr.write("cloud-init running: %s. up %s seconds\n" % (now, uptime))
+ sys.stderr.flush()
+
# cache is not instance specific, so it has to be purged
cloudinit.purge_cache()
@@ -35,7 +48,7 @@ def main():
cloud.get_data_source()
except Exception as e:
print e
- sys.stderr.write("Failed to get instance data")
+ sys.stderr.write("Failed to get instance data\n")
sys.exit(1)
# store the metadata