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]
This commit is contained in:
Scott Moser 2011-01-25 17:37:43 -05:00
parent c408f4f980
commit b72490a35d
2 changed files with 14 additions and 0 deletions

View File

@ -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):

View File

@ -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([])