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

Proposed by Chad Smith
Status: Merged
Merged at revision: 676a55166bab940cd1e8dfe69f8ebe187c186bdc
Proposed branch: ~chad.smith/cloud-init:ubuntu/devel
Merge into: cloud-init:ubuntu/devel
Diff against target: 396 lines (+99/-52)
14 files modified
cloudinit/config/cc_resizefs.py (+2/-0)
cloudinit/config/cc_users_groups.py (+14/-14)
cloudinit/util.py (+9/-1)
debian/changelog (+12/-0)
doc/examples/cloud-config-user-groups.txt (+12/-12)
doc/rtd/topics/datasources/openstack.rst (+2/-2)
integration-requirements.txt (+2/-2)
tests/cloud_tests/platforms/lxd/instance.py (+1/-1)
tests/cloud_tests/testcases/examples/including_user_groups.yaml (+1/-1)
tests/cloud_tests/testcases/modules/user_groups.yaml (+1/-1)
tests/data/merge_sources/expected7.yaml (+8/-8)
tests/data/merge_sources/source7-1.yaml (+5/-5)
tests/data/merge_sources/source7-2.yaml (+3/-3)
tests/unittests/test_util.py (+27/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Ryan Harper Pending
Review via email: mp+342605@code.launchpad.net

Description of the change

Sync upstream cloud-init master into ubuntu/devel for Bionic release

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:2d4456987ada86bcd685e8b88f345b1e379e31cb
https://jenkins.ubuntu.com/server/job/cloud-init-ci/969/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    FAILED: Ubuntu LTS: Integration

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Looks good:

% git diff raharper/ubuntu/devel/newupstream-20180403 chad.smith-cloudinit/ubuntu/devel
diff --git a/debian/changelog b/debian/changelog
index 728fb86..a862267 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,7 +7,7 @@ cloud-init (18.2-3-gb27f713a-0ubuntu1) bionic; urgency=medium
     - doc: Fix links in OpenStack datasource documentation.
       [Dominic Schlegel] (LP: #1721660)

- -- Ryan Harper <email address hidden> Tue, 03 Apr 2018 15:43:44 -0500
+ -- Chad Smith <email address hidden> Tue, 03 Apr 2018 14:21:37 -0600

 cloud-init (18.2-0ubuntu1) bionic; urgency=medium

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:676a55166bab940cd1e8dfe69f8ebe187c186bdc
https://jenkins.ubuntu.com/server/job/cloud-init-ci/972/
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/972/rebuild

review: Approve (continuous-integration)
Revision history for this message
Chad Smith (chad.smith) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=b9ebf643

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
2index c8e1752..013e69b 100644
3--- a/cloudinit/config/cc_resizefs.py
4+++ b/cloudinit/config/cc_resizefs.py
5@@ -251,6 +251,8 @@ def handle(name, cfg, _cloud, log, args):
6 if fs_type == 'zfs':
7 zpool = devpth.split('/')[0]
8 devpth = util.get_device_info_from_zpool(zpool)
9+ if not devpth:
10+ return # could not find device from zpool
11 resize_what = zpool
12
13 info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what)
14diff --git a/cloudinit/config/cc_users_groups.py b/cloudinit/config/cc_users_groups.py
15index f363000..b215e95 100644
16--- a/cloudinit/config/cc_users_groups.py
17+++ b/cloudinit/config/cc_users_groups.py
18@@ -34,16 +34,16 @@ config keys for an entry in ``users`` are as follows:
19 - ``homedir``: Optional. Home dir for user. Default is ``/home/<username>``
20 - ``inactive``: Optional. Mark user inactive. Default: false
21 - ``lock_passwd``: Optional. Disable password login. Default: true
22- - ``no-create-home``: Optional. Do not create home directory. Default:
23+ - ``no_create_home``: Optional. Do not create home directory. Default:
24 false
25- - ``no-log-init``: Optional. Do not initialize lastlog and faillog for
26+ - ``no_log_init``: Optional. Do not initialize lastlog and faillog for
27 user. Default: false
28- - ``no-user-group``: Optional. Do not create group named after user.
29+ - ``no_user_group``: Optional. Do not create group named after user.
30 Default: false
31 - ``passwd``: Hash of user password
32- - ``primary-group``: Optional. Primary group for user. Default to new group
33+ - ``primary_group``: Optional. Primary group for user. Default to new group
34 named after user.
35- - ``selinux-user``: Optional. SELinux user for user's login. Default to
36+ - ``selinux_user``: Optional. SELinux user for user's login. Default to
37 default SELinux user.
38 - ``shell``: Optional. The user's login shell. The default is to set no
39 shell, which results in a system-specific default being used.
40@@ -51,9 +51,9 @@ config keys for an entry in ``users`` are as follows:
41 a Snappy user through ``snap create-user``. If an Ubuntu SSO account is
42 associated with the address, username and SSH keys will be requested from
43 there. Default: none
44- - ``ssh-authorized-keys``: Optional. List of ssh keys to add to user's
45+ - ``ssh_authorized_keys``: Optional. List of ssh keys to add to user's
46 authkeys file. Default: none
47- - ``ssh-import-id``: Optional. SSH id to import for user. Default: none
48+ - ``ssh_import_id``: Optional. SSH id to import for user. Default: none
49 - ``sudo``: Optional. Sudo rule to use, or list of sudo rules to use.
50 Default: none.
51 - ``system``: Optional. Create user as system user with no home directory.
52@@ -89,18 +89,18 @@ config keys for an entry in ``users`` are as follows:
53 homedir: <home directory>
54 inactive: <true/false>
55 lock_passwd: <true/false>
56- no-create-home: <true/false>
57- no-log-init: <true/false>
58- no-user-group: <true/false>
59+ no_create_home: <true/false>
60+ no_log_init: <true/false>
61+ no_user_group: <true/false>
62 passwd: <password>
63- primary-group: <primary group>
64- selinux-user: <selinux username>
65+ primary_group: <primary group>
66+ selinux_user: <selinux username>
67 shell: <shell path>
68 snapuser: <email>
69- ssh-authorized-keys:
70+ ssh_authorized_keys:
71 - <key>
72 - <key>
73- ssh-import-id: <id>
74+ ssh_import_id: <id>
75 sudo: <sudo config>
76 system: <true/false>
77 uid: <user id>
78diff --git a/cloudinit/util.py b/cloudinit/util.py
79index 0ab2c48..acdc0d8 100644
80--- a/cloudinit/util.py
81+++ b/cloudinit/util.py
82@@ -2249,7 +2249,15 @@ def get_mount_info_freebsd(path):
83
84
85 def get_device_info_from_zpool(zpool):
86- (zpoolstatus, err) = subp(['zpool', 'status', zpool])
87+ # zpool has 10 second timeout waiting for /dev/zfs LP: #1760173
88+ if not os.path.exists('/dev/zfs'):
89+ LOG.debug('Cannot get zpool info, no /dev/zfs')
90+ return None
91+ try:
92+ (zpoolstatus, err) = subp(['zpool', 'status', zpool])
93+ except ProcessExecutionError as err:
94+ LOG.warning("Unable to get zpool status of %s: %s", zpool, err)
95+ return None
96 if len(err):
97 return None
98 r = r'.*(ONLINE).*'
99diff --git a/debian/changelog b/debian/changelog
100index cdfbf6a..091d59e 100644
101--- a/debian/changelog
102+++ b/debian/changelog
103@@ -1,3 +1,15 @@
104+cloud-init (18.2-4-g05926e48-0ubuntu1) bionic; urgency=medium
105+
106+ * New upstream snapshot.
107+ - tests: fix integration tests to support lxd 3.0 release
108+ - correct documentation to match correct attribute name usage.
109+ [Dominic Schlegel] (LP: #1420018)
110+ - cc_resizefs, util: handle no /dev/zfs
111+ - doc: Fix links in OpenStack datasource documentation.
112+ [Dominic Schlegel] (LP: #1721660)
113+
114+ -- Chad Smith <chad.smith@canonical.com> Tue, 03 Apr 2018 16:54:45 -0600
115+
116 cloud-init (18.2-0ubuntu1) bionic; urgency=medium
117
118 * debian/control: Add missing dependency on isc-dhcp-client (LP: #1759307).
119diff --git a/doc/examples/cloud-config-user-groups.txt b/doc/examples/cloud-config-user-groups.txt
120index 0554d1f..7bca24a 100644
121--- a/doc/examples/cloud-config-user-groups.txt
122+++ b/doc/examples/cloud-config-user-groups.txt
123@@ -10,20 +10,20 @@ users:
124 - default
125 - name: foobar
126 gecos: Foo B. Bar
127- primary-group: foobar
128+ primary_group: foobar
129 groups: users
130- selinux-user: staff_u
131+ selinux_user: staff_u
132 expiredate: 2012-09-01
133- ssh-import-id: foobar
134+ ssh_import_id: foobar
135 lock_passwd: false
136 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
137 - name: barfoo
138 gecos: Bar B. Foo
139 sudo: ALL=(ALL) NOPASSWD:ALL
140 groups: users, admin
141- ssh-import-id: None
142+ ssh_import_id: None
143 lock_passwd: true
144- ssh-authorized-keys:
145+ ssh_authorized_keys:
146 - <ssh pub key 1>
147 - <ssh pub key 2>
148 - name: cloudy
149@@ -37,10 +37,10 @@ users:
150 # gecos: The user name's real name, i.e. "Bob B. Smith"
151 # homedir: Optional. Set to the local path you want to use. Defaults to
152 # /home/<username>
153-# primary-group: define the primary group. Defaults to a new group created
154+# primary_group: define the primary group. Defaults to a new group created
155 # named after the user.
156 # groups: Optional. Additional groups to add the user to. Defaults to none
157-# selinux-user: Optional. The SELinux user for the user's login, such as
158+# selinux_user: Optional. The SELinux user for the user's login, such as
159 # "staff_u". When this is omitted the system will select the default
160 # SELinux user.
161 # lock_passwd: Defaults to true. Lock the password to disable password login
162@@ -66,11 +66,11 @@ users:
163 # should use SSH authentication only.
164 #
165 # You have thus been warned.
166-# no-create-home: When set to true, do not create home directory.
167-# no-user-group: When set to true, do not create a group named after the user.
168-# no-log-init: When set to true, do not initialize lastlog and faillog database.
169-# ssh-import-id: Optional. Import SSH ids
170-# ssh-authorized-keys: Optional. [list] Add keys to user's authorized keys file
171+# no_create_home: When set to true, do not create home directory.
172+# no_user_group: When set to true, do not create a group named after the user.
173+# no_log_init: When set to true, do not initialize lastlog and faillog database.
174+# ssh_import_id: Optional. Import SSH ids
175+# ssh_authorized_keys: Optional. [list] Add keys to user's authorized keys file
176 # sudo: Defaults to none. Set to the sudo string you want to use, i.e.
177 # ALL=(ALL) NOPASSWD:ALL. To add multiple rules, use the following
178 # format.
179diff --git a/doc/rtd/topics/datasources/openstack.rst b/doc/rtd/topics/datasources/openstack.rst
180index 607b70f..43592de 100644
181--- a/doc/rtd/topics/datasources/openstack.rst
182+++ b/doc/rtd/topics/datasources/openstack.rst
183@@ -5,7 +5,7 @@ OpenStack
184
185 This datasource supports reading data from the
186 `OpenStack Metadata Service
187-<http://docs.openstack.org/admin-guide/compute-networking-nova.html#metadata-service>`_.
188+<https://docs.openstack.org/nova/latest/admin/networking-nova.html#metadata-service>`_.
189
190 Configuration
191 -------------
192@@ -59,6 +59,6 @@ upgrade packages and install ``htop`` on all instances:
193 {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}
194
195 For more general information about how cloud-init handles vendor data,
196-including how it can be disabled by users on instances, see `Vendor Data`_.
197+including how it can be disabled by users on instances, see :doc:`/topics/vendordata`.
198
199 .. vi: textwidth=78
200diff --git a/integration-requirements.txt b/integration-requirements.txt
201index 45baac6..df3a73e 100644
202--- a/integration-requirements.txt
203+++ b/integration-requirements.txt
204@@ -12,8 +12,8 @@ boto3==1.5.9
205 paramiko==2.4.0
206
207 # lxd backend
208-# 01/10/2018: enables use of lxd as snap support
209-git+https://github.com/lxc/pylxd.git@0722955260a6557e6d2ffde1896bfe0707bbca27
210+# 04/03/2018: enables use of lxd 3.0
211+git+https://github.com/lxc/pylxd.git@1a85a12a23401de6e96b1aeaf59ecbff2e88f49d
212
213
214 # finds latest image information
215diff --git a/tests/cloud_tests/platforms/lxd/instance.py b/tests/cloud_tests/platforms/lxd/instance.py
216index 0488da5..0d957bc 100644
217--- a/tests/cloud_tests/platforms/lxd/instance.py
218+++ b/tests/cloud_tests/platforms/lxd/instance.py
219@@ -210,7 +210,7 @@ def _has_proper_console_support():
220 reason = "LXD server does not support console api extension"
221 else:
222 dver = info.get('environment', {}).get('driver_version', "")
223- if dver.startswith("2.") or dver.startwith("1."):
224+ if dver.startswith("2.") or dver.startswith("1."):
225 reason = "LXD Driver version not 3.x+ (%s)" % dver
226 else:
227 try:
228diff --git a/tests/cloud_tests/testcases/examples/including_user_groups.yaml b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
229index 469d03c..77528d9 100644
230--- a/tests/cloud_tests/testcases/examples/including_user_groups.yaml
231+++ b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
232@@ -16,7 +16,7 @@ cloud_config: |
233 - default
234 - name: foobar
235 gecos: Foo B. Bar
236- primary-group: foobar
237+ primary_group: foobar
238 groups: users
239 expiredate: 2038-01-19
240 lock_passwd: false
241diff --git a/tests/cloud_tests/testcases/modules/user_groups.yaml b/tests/cloud_tests/testcases/modules/user_groups.yaml
242index 22b5d70..675dfb8 100644
243--- a/tests/cloud_tests/testcases/modules/user_groups.yaml
244+++ b/tests/cloud_tests/testcases/modules/user_groups.yaml
245@@ -15,7 +15,7 @@ cloud_config: |
246 - default
247 - name: foobar
248 gecos: Foo B. Bar
249- primary-group: foobar
250+ primary_group: foobar
251 groups: users
252 expiredate: 2038-01-19
253 lock_passwd: false
254diff --git a/tests/data/merge_sources/expected7.yaml b/tests/data/merge_sources/expected7.yaml
255index 25284f0..d32988e 100644
256--- a/tests/data/merge_sources/expected7.yaml
257+++ b/tests/data/merge_sources/expected7.yaml
258@@ -4,20 +4,20 @@ users:
259 - default
260 - name: foobar
261 gecos: Foo B. Bar
262- primary-group: foobar
263+ primary_group: foobar
264 groups: users
265- selinux-user: staff_u
266+ selinux_user: staff_u
267 expiredate: 2012-09-01
268- ssh-import-id: foobar
269+ ssh_import_id: foobar
270 lock-passwd: false
271 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
272 - name: barfoo
273 gecos: Bar B. Foo
274 sudo: ALL=(ALL) NOPASSWD:ALL
275 groups: users, admin
276- ssh-import-id: None
277+ ssh_import_id: None
278 lock-passwd: true
279- ssh-authorized-keys:
280+ ssh_authorized_keys:
281 - <ssh pub key 1>
282 - <ssh pub key 2>
283 - name: cloudy
284@@ -29,10 +29,10 @@ users:
285 - sue
286 - name: foobar_jr
287 gecos: Foo B. Bar Jr
288- primary-group: foobar
289+ primary_group: foobar
290 groups: users
291- selinux-user: staff_u
292+ selinux_user: staff_u
293 expiredate: 2012-09-01
294- ssh-import-id: foobar
295+ ssh_import_id: foobar
296 lock-passwd: false
297 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
298diff --git a/tests/data/merge_sources/source7-1.yaml b/tests/data/merge_sources/source7-1.yaml
299index 8fb9b32..6405fc9 100644
300--- a/tests/data/merge_sources/source7-1.yaml
301+++ b/tests/data/merge_sources/source7-1.yaml
302@@ -4,20 +4,20 @@ users:
303 - default
304 - name: foobar
305 gecos: Foo B. Bar
306- primary-group: foobar
307+ primary_group: foobar
308 groups: users
309- selinux-user: staff_u
310+ selinux_user: staff_u
311 expiredate: 2012-09-01
312- ssh-import-id: foobar
313+ ssh_import_id: foobar
314 lock-passwd: false
315 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
316 - name: barfoo
317 gecos: Bar B. Foo
318 sudo: ALL=(ALL) NOPASSWD:ALL
319 groups: users, admin
320- ssh-import-id: None
321+ ssh_import_id: None
322 lock-passwd: true
323- ssh-authorized-keys:
324+ ssh_authorized_keys:
325 - <ssh pub key 1>
326 - <ssh pub key 2>
327 - name: cloudy
328diff --git a/tests/data/merge_sources/source7-2.yaml b/tests/data/merge_sources/source7-2.yaml
329index 1e26201..0cd2897 100644
330--- a/tests/data/merge_sources/source7-2.yaml
331+++ b/tests/data/merge_sources/source7-2.yaml
332@@ -6,11 +6,11 @@ users:
333 - sue
334 - name: foobar_jr
335 gecos: Foo B. Bar Jr
336- primary-group: foobar
337+ primary_group: foobar
338 groups: users
339- selinux-user: staff_u
340+ selinux_user: staff_u
341 expiredate: 2012-09-01
342- ssh-import-id: foobar
343+ ssh_import_id: foobar
344 lock-passwd: false
345 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
346
347diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
348index 8685b8e..5010190 100644
349--- a/tests/unittests/test_util.py
350+++ b/tests/unittests/test_util.py
351@@ -366,8 +366,11 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
352 expected = ('none', 'tmpfs', '/run/lock')
353 self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
354
355+ @mock.patch('cloudinit.util.os')
356 @mock.patch('cloudinit.util.subp')
357- def test_get_device_info_from_zpool(self, zpool_output):
358+ def test_get_device_info_from_zpool(self, zpool_output, m_os):
359+ # mock /dev/zfs exists
360+ m_os.path.exists.return_value = True
361 # mock subp command from util.get_mount_info_fs_on_zpool
362 zpool_output.return_value = (
363 self.readResource('zpool_status_simple.txt'), ''
364@@ -376,9 +379,31 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
365 ret = util.get_device_info_from_zpool('vmzroot')
366 self.assertEqual('gpt/system', ret)
367 self.assertIsNotNone(ret)
368+ m_os.path.exists.assert_called_with('/dev/zfs')
369
370+ @mock.patch('cloudinit.util.os')
371+ def test_get_device_info_from_zpool_no_dev_zfs(self, m_os):
372+ # mock /dev/zfs missing
373+ m_os.path.exists.return_value = False
374+ # save function return values and do asserts
375+ ret = util.get_device_info_from_zpool('vmzroot')
376+ self.assertIsNone(ret)
377+
378+ @mock.patch('cloudinit.util.os')
379+ @mock.patch('cloudinit.util.subp')
380+ def test_get_device_info_from_zpool_handles_no_zpool(self, m_sub, m_os):
381+ """Handle case where there is no zpool command"""
382+ # mock /dev/zfs exists
383+ m_os.path.exists.return_value = True
384+ m_sub.side_effect = util.ProcessExecutionError("No zpool cmd")
385+ ret = util.get_device_info_from_zpool('vmzroot')
386+ self.assertIsNone(ret)
387+
388+ @mock.patch('cloudinit.util.os')
389 @mock.patch('cloudinit.util.subp')
390- def test_get_device_info_from_zpool_on_error(self, zpool_output):
391+ def test_get_device_info_from_zpool_on_error(self, zpool_output, m_os):
392+ # mock /dev/zfs exists
393+ m_os.path.exists.return_value = True
394 # mock subp command from util.get_mount_info_fs_on_zpool
395 zpool_output.return_value = (
396 self.readResource('zpool_status_simple.txt'), 'error'

Subscribers

People subscribed via source and target branches