diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-01-19 20:30:29 +0000 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-01-19 20:30:29 +0000 |
commit | 14aa0cac0d5e2b57dc94f2145fdbd3d494898019 (patch) | |
tree | ab980e8a0db6751556008ca76786fda542dacb1a /cloudinit/__init__.py | |
parent | 27032a10e8c9234ee4444be206da7b568bfa872a (diff) | |
download | vyos-cloud-init-14aa0cac0d5e2b57dc94f2145fdbd3d494898019.tar.gz vyos-cloud-init-14aa0cac0d5e2b57dc94f2145fdbd3d494898019.zip |
add 'data' entry in pathmap and move get_cpath to a static function
Diffstat (limited to 'cloudinit/__init__.py')
-rw-r--r-- | cloudinit/__init__.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index 55350442..8358085d 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -20,7 +20,6 @@ varlibdir = '/var/lib/cloud' cur_instance_link = varlibdir + "/instance" -datadir = '/var/lib/cloud/data' system_config = '/etc/cloud/cloud.cfg' seeddir = varlibdir + "/seed" cfg_env_name = "CLOUD_CFG" @@ -44,6 +43,7 @@ pathmap = { "userdata" : "/user-data-raw.txt.i", "obj_pkl" : "/obj.pkl", "cloud_config" : "/cloud-config.txt", + "datadir" : "/data", None : "", } @@ -256,7 +256,7 @@ class CloudInit: def sem_getpath(self,name,freq): if freq == 'once-per-instance': return("%s/%s" % (self.get_ipath("sem"),name)) - return("%s/%s.%s" % (self.get_cpath("sem"), name, freq)) + return("%s/%s.%s" % (get_cpath("sem"), name, freq)) def sem_has_run(self,name,freq): if freq == "always": return False @@ -321,16 +321,11 @@ class CloudInit: return("%s/instances/%s%s" % (varlibdir,self.get_instance_id(), pathmap[name])) - # get_cpath : get the "clouddir" (/var/lib/cloud/<name>) - # for a name in dirmap - def get_cpath(self, name=None): - return("%s%s" % (varlibdir, pathmap[name])) - def consume_userdata(self): self.get_userdata() data = self - cdir = self.get_cpath("handlers") + cdir = get_cpath("handlers") idir = self.get_ipath("handlers") # add the path to the plugins dir to the top of our list for import @@ -486,7 +481,7 @@ class CloudInit: def initfs(): subds = [ 'scripts/per-instance', 'scripts/per-once', 'scripts/per-boot', - 'seed', 'instances', 'handlers', 'sem' ] + 'seed', 'instances', 'handlers', 'sem', 'data' ] dlist = [ ] for subd in subds: dlist.append("%s/%s" % (varlibdir, subd)) @@ -510,6 +505,12 @@ def purge_cache(): def get_ipath_cur(name=None): return("%s/instance/%s" % (varlibdir, pathmap[name])) +# get_cpath : get the "clouddir" (/var/lib/cloud/<name>) +# for a name in dirmap +def get_cpath(self, name=None): + return("%s%s" % (varlibdir, pathmap[name])) + + class DataSourceNotFoundException(Exception): pass |