diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-01-28 10:48:56 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-01-28 10:48:56 -0500 |
commit | 8038c24d6dce45a4cc7eab55323c39901a7b072a (patch) | |
tree | c01b606c84a1222a92914908ec904a6f01b4fbc3 /cloudinit | |
parent | d0da58f89a0bf1841051340d09a0b0b6c5908506 (diff) | |
download | vyos-cloud-init-8038c24d6dce45a4cc7eab55323c39901a7b072a.tar.gz vyos-cloud-init-8038c24d6dce45a4cc7eab55323c39901a7b072a.zip |
add previous-instance-id and previous-datasource files to cloud/data
add 'datasource' file to instance dir
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index 5c83ccc2..64c260e9 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -208,7 +208,8 @@ class CloudInit: except OSError as e: if e.errno != errno.ENOENT: raise - os.symlink("./instances/%s" % self.get_instance_id(), cur_instance_link) + iid = self.get_instance_id() + os.symlink("./instances/%s" % iid, cur_instance_link) idir = self.get_ipath() dlist = [] for d in [ "handlers", "scripts", "sem" ]: @@ -216,6 +217,12 @@ class CloudInit: util.ensure_dirs(dlist) + ds = "%s: %s\n" % ( self.datasource.__class__, str(self.datasource) ) + dp = self.get_cpath('datadir') + util.write_file("%s/%s" % (idir, 'datasource'), ds) + util.write_file("%s/%s" % (dp, 'previous-datasource'), ds) + util.write_file("%s/%s" % (dp, 'previous-instance-id'), "%s\n" % iid) + def get_userdata(self): return(self.datasource.get_userdata()) |