diff options
| author | Scott Moser <smoser@ubuntu.com> | 2012-12-06 09:36:57 -0500 | 
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2012-12-06 09:36:57 -0500 | 
| commit | 5c5041367a8630543d84a9edf9dd4321f0c69718 (patch) | |
| tree | 64d3ea6dce570cb3dc34d43282bb1a8f9fedc9eb | |
| parent | 375995c9bd3e9d1794395f471d2215c58b7f2453 (diff) | |
| download | vyos-cloud-init-5c5041367a8630543d84a9edf9dd4321f0c69718.tar.gz vyos-cloud-init-5c5041367a8630543d84a9edf9dd4321f0c69718.zip | |
cloudinit/stages.py: separate _read_base_cfg() into static function
The Init._read_base_cfg() was really a static function, this just moves
it to its own static function.  Its not used anywhere else at the moment.
| -rw-r--r-- | cloudinit/stages.py | 37 | 
1 files changed, 21 insertions, 16 deletions
| diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 94a267df..d9391f39 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -157,27 +157,12 @@ class Init(object):              self._cfg = self._read_cfg(extra_fns)              # LOG.debug("Loaded 'init' config %s", self._cfg) -    def _read_base_cfg(self): -        base_cfgs = [] -        default_cfg = util.get_builtin_cfg() -        kern_contents = util.read_cc_from_cmdline() -        # Kernel/cmdline parameters override system config -        if kern_contents: -            base_cfgs.append(util.load_yaml(kern_contents, default={})) -        # Anything in your conf.d location?? -        # or the 'default' cloud.cfg location??? -        base_cfgs.append(util.read_conf_with_confd(CLOUD_CONFIG)) -        # And finally the default gets to play -        if default_cfg: -            base_cfgs.append(default_cfg) -        return util.mergemanydict(base_cfgs) -      def _read_cfg(self, extra_fns):          no_cfg_paths = helpers.Paths({}, self.datasource)          merger = helpers.ConfigMerger(paths=no_cfg_paths,                                        datasource=self.datasource,                                        additional_fns=extra_fns, -                                      base_cfg=self._read_base_cfg()) +                                      base_cfg=fetch_base_config())          return merger.cfg      def _restore_from_cache(self): @@ -575,3 +560,23 @@ class Modules(object):          raw_mods = self._read_modules(section_name)          mostly_mods = self._fixup_modules(raw_mods)          return self._run_modules(mostly_mods) + + +def fetch_base_config(): +    base_cfgs = [] +    default_cfg = util.get_builtin_cfg() +    kern_contents = util.read_cc_from_cmdline() + +    # Kernel/cmdline parameters override system config +    if kern_contents: +        base_cfgs.append(util.load_yaml(kern_contents, default={})) + +    # Anything in your conf.d location?? +    # or the 'default' cloud.cfg location??? +    base_cfgs.append(util.read_conf_with_confd(CLOUD_CONFIG)) + +    # And finally the default gets to play +    if default_cfg: +        base_cfgs.append(default_cfg) + +    return util.mergemanydict(base_cfgs) | 
