diff options
author | Scott Moser <smoser@brickies.net> | 2016-09-08 09:33:49 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-09-08 09:33:49 -0400 |
commit | f242ba437ce814e43e919e647ff0216e182329b8 (patch) | |
tree | 7f177f3eb4a1771efcc48fe04424ac91f71b8fa7 | |
parent | a2b25e33dff19ef5d60c9a9292529d25b76fc998 (diff) | |
parent | 058dd753b91126a504a82d4a48305e9d56116f73 (diff) | |
download | vyos-cloud-init-f242ba437ce814e43e919e647ff0216e182329b8.tar.gz vyos-cloud-init-f242ba437ce814e43e919e647ff0216e182329b8.zip |
merge from master at 0.7.7-26-g058dd75
-rw-r--r-- | cloudinit/config/cc_apt_configure.py | 7 | ||||
-rw-r--r-- | cloudinit/config/cc_phone_home.py | 2 | ||||
-rw-r--r-- | cloudinit/config/cc_salt_minion.py | 7 | ||||
-rwxr-xr-x | packages/bddeb | 13 | ||||
-rw-r--r-- | packages/debian/changelog.in | 2 | ||||
-rw-r--r-- | tests/unittests/test_handler/test_handler_apt_conf_v1.py | 22 |
6 files changed, 45 insertions, 8 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index 42c56418..fa9505a7 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -477,8 +477,11 @@ def convert_v2_to_v3_apt_format(oldcfg): 'add_apt_repo_match': 'add_apt_repo_match'} needtoconvert = [] for oldkey in mapoldkeys: - if oldcfg.get(oldkey, None) is not None: - needtoconvert.append(oldkey) + if oldkey in oldcfg: + if oldcfg[oldkey] in (None, ""): + del oldcfg[oldkey] + else: + needtoconvert.append(oldkey) # no old config, so no new one to be created if not needtoconvert: diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py index 72176d42..ae720bd2 100644 --- a/cloudinit/config/cc_phone_home.py +++ b/cloudinit/config/cc_phone_home.py @@ -31,7 +31,7 @@ POST_LIST_ALL = [ 'pub_key_ecdsa', 'instance_id', 'hostname', - 'fdqn' + 'fqdn' ] diff --git a/cloudinit/config/cc_salt_minion.py b/cloudinit/config/cc_salt_minion.py index f5786a31..13d70c8e 100644 --- a/cloudinit/config/cc_salt_minion.py +++ b/cloudinit/config/cc_salt_minion.py @@ -46,7 +46,12 @@ def handle(name, cfg, cloud, log, _args): # ... copy the key pair if specified if 'public_key' in salt_cfg and 'private_key' in salt_cfg: - pki_dir = salt_cfg.get('pki_dir', '/etc/salt/pki') + if os.path.isdir("/etc/salt/pki/minion"): + pki_dir_default = "/etc/salt/pki/minion" + else: + pki_dir_default = "/etc/salt/pki" + + pki_dir = salt_cfg.get('pki_dir', pki_dir_default) with util.umask(0o77): util.ensure_dir(pki_dir) pub_name = os.path.join(pki_dir, 'minion.pub') diff --git a/packages/bddeb b/packages/bddeb index 94496c74..abb7b607 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -67,7 +67,7 @@ def run_helper(helper, args=None, strip=True): return stdout -def write_debian_folder(root, version_data, pkgmap, pyver="3", +def write_debian_folder(root, templ_data, pkgmap, pyver="3", append_requires=[]): deb_dir = util.abs_join(root, 'debian') @@ -79,7 +79,7 @@ def write_debian_folder(root, version_data, pkgmap, pyver="3", templater.render_to_file(util.abs_join(find_root(), 'packages', 'debian', 'changelog.in'), util.abs_join(deb_dir, 'changelog'), - params=version_data) + params=templ_data) # Write out the control file template reqs = run_helper('read-dependencies').splitlines() @@ -147,6 +147,10 @@ def main(): default=os.environ.get("INIT_SYSTEM", "upstart,systemd")) + parser.add_argument("--release", dest="release", + help=("build with changelog referencing RELEASE"), + default="UNRELEASED") + for ent in DEBUILD_ARGS: parser.add_argument(ent, dest="debuild_args", action='append_const', const=ent, default=[], @@ -184,6 +188,7 @@ def main(): pkgmap[p] = "python3-" + p pyver = "3" + templ_data = {'debian_release': args.release} with util.tempdir() as tdir: # output like 0.7.6-1022-g36e92d3 @@ -208,7 +213,9 @@ def main(): append_requires = ['cloud-utils | cloud-guest-utils'] else: append_requires = [] - write_debian_folder(xdir, ver_data, pkgmap, + + templ_data.update(ver_data) + write_debian_folder(xdir, templ_data, pkgmap, pyver=pyver, append_requires=append_requires) print("Running 'debuild %s' in %r" % (' '.join(args.debuild_args), diff --git a/packages/debian/changelog.in b/packages/debian/changelog.in index f8e98258..bdf8d56f 100644 --- a/packages/debian/changelog.in +++ b/packages/debian/changelog.in @@ -1,5 +1,5 @@ ## template:basic -cloud-init (${version_long}-1~bddeb) UNRELEASED; urgency=low +cloud-init (${version_long}-1~bddeb) ${debian_release}; urgency=low * build diff --git a/tests/unittests/test_handler/test_handler_apt_conf_v1.py b/tests/unittests/test_handler/test_handler_apt_conf_v1.py index 95fd1da2..45714efd 100644 --- a/tests/unittests/test_handler/test_handler_apt_conf_v1.py +++ b/tests/unittests/test_handler/test_handler_apt_conf_v1.py @@ -3,6 +3,7 @@ from cloudinit import util from ..helpers import TestCase +import copy import os import re import shutil @@ -106,4 +107,25 @@ class TestAptProxyConfig(TestCase): self.assertFalse(os.path.isfile(self.cfile)) +class TestConversion(TestCase): + def test_convert_with_apt_mirror_as_empty_string(self): + # an empty apt_mirror is the same as no apt_mirror + empty_m_found = cc_apt_configure.convert_to_v3_apt_format( + {'apt_mirror': ''}) + default_found = cc_apt_configure.convert_to_v3_apt_format({}) + self.assertEqual(default_found, empty_m_found) + + def test_convert_with_apt_mirror(self): + mirror = 'http://my.mirror/ubuntu' + f = cc_apt_configure.convert_to_v3_apt_format({'apt_mirror': mirror}) + self.assertIn(mirror, {m['uri'] for m in f['apt']['primary']}) + + def test_no_old_content(self): + mirror = 'http://my.mirror/ubuntu' + mydata = {'apt': {'primary': {'arches': ['default'], 'uri': mirror}}} + expected = copy.deepcopy(mydata) + self.assertEqual(expected, + cc_apt_configure.convert_to_v3_apt_format(mydata)) + + # vi: ts=4 expandtab |