diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-01-25 17:37:43 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-01-25 17:37:43 -0500 |
commit | 8edefffea218862e6edbc78830159a272e6ffc0d (patch) | |
tree | c9d21bf403b929e844a0038d2d326210e6bc8e45 /cloudinit | |
parent | 7d89aaeab6efeda1c4b061c59c7b62afb46be70b (diff) | |
download | vyos-cloud-init-8edefffea218862e6edbc78830159a272e6ffc0d.tar.gz vyos-cloud-init-8edefffea218862e6edbc78830159a272e6ffc0d.zip |
add get_config_obj to a DataSource object.
This will allow for a DataSource to provide its own config
that will then be utilized as part of CloudConfig.
[to be used in OVF]
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/CloudConfig/__init__.py | 7 | ||||
-rw-r--r-- | cloudinit/DataSource.py | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cloudinit/CloudConfig/__init__.py b/cloudinit/CloudConfig/__init__.py index 22ad63a6..fe2dddcf 100644 --- a/cloudinit/CloudConfig/__init__.py +++ b/cloudinit/CloudConfig/__init__.py @@ -49,6 +49,13 @@ class CloudConfig(): cloudinit.log.debug(traceback.format_exc() + "\n") cfg = None if cfg is None: cfg = { } + + try: + ds_cfg = self.cloud.datasource.get_config_obj() + except: + ds_cfg = { } + + cfg = util.mergedict(cfg, ds_cfg) return(util.mergedict(cfg,self.cloud.cfg)) def handle(self, name, args, freq=None): diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py index d1458ffd..316eb5ae 100644 --- a/cloudinit/DataSource.py +++ b/cloudinit/DataSource.py @@ -35,6 +35,13 @@ class DataSource: def get_userdata_raw(self): return(self.userdata_raw) + + # the data sources' config_obj is a cloud-config formated + # object that came to it from ways other than cloud-config + # because cloud-config content would be handled elsewhere + def get_config_obj(self): + return({ }) + def get_public_ssh_keys(self): keys = [] if not self.metadata.has_key('public-keys'): return([]) |