Merge ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel

Proposed by Chad Smith
Status: Merged
Merged at revision: 5cd6ba3f397e278c422154da26c8f34c08079256
Proposed branch: ~chad.smith/cloud-init:ubuntu/devel
Merge into: cloud-init:ubuntu/devel
Diff against target: 267 lines (+182/-7)
5 files modified
ChangeLog (+85/-0)
cloudinit/cmd/main.py (+12/-6)
cloudinit/version.py (+1/-1)
debian/changelog (+9/-0)
tests/unittests/test_cli.py (+75/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Pending
Review via email: mp+335267@code.launchpad.net

Description of the change

Merge upstream snapshot of 17.2 from master for release in Bionic.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:5cd6ba3f397e278c422154da26c8f34c08079256
https://jenkins.ubuntu.com/server/job/cloud-init-ci/635/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/635/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:5cd6ba3f397e278c422154da26c8f34c08079256
https://jenkins.ubuntu.com/server/job/cloud-init-ci/636/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/636/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ChangeLog b/ChangeLog
2index 0260c57..31c2dcb 100644
3--- a/ChangeLog
4+++ b/ChangeLog
5@@ -1,3 +1,88 @@
6+17.2:
7+ - ds-identify: failure in NoCloud due to unset variable usage.
8+ (LP: #1737704)
9+ - tests: fix collect_console when not implemented [Joshua Powers]
10+ - ec2: Use instance-identity doc for region and instance-id
11+ [Andrew Jorgensen]
12+ - tests: remove leaked tmp files in config drive tests.
13+ - setup.py: Do not include rendered files in SOURCES.txt
14+ - SUSE: remove delta in systemd local template for SUSE [Robert Schweikert]
15+ - tests: move to using tox 1.7.5
16+ - OVF: improve ds-identify to support finding OVF iso transport.
17+ (LP: #1731868)
18+ - VMware: Support for user provided pre and post-customization scripts
19+ [Maitreyee Saikia]
20+ - citest: In NoCloudKVM provide keys via metadata not userdata.
21+ - pylint: Update pylint to 1.7.1, run on tests/ and tools and fix
22+ complaints.
23+ - Datasources: Formalize DataSource get_data and related properties.
24+ - cli: Add clean and status subcommands
25+ - tests: consolidate platforms into specific dirs
26+ - ec2: Fix sandboxed dhclient background process cleanup. (LP: #1735331)
27+ - tests: NoCloudKVMImage do not modify the original local cache image.
28+ - tests: Enable bionic in integration tests. [Joshua Powers]
29+ - tests: Use apt-get to install a deb so that depends get resolved.
30+ - sysconfig: Correctly render dns and dns search info.
31+ [Ryan McCabe] (LP: #1705804)
32+ - integration test: replace curtin test ppa with cloud-init test ppa.
33+ - EC2: Fix bug using fallback_nic and metadata when restoring from cache.
34+ (LP: #1732917)
35+ - EC2: Kill dhclient process used in sandbox dhclient. (LP: #1732964)
36+ - ntp: fix configuration template rendering for openSUSE and SLES
37+ (LP: #1726572)
38+ - centos: Provide the failed #include url in error messages
39+ - Catch UrlError when #include'ing URLs [Andrew Jorgensen]
40+ - hosts: Fix openSUSE and SLES setup for /etc/hosts and clarify docs.
41+ [Robert Schweikert] (LP: #1731022)
42+ - rh_subscription: Perform null checks for enabled and disabled repos.
43+ [Dave Mulford]
44+ - Improve warning message when a template is not found.
45+ [Robert Schweikert] (LP: #1731035)
46+ - Replace the temporary i9n.brickies.net with i9n.cloud-init.io.
47+ - Azure: don't generate network configuration for SRIOV devices
48+ (LP: #1721579)
49+ - tests: address some minor feedback missed in last merge.
50+ - tests: integration test cleanup and full pass of nocloud-kvm.
51+ - Gentoo: chmod +x on all files in sysvinit/gentoo/
52+ [ckonstanski] (LP: #1727126)
53+ - EC2: Limit network config to fallback nic, fix local-ipv4 only
54+ instances. (LP: #1728152)
55+ - Gentoo: Use "rc-service" rather than "service".
56+ [Carlos Konstanski] (LP: #1727121)
57+ - resizefs: Fix regression when system booted with root=PARTUUID=
58+ (LP: #1725067)
59+ - tools: make yum package installation more reliable
60+ - citest: fix remaining warnings raised by integration tests.
61+ - citest: show the class actual class name in results.
62+ - ntp: fix config module schema to allow empty ntp config (LP: #1724951)
63+ - tools: disable fastestmirror if using proxy [Joshua Powers]
64+ - schema: Log debug instead of warning when jsonschema is not available.
65+ (LP: #1724354)
66+ - simpletable: Fix get_string method to return table-formatted string
67+ (LP: #1722566)
68+ - net: Handle bridge stp values of 0 and convert to boolean type
69+ - tools: Give specific --abbrev=8 to "git describe"
70+ - network: bridge_stp value not always correct (LP: #1721157)
71+ - tests: re-enable tox with nocloud-kvm support [Joshua Powers]
72+ - systemd: remove limit on tasks created by cloud-init-final.service.
73+ [Robert Schweikert] (LP: #1717969)
74+ - suse: Support addition of zypper repos via cloud-config.
75+ [Robert Schweikert] (LP: #1718675)
76+ - tests: Combine integration configs and testcases [Joshua Powers]
77+ - Azure, CloudStack: Support reading dhcp options from systemd-networkd.
78+ [Dimitri John Ledkov] (LP: #1718029)
79+ - packages/debian/copyright: remove mention of boto and MIT license
80+ - systemd: only mention Before=apt-daily.service on debian based distros.
81+ [Robert Schweikert]
82+ - Add missing simpletable and simpletable tests for failed merge
83+ - Remove prettytable dependency, introduce simpletable [Andrew Jorgensen]
84+ - debian/copyright: dep5 updates, reorganize, add Apache 2.0 license.
85+ [Joshua Powers] (LP: #1718681)
86+ - tests: remove dependency on shlex [Joshua Powers]
87+ - AltCloud: Trust PATH for udevadm and modprobe.
88+ - DataSourceOVF: use util.find_devs_with(TYPE=iso9660) (LP: #1718287)
89+ - tests: remove a temp file used in bootcmd tests.
90+
91 17.1:
92 - doc: document GCE datasource. [Arnd Hannemann]
93 - suse: updates to templates to support openSUSE and SLES.
94diff --git a/cloudinit/cmd/main.py b/cloudinit/cmd/main.py
95index aa56225..30b37fe 100644
96--- a/cloudinit/cmd/main.py
97+++ b/cloudinit/cmd/main.py
98@@ -603,7 +603,11 @@ def status_wrapper(name, args, data_d=None, link_d=None):
99 else:
100 raise ValueError("unknown name: %s" % name)
101
102- modes = ('init', 'init-local', 'modules-config', 'modules-final')
103+ modes = ('init', 'init-local', 'modules-init', 'modules-config',
104+ 'modules-final')
105+ if mode not in modes:
106+ raise ValueError(
107+ "Invalid cloud init mode specified '{0}'".format(mode))
108
109 status = None
110 if mode == 'init-local':
111@@ -615,16 +619,18 @@ def status_wrapper(name, args, data_d=None, link_d=None):
112 except Exception:
113 pass
114
115+ nullstatus = {
116+ 'errors': [],
117+ 'start': None,
118+ 'finished': None,
119+ }
120 if status is None:
121- nullstatus = {
122- 'errors': [],
123- 'start': None,
124- 'finished': None,
125- }
126 status = {'v1': {}}
127 for m in modes:
128 status['v1'][m] = nullstatus.copy()
129 status['v1']['datasource'] = None
130+ elif mode not in status['v1']:
131+ status['v1'][mode] = nullstatus.copy()
132
133 v1 = status['v1']
134 v1['stage'] = mode
135diff --git a/cloudinit/version.py b/cloudinit/version.py
136index 3255f39..be6262d 100644
137--- a/cloudinit/version.py
138+++ b/cloudinit/version.py
139@@ -4,7 +4,7 @@
140 #
141 # This file is part of cloud-init. See LICENSE file for license information.
142
143-__VERSION__ = "17.1"
144+__VERSION__ = "17.2"
145
146 FEATURES = [
147 # supports network config version 1
148diff --git a/debian/changelog b/debian/changelog
149index c07ed7e..e555270 100644
150--- a/debian/changelog
151+++ b/debian/changelog
152@@ -1,3 +1,12 @@
153+cloud-init (17.2-1-g4089e20c-0ubuntu1) bionic; urgency=medium
154+
155+ * New upstream snapshot.
156+ - cli: Fix error in cloud-init modules --mode=init.
157+ (LP: #1736600)
158+ - release 17.2
159+
160+ -- Chad Smith <chad.smith@canonical.com> Fri, 15 Dec 2017 10:11:50 -0700
161+
162 cloud-init (17.1-60-ga30a3bb5-0ubuntu1) bionic; urgency=medium
163
164 * New upstream snapshot.
165diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
166index a8d28ae..0c0f427 100644
167--- a/tests/unittests/test_cli.py
168+++ b/tests/unittests/test_cli.py
169@@ -1,9 +1,12 @@
170 # This file is part of cloud-init. See LICENSE file for license information.
171
172+from collections import namedtuple
173+import os
174 import six
175
176 from cloudinit.cmd import main as cli
177 from cloudinit.tests import helpers as test_helpers
178+from cloudinit.util import load_file, load_json
179
180
181 mock = test_helpers.mock
182@@ -11,6 +14,8 @@ mock = test_helpers.mock
183
184 class TestCLI(test_helpers.FilesystemMockingTestCase):
185
186+ with_logs = True
187+
188 def setUp(self):
189 super(TestCLI, self).setUp()
190 self.stderr = six.StringIO()
191@@ -24,6 +29,76 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
192 except SystemExit as e:
193 return e.code
194
195+ def test_status_wrapper_errors_on_invalid_name(self):
196+ """status_wrapper will error when the name parameter is not valid.
197+
198+ Valid name values are only init and modules.
199+ """
200+ tmpd = self.tmp_dir()
201+ data_d = self.tmp_path('data', tmpd)
202+ link_d = self.tmp_path('link', tmpd)
203+ FakeArgs = namedtuple('FakeArgs', ['action', 'local', 'mode'])
204+
205+ def myaction():
206+ raise Exception('Should not call myaction')
207+
208+ myargs = FakeArgs(('doesnotmatter', myaction), False, 'bogusmode')
209+ with self.assertRaises(ValueError) as cm:
210+ cli.status_wrapper('init1', myargs, data_d, link_d)
211+ self.assertEqual('unknown name: init1', str(cm.exception))
212+ self.assertNotIn('Should not call myaction', self.logs.getvalue())
213+
214+ def test_status_wrapper_errors_on_invalid_modes(self):
215+ """status_wrapper will error if a parameter combination is invalid."""
216+ tmpd = self.tmp_dir()
217+ data_d = self.tmp_path('data', tmpd)
218+ link_d = self.tmp_path('link', tmpd)
219+ FakeArgs = namedtuple('FakeArgs', ['action', 'local', 'mode'])
220+
221+ def myaction():
222+ raise Exception('Should not call myaction')
223+
224+ myargs = FakeArgs(('modules_name', myaction), False, 'bogusmode')
225+ with self.assertRaises(ValueError) as cm:
226+ cli.status_wrapper('modules', myargs, data_d, link_d)
227+ self.assertEqual(
228+ "Invalid cloud init mode specified 'modules-bogusmode'",
229+ str(cm.exception))
230+ self.assertNotIn('Should not call myaction', self.logs.getvalue())
231+
232+ def test_status_wrapper_init_local_writes_fresh_status_info(self):
233+ """When running in init-local mode, status_wrapper writes status.json.
234+
235+ Old status and results artifacts are also removed.
236+ """
237+ tmpd = self.tmp_dir()
238+ data_d = self.tmp_path('data', tmpd)
239+ link_d = self.tmp_path('link', tmpd)
240+ status_link = self.tmp_path('status.json', link_d)
241+ # Write old artifacts which will be removed or updated.
242+ for _dir in data_d, link_d:
243+ test_helpers.populate_dir(
244+ _dir, {'status.json': 'old', 'result.json': 'old'})
245+
246+ FakeArgs = namedtuple('FakeArgs', ['action', 'local', 'mode'])
247+
248+ def myaction(name, args):
249+ # Return an error to watch status capture them
250+ return 'SomeDatasource', ['an error']
251+
252+ myargs = FakeArgs(('ignored_name', myaction), True, 'bogusmode')
253+ cli.status_wrapper('init', myargs, data_d, link_d)
254+ # No errors reported in status
255+ status_v1 = load_json(load_file(status_link))['v1']
256+ self.assertEqual(['an error'], status_v1['init-local']['errors'])
257+ self.assertEqual('SomeDatasource', status_v1['datasource'])
258+ self.assertFalse(
259+ os.path.exists(self.tmp_path('result.json', data_d)),
260+ 'unexpected result.json found')
261+ self.assertFalse(
262+ os.path.exists(self.tmp_path('result.json', link_d)),
263+ 'unexpected result.json link found')
264+
265 def test_no_arguments_shows_usage(self):
266 exit_code = self._call_main()
267 self.assertIn('usage: cloud-init', self.stderr.getvalue())

Subscribers

People subscribed via source and target branches