summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/__init__.py19
-rw-r--r--doc/var-lib-cloud.txt5
2 files changed, 15 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
diff --git a/doc/var-lib-cloud.txt b/doc/var-lib-cloud.txt
index 5cdcddbb..2a1acd2b 100644
--- a/doc/var-lib-cloud.txt
+++ b/doc/var-lib-cloud.txt
@@ -34,6 +34,8 @@
user-data.txt.i
obj.pkl
handlers/
+ data/ # just a per-instance data location to be used
+
- sem/
scripts.once
These are the cloud-specific semaphores. The only thing that
@@ -44,6 +46,9 @@
"persistent" handlers (not per-instance). Same as handlers
from user-data, just will be cross-instance id
+ - data/
+ this is a persistent data location. cloud-init won't really
+ use it, but something else (a handler or script could)
to clear out the current instance's data as if to force a "new run" on reboot
do: