summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-08-20 12:20:26 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-08-20 12:20:26 -0700
commitc1d2bc7ff9824b967cca21ed0254e4ee47168b10 (patch)
tree6efdba4777b20095c2bbd6cf7650a81cd9f9f596 /cloudinit/sources
parent0247b1be0ae3d1bc913b5e368dadf22e26b54b86 (diff)
downloadvyos-cloud-init-c1d2bc7ff9824b967cca21ed0254e4ee47168b10.tar.gz
vyos-cloud-init-c1d2bc7ff9824b967cca21ed0254e4ee47168b10.zip
Remove the matching of the filesystem dep and
add in the ability to use any fallback userdata or metadata found in the datasource config (if provided).
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceNone.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/cloudinit/sources/DataSourceNone.py b/cloudinit/sources/DataSourceNone.py
index e53eb280..b186113c 100644
--- a/cloudinit/sources/DataSourceNone.py
+++ b/cloudinit/sources/DataSourceNone.py
@@ -22,8 +22,6 @@ from cloudinit import util
LOG = logging.getLogger(__name__)
-NONE_IID = 'iid-datasource-none'
-
class DataSourceNone(sources.DataSource):
def __init__(self, sys_cfg, distro, paths, ud_proc=None):
@@ -33,10 +31,17 @@ class DataSourceNone(sources.DataSource):
self.userdata_raw = ''
def get_data(self):
+ # If the datasource config has any provided 'fallback'
+ # userdata or metadata, use it...
+ if 'userdata' in self.ds_cfg:
+ self.userdata = self.ds_cfg['userdata']
+ self.userdata_raw = util.yaml_dumps(self.userdata)
+ if 'metadata' in self.ds_cfg:
+ self.metadata = self.ds_cfg['metadata']
return True
def get_instance_id(self):
- return NONE_IID
+ return 'iid-datasource-none'
def __str__(self):
return util.obj_name(self)
@@ -46,10 +51,9 @@ class DataSourceNone(sources.DataSource):
return True
-# Used to match classes to dependencies (this will always match)
+# Used to match classes to dependencies
datasources = [
(DataSourceNone, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)),
- (DataSourceNone, (sources.DEP_FILESYSTEM,)),
(DataSourceNone, []),
]