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

Proposed by Chad Smith
Status: Merged
Approved by: Chad Smith
Approved revision: 542e97795e0437aa31b34822a1a29b687dd19339
Merged at revision: 542e97795e0437aa31b34822a1a29b687dd19339
Proposed branch: ~chad.smith/cloud-init:ubuntu/artful
Merge into: cloud-init:ubuntu/artful
Diff against target: 398 lines (+96/-55)
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 (+9/-3)
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
Chad Smith Abstain
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email: mp+342608@code.launchpad.net

Commit message

Sync tip of cloud-init master containing zfs fixes for release into Artful.

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:3e258f688a3e01b7bd30b1ad69beefe14abf20ac
https://jenkins.ubuntu.com/server/job/cloud-init-ci/967/
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/967/rebuild

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

Only delta is release/pocket name.

% git diff raharper/ubuntu/artful/sru-20180403-lp1759406 chad.smith-cloudinit/ubuntu/artful
diff --git a/debian/changelog b/debian/changelog
index 08183f7..9d6aaea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-cloud-init (18.2-3-gb27f713a-0ubuntu1~17.10.1) artful; urgency=medium
+cloud-init (18.2-3-gb27f713a-0ubuntu1~17.10.1) artful-proposed; urgency=medium

   * debian/new-upstream-snapshot: Remove script, now maintained elsewhere.
   * New upstream snapshot. (LP: #1759406)
@@ -7,7 +7,7 @@ cloud-init (18.2-3-gb27f713a-0ubuntu1~17.10.1) artful; urgency=medium
     - cc_resizefs, util: handle no /dev/zfs
     - doc: Fix links in OpenStack datasource documentation. [Dominic Schlegel]

- -- Ryan Harper <email address hidden> Tue, 03 Apr 2018 16:12:21 -0500
+ -- Chad Smith <email address hidden> Tue, 03 Apr 2018 14:36:28 -0600

 cloud-init (18.2-0ubuntu1~17.10.1) artful-proposed; urgency=medium

Revision history for this message
Ryan Harper (raharper) wrote :

OK, -proposed should be there.

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

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

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

Thank you for your merge proposal.

Your branch has been set to 'Work in progress'.
Please set the branch back to 'Needs Review' after resolving the issues below.

Thanks again,
Your friendly neighborhood cloud-init robot.

Please fix the following issues:
------------------------------
Commit message lints:
 - Line #0 has 1 too many characters. Line starts with: "Sync tip of cloud-init"...
------------------------------

For more information, see commit message guidelines at
https://cloudinit.readthedocs.io/en/latest/topics/hacking.html#do-these-things-for-each-feature-or-bug

review: Needs Fixing
Revision history for this message
Chad Smith (chad.smith) :
review: Abstain

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 1f929aa..982d0c8 100644
101--- a/debian/changelog
102+++ b/debian/changelog
103@@ -1,8 +1,14 @@
104-cloud-init (18.2-0ubuntu1~17.10.2) UNRELEASED; urgency=medium
105+cloud-init (18.2-4-g05926e48-0ubuntu1~17.10.1) artful-proposed; urgency=medium
106
107 * debian/new-upstream-snapshot: Remove script, now maintained elsewhere.
108-
109- -- Scott Moser <smoser@ubuntu.com> Wed, 28 Mar 2018 16:11:04 -0400
110+ * New upstream snapshot. (LP: #1759406)
111+ - tests: fix integration tests to support lxd 3.0 release
112+ - correct documentation to match correct attribute name usage.
113+ [Dominic Schlegel]
114+ - cc_resizefs, util: handle no /dev/zfs
115+ - doc: Fix links in OpenStack datasource documentation. [Dominic Schlegel]
116+
117+ -- Chad Smith <chad.smith@canonical.com> Tue, 03 Apr 2018 17:00:47 -0600
118
119 cloud-init (18.2-0ubuntu1~17.10.1) artful-proposed; urgency=medium
120
121diff --git a/doc/examples/cloud-config-user-groups.txt b/doc/examples/cloud-config-user-groups.txt
122index 0554d1f..7bca24a 100644
123--- a/doc/examples/cloud-config-user-groups.txt
124+++ b/doc/examples/cloud-config-user-groups.txt
125@@ -10,20 +10,20 @@ users:
126 - default
127 - name: foobar
128 gecos: Foo B. Bar
129- primary-group: foobar
130+ primary_group: foobar
131 groups: users
132- selinux-user: staff_u
133+ selinux_user: staff_u
134 expiredate: 2012-09-01
135- ssh-import-id: foobar
136+ ssh_import_id: foobar
137 lock_passwd: false
138 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
139 - name: barfoo
140 gecos: Bar B. Foo
141 sudo: ALL=(ALL) NOPASSWD:ALL
142 groups: users, admin
143- ssh-import-id: None
144+ ssh_import_id: None
145 lock_passwd: true
146- ssh-authorized-keys:
147+ ssh_authorized_keys:
148 - <ssh pub key 1>
149 - <ssh pub key 2>
150 - name: cloudy
151@@ -37,10 +37,10 @@ users:
152 # gecos: The user name's real name, i.e. "Bob B. Smith"
153 # homedir: Optional. Set to the local path you want to use. Defaults to
154 # /home/<username>
155-# primary-group: define the primary group. Defaults to a new group created
156+# primary_group: define the primary group. Defaults to a new group created
157 # named after the user.
158 # groups: Optional. Additional groups to add the user to. Defaults to none
159-# selinux-user: Optional. The SELinux user for the user's login, such as
160+# selinux_user: Optional. The SELinux user for the user's login, such as
161 # "staff_u". When this is omitted the system will select the default
162 # SELinux user.
163 # lock_passwd: Defaults to true. Lock the password to disable password login
164@@ -66,11 +66,11 @@ users:
165 # should use SSH authentication only.
166 #
167 # You have thus been warned.
168-# no-create-home: When set to true, do not create home directory.
169-# no-user-group: When set to true, do not create a group named after the user.
170-# no-log-init: When set to true, do not initialize lastlog and faillog database.
171-# ssh-import-id: Optional. Import SSH ids
172-# ssh-authorized-keys: Optional. [list] Add keys to user's authorized keys file
173+# no_create_home: When set to true, do not create home directory.
174+# no_user_group: When set to true, do not create a group named after the user.
175+# no_log_init: When set to true, do not initialize lastlog and faillog database.
176+# ssh_import_id: Optional. Import SSH ids
177+# ssh_authorized_keys: Optional. [list] Add keys to user's authorized keys file
178 # sudo: Defaults to none. Set to the sudo string you want to use, i.e.
179 # ALL=(ALL) NOPASSWD:ALL. To add multiple rules, use the following
180 # format.
181diff --git a/doc/rtd/topics/datasources/openstack.rst b/doc/rtd/topics/datasources/openstack.rst
182index 607b70f..43592de 100644
183--- a/doc/rtd/topics/datasources/openstack.rst
184+++ b/doc/rtd/topics/datasources/openstack.rst
185@@ -5,7 +5,7 @@ OpenStack
186
187 This datasource supports reading data from the
188 `OpenStack Metadata Service
189-<http://docs.openstack.org/admin-guide/compute-networking-nova.html#metadata-service>`_.
190+<https://docs.openstack.org/nova/latest/admin/networking-nova.html#metadata-service>`_.
191
192 Configuration
193 -------------
194@@ -59,6 +59,6 @@ upgrade packages and install ``htop`` on all instances:
195 {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}
196
197 For more general information about how cloud-init handles vendor data,
198-including how it can be disabled by users on instances, see `Vendor Data`_.
199+including how it can be disabled by users on instances, see :doc:`/topics/vendordata`.
200
201 .. vi: textwidth=78
202diff --git a/integration-requirements.txt b/integration-requirements.txt
203index 45baac6..df3a73e 100644
204--- a/integration-requirements.txt
205+++ b/integration-requirements.txt
206@@ -12,8 +12,8 @@ boto3==1.5.9
207 paramiko==2.4.0
208
209 # lxd backend
210-# 01/10/2018: enables use of lxd as snap support
211-git+https://github.com/lxc/pylxd.git@0722955260a6557e6d2ffde1896bfe0707bbca27
212+# 04/03/2018: enables use of lxd 3.0
213+git+https://github.com/lxc/pylxd.git@1a85a12a23401de6e96b1aeaf59ecbff2e88f49d
214
215
216 # finds latest image information
217diff --git a/tests/cloud_tests/platforms/lxd/instance.py b/tests/cloud_tests/platforms/lxd/instance.py
218index 0488da5..0d957bc 100644
219--- a/tests/cloud_tests/platforms/lxd/instance.py
220+++ b/tests/cloud_tests/platforms/lxd/instance.py
221@@ -210,7 +210,7 @@ def _has_proper_console_support():
222 reason = "LXD server does not support console api extension"
223 else:
224 dver = info.get('environment', {}).get('driver_version', "")
225- if dver.startswith("2.") or dver.startwith("1."):
226+ if dver.startswith("2.") or dver.startswith("1."):
227 reason = "LXD Driver version not 3.x+ (%s)" % dver
228 else:
229 try:
230diff --git a/tests/cloud_tests/testcases/examples/including_user_groups.yaml b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
231index 469d03c..77528d9 100644
232--- a/tests/cloud_tests/testcases/examples/including_user_groups.yaml
233+++ b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
234@@ -16,7 +16,7 @@ cloud_config: |
235 - default
236 - name: foobar
237 gecos: Foo B. Bar
238- primary-group: foobar
239+ primary_group: foobar
240 groups: users
241 expiredate: 2038-01-19
242 lock_passwd: false
243diff --git a/tests/cloud_tests/testcases/modules/user_groups.yaml b/tests/cloud_tests/testcases/modules/user_groups.yaml
244index 22b5d70..675dfb8 100644
245--- a/tests/cloud_tests/testcases/modules/user_groups.yaml
246+++ b/tests/cloud_tests/testcases/modules/user_groups.yaml
247@@ -15,7 +15,7 @@ cloud_config: |
248 - default
249 - name: foobar
250 gecos: Foo B. Bar
251- primary-group: foobar
252+ primary_group: foobar
253 groups: users
254 expiredate: 2038-01-19
255 lock_passwd: false
256diff --git a/tests/data/merge_sources/expected7.yaml b/tests/data/merge_sources/expected7.yaml
257index 25284f0..d32988e 100644
258--- a/tests/data/merge_sources/expected7.yaml
259+++ b/tests/data/merge_sources/expected7.yaml
260@@ -4,20 +4,20 @@ users:
261 - default
262 - name: foobar
263 gecos: Foo B. Bar
264- primary-group: foobar
265+ primary_group: foobar
266 groups: users
267- selinux-user: staff_u
268+ selinux_user: staff_u
269 expiredate: 2012-09-01
270- ssh-import-id: foobar
271+ ssh_import_id: foobar
272 lock-passwd: false
273 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
274 - name: barfoo
275 gecos: Bar B. Foo
276 sudo: ALL=(ALL) NOPASSWD:ALL
277 groups: users, admin
278- ssh-import-id: None
279+ ssh_import_id: None
280 lock-passwd: true
281- ssh-authorized-keys:
282+ ssh_authorized_keys:
283 - <ssh pub key 1>
284 - <ssh pub key 2>
285 - name: cloudy
286@@ -29,10 +29,10 @@ users:
287 - sue
288 - name: foobar_jr
289 gecos: Foo B. Bar Jr
290- primary-group: foobar
291+ primary_group: foobar
292 groups: users
293- selinux-user: staff_u
294+ selinux_user: staff_u
295 expiredate: 2012-09-01
296- ssh-import-id: foobar
297+ ssh_import_id: foobar
298 lock-passwd: false
299 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
300diff --git a/tests/data/merge_sources/source7-1.yaml b/tests/data/merge_sources/source7-1.yaml
301index 8fb9b32..6405fc9 100644
302--- a/tests/data/merge_sources/source7-1.yaml
303+++ b/tests/data/merge_sources/source7-1.yaml
304@@ -4,20 +4,20 @@ users:
305 - default
306 - name: foobar
307 gecos: Foo B. Bar
308- primary-group: foobar
309+ primary_group: foobar
310 groups: users
311- selinux-user: staff_u
312+ selinux_user: staff_u
313 expiredate: 2012-09-01
314- ssh-import-id: foobar
315+ ssh_import_id: foobar
316 lock-passwd: false
317 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
318 - name: barfoo
319 gecos: Bar B. Foo
320 sudo: ALL=(ALL) NOPASSWD:ALL
321 groups: users, admin
322- ssh-import-id: None
323+ ssh_import_id: None
324 lock-passwd: true
325- ssh-authorized-keys:
326+ ssh_authorized_keys:
327 - <ssh pub key 1>
328 - <ssh pub key 2>
329 - name: cloudy
330diff --git a/tests/data/merge_sources/source7-2.yaml b/tests/data/merge_sources/source7-2.yaml
331index 1e26201..0cd2897 100644
332--- a/tests/data/merge_sources/source7-2.yaml
333+++ b/tests/data/merge_sources/source7-2.yaml
334@@ -6,11 +6,11 @@ users:
335 - sue
336 - name: foobar_jr
337 gecos: Foo B. Bar Jr
338- primary-group: foobar
339+ primary_group: foobar
340 groups: users
341- selinux-user: staff_u
342+ selinux_user: staff_u
343 expiredate: 2012-09-01
344- ssh-import-id: foobar
345+ ssh_import_id: foobar
346 lock-passwd: false
347 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
348
349diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
350index 8685b8e..5010190 100644
351--- a/tests/unittests/test_util.py
352+++ b/tests/unittests/test_util.py
353@@ -366,8 +366,11 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
354 expected = ('none', 'tmpfs', '/run/lock')
355 self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
356
357+ @mock.patch('cloudinit.util.os')
358 @mock.patch('cloudinit.util.subp')
359- def test_get_device_info_from_zpool(self, zpool_output):
360+ def test_get_device_info_from_zpool(self, zpool_output, m_os):
361+ # mock /dev/zfs exists
362+ m_os.path.exists.return_value = True
363 # mock subp command from util.get_mount_info_fs_on_zpool
364 zpool_output.return_value = (
365 self.readResource('zpool_status_simple.txt'), ''
366@@ -376,9 +379,31 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
367 ret = util.get_device_info_from_zpool('vmzroot')
368 self.assertEqual('gpt/system', ret)
369 self.assertIsNotNone(ret)
370+ m_os.path.exists.assert_called_with('/dev/zfs')
371
372+ @mock.patch('cloudinit.util.os')
373+ def test_get_device_info_from_zpool_no_dev_zfs(self, m_os):
374+ # mock /dev/zfs missing
375+ m_os.path.exists.return_value = False
376+ # save function return values and do asserts
377+ ret = util.get_device_info_from_zpool('vmzroot')
378+ self.assertIsNone(ret)
379+
380+ @mock.patch('cloudinit.util.os')
381+ @mock.patch('cloudinit.util.subp')
382+ def test_get_device_info_from_zpool_handles_no_zpool(self, m_sub, m_os):
383+ """Handle case where there is no zpool command"""
384+ # mock /dev/zfs exists
385+ m_os.path.exists.return_value = True
386+ m_sub.side_effect = util.ProcessExecutionError("No zpool cmd")
387+ ret = util.get_device_info_from_zpool('vmzroot')
388+ self.assertIsNone(ret)
389+
390+ @mock.patch('cloudinit.util.os')
391 @mock.patch('cloudinit.util.subp')
392- def test_get_device_info_from_zpool_on_error(self, zpool_output):
393+ def test_get_device_info_from_zpool_on_error(self, zpool_output, m_os):
394+ # mock /dev/zfs exists
395+ m_os.path.exists.return_value = True
396 # mock subp command from util.get_mount_info_fs_on_zpool
397 zpool_output.return_value = (
398 self.readResource('zpool_status_simple.txt'), 'error'

Subscribers

People subscribed via source and target branches