From 2ddaa93b870bb0953a5a23b0eab155b21dd05a0f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 31 Aug 2016 17:10:29 -0400 Subject: bddeb: add --release flag to specify the release in changelog. ./packages/bddeb --release=xenial that will get you a changelog with Distribution of xenial rather than UNRELEASED. --- packages/bddeb | 13 ++++++++++--- packages/debian/changelog.in | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) 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 -- cgit v1.2.3 From 30ca98c3bf7762c878bc6834807e262a3cbe8c2c Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 30 Aug 2016 16:49:10 -0400 Subject: salt minion: update default pki directory for newer salt minion. Assuming that the installed package creates the directory /etc/salt/pki/minion (ubuntu yakkety does), this will pick that directory for the pki_dir default. If it does not exist, then it will maintain the old directory. LP: #1609899 --- cloudinit/config/cc_salt_minion.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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') -- cgit v1.2.3 From a757c678f225c4b3da9d632a52c15fd667daebbf Mon Sep 17 00:00:00 2001 From: Roland Sommer Date: Fri, 2 Sep 2016 09:27:03 -0400 Subject: Fix typo in default keys for phone_home This should be fqdn, not fdqn. LP: #1607810 --- cloudinit/config/cc_phone_home.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' ] -- cgit v1.2.3 From 058dd753b91126a504a82d4a48305e9d56116f73 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 7 Sep 2016 13:47:38 -0400 Subject: apt config conversion: treat empty string as not provided. Old behavior allowed a user to provide: apt_mirror: "" And that was the same as: apt_mirror: null and the same as having not specified apt_mirror at all. This maintains that behavior for all old string values. LP: #1621180 --- cloudinit/config/cc_apt_configure.py | 7 +++++-- .../test_handler/test_handler_apt_conf_v1.py | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 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/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 -- cgit v1.2.3