summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2012-12-17 08:41:11 -0500
committerScott Moser <smoser@ubuntu.com>2012-12-17 08:41:11 -0500
commitc196afccda0293613e3586922347749c33dfddbf (patch)
tree01da7bd969ce78450b09fb386a9a8f9b46a67aa4
parent3b37e40202143b6acafff5a5bb3dba233b91821f (diff)
downloadvyos-cloud-init-c196afccda0293613e3586922347749c33dfddbf.tar.gz
vyos-cloud-init-c196afccda0293613e3586922347749c33dfddbf.zip
ensure a datasource's 'distro' and sys_cfg are updated
After parsing and merging datasource's config, the changes in were not making it into the datasource's 'distro. The end result was that the when a config module was called, it's 'cloud' argument would be updated in 'cloud.distro', but not in 'cloud.datasource.distro'. This path was required for getting mirror settings to take affect, because they include information from the datasource. Ie: cc_apt_configure had mirror_info = cloud.datasource.get_package_mirror_info() the datasource then used *its* copy of sys_cfg to call self.distro.get_package_mirror_info and *that* distro's sys_cfg had not been updated. LP: #1090482
-rw-r--r--ChangeLog2
-rw-r--r--cloudinit/stages.py20
2 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e4bcdd76..64a6e618 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@
option (LP: #1083715)
- make install of puppet configurable (LP: #1090205) [Craig Tracey]
- support omnibus installer for chef [Anatoliy Dobrosynets]
+ - fix bug where cloud-config in user-data could not modify system_info
+ settings (LP: #1090482)
0.7.1:
- sysvinit: fix missing dependency in cloud-init job for RHEL 5.6
- config-drive: map hostname to local-hostname (LP: #1061964)
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index d9391f39..8d3213b4 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -63,23 +63,29 @@ class Init(object):
# Changed only when a fetch occurs
self.datasource = NULL_DATA_SOURCE
- def _reset(self, ds=False):
+ def _reset(self, reset_ds=False):
# Recreated on access
self._cfg = None
self._paths = None
self._distro = None
- if ds:
+ if reset_ds:
self.datasource = NULL_DATA_SOURCE
@property
def distro(self):
if not self._distro:
# Try to find the right class to use
- scfg = self._extract_cfg('system')
- name = scfg.pop('distro', 'ubuntu')
- cls = distros.fetch(name)
- LOG.debug("Using distro class %s", cls)
- self._distro = cls(name, scfg, self.paths)
+ system_config = self._extract_cfg('system')
+ distro_name = system_config.pop('distro', 'ubuntu')
+ distro_cls = distros.fetch(distro_name)
+ LOG.debug("Using distro class %s", distro_cls)
+ self._distro = distro_cls(distro_name, system_config, self.paths)
+ # If we have an active datasource we need to adjust
+ # said datasource and move its distro/system config
+ # from whatever it was to a new set...
+ if self.datasource is not NULL_DATA_SOURCE:
+ self.datasource.distro = self._distro
+ self.datasource.sys_cfg = system_config
return self._distro
@property