diff options
author | Scott Moser <smoser@ubuntu.com> | 2010-05-05 10:48:48 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2010-05-05 10:48:48 -0400 |
commit | bec9d097ebcbc5e8d595990d8cbcbb30f433e2fb (patch) | |
tree | ca4445ec465d57a7151f83efea0a8869626350b4 /cloud-init.py | |
parent | bc0a5f24f95a47a7f846233e1fdda65bdb3d607e (diff) | |
download | vyos-cloud-init-bec9d097ebcbc5e8d595990d8cbcbb30f433e2fb.tar.gz vyos-cloud-init-bec9d097ebcbc5e8d595990d8cbcbb30f433e2fb.zip |
wait considerably longer (1050 seconds) for metadata service to come up
Also
- adds some debugging information when its waiting
- add 'uptime' printout on initial cloud-init invocation
Diffstat (limited to 'cloud-init.py')
-rwxr-xr-x | cloud-init.py | 15 |
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 |