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
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index c8e1752..013e69b 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -251,6 +251,8 @@ def handle(name, cfg, _cloud, log, args):
251 if fs_type == 'zfs':251 if fs_type == 'zfs':
252 zpool = devpth.split('/')[0]252 zpool = devpth.split('/')[0]
253 devpth = util.get_device_info_from_zpool(zpool)253 devpth = util.get_device_info_from_zpool(zpool)
254 if not devpth:
255 return # could not find device from zpool
254 resize_what = zpool256 resize_what = zpool
255257
256 info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what)258 info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what)
diff --git a/cloudinit/config/cc_users_groups.py b/cloudinit/config/cc_users_groups.py
index f363000..b215e95 100644
--- a/cloudinit/config/cc_users_groups.py
+++ b/cloudinit/config/cc_users_groups.py
@@ -34,16 +34,16 @@ config keys for an entry in ``users`` are as follows:
34 - ``homedir``: Optional. Home dir for user. Default is ``/home/<username>``34 - ``homedir``: Optional. Home dir for user. Default is ``/home/<username>``
35 - ``inactive``: Optional. Mark user inactive. Default: false35 - ``inactive``: Optional. Mark user inactive. Default: false
36 - ``lock_passwd``: Optional. Disable password login. Default: true36 - ``lock_passwd``: Optional. Disable password login. Default: true
37 - ``no-create-home``: Optional. Do not create home directory. Default:37 - ``no_create_home``: Optional. Do not create home directory. Default:
38 false38 false
39 - ``no-log-init``: Optional. Do not initialize lastlog and faillog for39 - ``no_log_init``: Optional. Do not initialize lastlog and faillog for
40 user. Default: false40 user. Default: false
41 - ``no-user-group``: Optional. Do not create group named after user.41 - ``no_user_group``: Optional. Do not create group named after user.
42 Default: false42 Default: false
43 - ``passwd``: Hash of user password43 - ``passwd``: Hash of user password
44 - ``primary-group``: Optional. Primary group for user. Default to new group44 - ``primary_group``: Optional. Primary group for user. Default to new group
45 named after user.45 named after user.
46 - ``selinux-user``: Optional. SELinux user for user's login. Default to46 - ``selinux_user``: Optional. SELinux user for user's login. Default to
47 default SELinux user.47 default SELinux user.
48 - ``shell``: Optional. The user's login shell. The default is to set no48 - ``shell``: Optional. The user's login shell. The default is to set no
49 shell, which results in a system-specific default being used.49 shell, which results in a system-specific default being used.
@@ -51,9 +51,9 @@ config keys for an entry in ``users`` are as follows:
51 a Snappy user through ``snap create-user``. If an Ubuntu SSO account is51 a Snappy user through ``snap create-user``. If an Ubuntu SSO account is
52 associated with the address, username and SSH keys will be requested from52 associated with the address, username and SSH keys will be requested from
53 there. Default: none53 there. Default: none
54 - ``ssh-authorized-keys``: Optional. List of ssh keys to add to user's54 - ``ssh_authorized_keys``: Optional. List of ssh keys to add to user's
55 authkeys file. Default: none55 authkeys file. Default: none
56 - ``ssh-import-id``: Optional. SSH id to import for user. Default: none56 - ``ssh_import_id``: Optional. SSH id to import for user. Default: none
57 - ``sudo``: Optional. Sudo rule to use, or list of sudo rules to use.57 - ``sudo``: Optional. Sudo rule to use, or list of sudo rules to use.
58 Default: none.58 Default: none.
59 - ``system``: Optional. Create user as system user with no home directory.59 - ``system``: Optional. Create user as system user with no home directory.
@@ -89,18 +89,18 @@ config keys for an entry in ``users`` are as follows:
89 homedir: <home directory>89 homedir: <home directory>
90 inactive: <true/false>90 inactive: <true/false>
91 lock_passwd: <true/false>91 lock_passwd: <true/false>
92 no-create-home: <true/false>92 no_create_home: <true/false>
93 no-log-init: <true/false>93 no_log_init: <true/false>
94 no-user-group: <true/false>94 no_user_group: <true/false>
95 passwd: <password>95 passwd: <password>
96 primary-group: <primary group>96 primary_group: <primary group>
97 selinux-user: <selinux username>97 selinux_user: <selinux username>
98 shell: <shell path>98 shell: <shell path>
99 snapuser: <email>99 snapuser: <email>
100 ssh-authorized-keys:100 ssh_authorized_keys:
101 - <key>101 - <key>
102 - <key>102 - <key>
103 ssh-import-id: <id>103 ssh_import_id: <id>
104 sudo: <sudo config>104 sudo: <sudo config>
105 system: <true/false>105 system: <true/false>
106 uid: <user id>106 uid: <user id>
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 0ab2c48..acdc0d8 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2249,7 +2249,15 @@ def get_mount_info_freebsd(path):
22492249
22502250
2251def get_device_info_from_zpool(zpool):2251def get_device_info_from_zpool(zpool):
2252 (zpoolstatus, err) = subp(['zpool', 'status', zpool])2252 # zpool has 10 second timeout waiting for /dev/zfs LP: #1760173
2253 if not os.path.exists('/dev/zfs'):
2254 LOG.debug('Cannot get zpool info, no /dev/zfs')
2255 return None
2256 try:
2257 (zpoolstatus, err) = subp(['zpool', 'status', zpool])
2258 except ProcessExecutionError as err:
2259 LOG.warning("Unable to get zpool status of %s: %s", zpool, err)
2260 return None
2253 if len(err):2261 if len(err):
2254 return None2262 return None
2255 r = r'.*(ONLINE).*'2263 r = r'.*(ONLINE).*'
diff --git a/debian/changelog b/debian/changelog
index 1f929aa..982d0c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
1cloud-init (18.2-0ubuntu1~17.10.2) UNRELEASED; urgency=medium1cloud-init (18.2-4-g05926e48-0ubuntu1~17.10.1) artful-proposed; urgency=medium
22
3 * debian/new-upstream-snapshot: Remove script, now maintained elsewhere.3 * debian/new-upstream-snapshot: Remove script, now maintained elsewhere.
44 * New upstream snapshot. (LP: #1759406)
5 -- Scott Moser <smoser@ubuntu.com> Wed, 28 Mar 2018 16:11:04 -04005 - tests: fix integration tests to support lxd 3.0 release
6 - correct documentation to match correct attribute name usage.
7 [Dominic Schlegel]
8 - cc_resizefs, util: handle no /dev/zfs
9 - doc: Fix links in OpenStack datasource documentation. [Dominic Schlegel]
10
11 -- Chad Smith <chad.smith@canonical.com> Tue, 03 Apr 2018 17:00:47 -0600
612
7cloud-init (18.2-0ubuntu1~17.10.1) artful-proposed; urgency=medium13cloud-init (18.2-0ubuntu1~17.10.1) artful-proposed; urgency=medium
814
diff --git a/doc/examples/cloud-config-user-groups.txt b/doc/examples/cloud-config-user-groups.txt
index 0554d1f..7bca24a 100644
--- a/doc/examples/cloud-config-user-groups.txt
+++ b/doc/examples/cloud-config-user-groups.txt
@@ -10,20 +10,20 @@ users:
10 - default10 - default
11 - name: foobar11 - name: foobar
12 gecos: Foo B. Bar12 gecos: Foo B. Bar
13 primary-group: foobar13 primary_group: foobar
14 groups: users14 groups: users
15 selinux-user: staff_u15 selinux_user: staff_u
16 expiredate: 2012-09-0116 expiredate: 2012-09-01
17 ssh-import-id: foobar17 ssh_import_id: foobar
18 lock_passwd: false18 lock_passwd: false
19 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/19 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
20 - name: barfoo20 - name: barfoo
21 gecos: Bar B. Foo21 gecos: Bar B. Foo
22 sudo: ALL=(ALL) NOPASSWD:ALL22 sudo: ALL=(ALL) NOPASSWD:ALL
23 groups: users, admin23 groups: users, admin
24 ssh-import-id: None24 ssh_import_id: None
25 lock_passwd: true25 lock_passwd: true
26 ssh-authorized-keys:26 ssh_authorized_keys:
27 - <ssh pub key 1>27 - <ssh pub key 1>
28 - <ssh pub key 2>28 - <ssh pub key 2>
29 - name: cloudy29 - name: cloudy
@@ -37,10 +37,10 @@ users:
37# gecos: The user name's real name, i.e. "Bob B. Smith"37# gecos: The user name's real name, i.e. "Bob B. Smith"
38# homedir: Optional. Set to the local path you want to use. Defaults to38# homedir: Optional. Set to the local path you want to use. Defaults to
39# /home/<username>39# /home/<username>
40# primary-group: define the primary group. Defaults to a new group created40# primary_group: define the primary group. Defaults to a new group created
41# named after the user.41# named after the user.
42# groups: Optional. Additional groups to add the user to. Defaults to none42# groups: Optional. Additional groups to add the user to. Defaults to none
43# selinux-user: Optional. The SELinux user for the user's login, such as43# selinux_user: Optional. The SELinux user for the user's login, such as
44# "staff_u". When this is omitted the system will select the default44# "staff_u". When this is omitted the system will select the default
45# SELinux user.45# SELinux user.
46# lock_passwd: Defaults to true. Lock the password to disable password login46# lock_passwd: Defaults to true. Lock the password to disable password login
@@ -66,11 +66,11 @@ users:
66# should use SSH authentication only.66# should use SSH authentication only.
67#67#
68# You have thus been warned.68# You have thus been warned.
69# no-create-home: When set to true, do not create home directory.69# no_create_home: When set to true, do not create home directory.
70# no-user-group: When set to true, do not create a group named after the user.70# no_user_group: When set to true, do not create a group named after the user.
71# no-log-init: When set to true, do not initialize lastlog and faillog database.71# no_log_init: When set to true, do not initialize lastlog and faillog database.
72# ssh-import-id: Optional. Import SSH ids72# ssh_import_id: Optional. Import SSH ids
73# ssh-authorized-keys: Optional. [list] Add keys to user's authorized keys file73# ssh_authorized_keys: Optional. [list] Add keys to user's authorized keys file
74# sudo: Defaults to none. Set to the sudo string you want to use, i.e.74# sudo: Defaults to none. Set to the sudo string you want to use, i.e.
75# ALL=(ALL) NOPASSWD:ALL. To add multiple rules, use the following75# ALL=(ALL) NOPASSWD:ALL. To add multiple rules, use the following
76# format.76# format.
diff --git a/doc/rtd/topics/datasources/openstack.rst b/doc/rtd/topics/datasources/openstack.rst
index 607b70f..43592de 100644
--- a/doc/rtd/topics/datasources/openstack.rst
+++ b/doc/rtd/topics/datasources/openstack.rst
@@ -5,7 +5,7 @@ OpenStack
55
6This datasource supports reading data from the6This datasource supports reading data from the
7`OpenStack Metadata Service7`OpenStack Metadata Service
8<http://docs.openstack.org/admin-guide/compute-networking-nova.html#metadata-service>`_.8<https://docs.openstack.org/nova/latest/admin/networking-nova.html#metadata-service>`_.
99
10Configuration10Configuration
11-------------11-------------
@@ -59,6 +59,6 @@ upgrade packages and install ``htop`` on all instances:
59 {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}59 {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}
6060
61For more general information about how cloud-init handles vendor data,61For more general information about how cloud-init handles vendor data,
62including how it can be disabled by users on instances, see `Vendor Data`_.62including how it can be disabled by users on instances, see :doc:`/topics/vendordata`.
6363
64.. vi: textwidth=7864.. vi: textwidth=78
diff --git a/integration-requirements.txt b/integration-requirements.txt
index 45baac6..df3a73e 100644
--- a/integration-requirements.txt
+++ b/integration-requirements.txt
@@ -12,8 +12,8 @@ boto3==1.5.9
12paramiko==2.4.012paramiko==2.4.0
1313
14# lxd backend14# lxd backend
15# 01/10/2018: enables use of lxd as snap support15# 04/03/2018: enables use of lxd 3.0
16git+https://github.com/lxc/pylxd.git@0722955260a6557e6d2ffde1896bfe0707bbca2716git+https://github.com/lxc/pylxd.git@1a85a12a23401de6e96b1aeaf59ecbff2e88f49d
1717
1818
19# finds latest image information19# finds latest image information
diff --git a/tests/cloud_tests/platforms/lxd/instance.py b/tests/cloud_tests/platforms/lxd/instance.py
index 0488da5..0d957bc 100644
--- a/tests/cloud_tests/platforms/lxd/instance.py
+++ b/tests/cloud_tests/platforms/lxd/instance.py
@@ -210,7 +210,7 @@ def _has_proper_console_support():
210 reason = "LXD server does not support console api extension"210 reason = "LXD server does not support console api extension"
211 else:211 else:
212 dver = info.get('environment', {}).get('driver_version', "")212 dver = info.get('environment', {}).get('driver_version', "")
213 if dver.startswith("2.") or dver.startwith("1."):213 if dver.startswith("2.") or dver.startswith("1."):
214 reason = "LXD Driver version not 3.x+ (%s)" % dver214 reason = "LXD Driver version not 3.x+ (%s)" % dver
215 else:215 else:
216 try:216 try:
diff --git a/tests/cloud_tests/testcases/examples/including_user_groups.yaml b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
index 469d03c..77528d9 100644
--- a/tests/cloud_tests/testcases/examples/including_user_groups.yaml
+++ b/tests/cloud_tests/testcases/examples/including_user_groups.yaml
@@ -16,7 +16,7 @@ cloud_config: |
16 - default16 - default
17 - name: foobar17 - name: foobar
18 gecos: Foo B. Bar18 gecos: Foo B. Bar
19 primary-group: foobar19 primary_group: foobar
20 groups: users20 groups: users
21 expiredate: 2038-01-1921 expiredate: 2038-01-19
22 lock_passwd: false22 lock_passwd: false
diff --git a/tests/cloud_tests/testcases/modules/user_groups.yaml b/tests/cloud_tests/testcases/modules/user_groups.yaml
index 22b5d70..675dfb8 100644
--- a/tests/cloud_tests/testcases/modules/user_groups.yaml
+++ b/tests/cloud_tests/testcases/modules/user_groups.yaml
@@ -15,7 +15,7 @@ cloud_config: |
15 - default15 - default
16 - name: foobar16 - name: foobar
17 gecos: Foo B. Bar17 gecos: Foo B. Bar
18 primary-group: foobar18 primary_group: foobar
19 groups: users19 groups: users
20 expiredate: 2038-01-1920 expiredate: 2038-01-19
21 lock_passwd: false21 lock_passwd: false
diff --git a/tests/data/merge_sources/expected7.yaml b/tests/data/merge_sources/expected7.yaml
index 25284f0..d32988e 100644
--- a/tests/data/merge_sources/expected7.yaml
+++ b/tests/data/merge_sources/expected7.yaml
@@ -4,20 +4,20 @@ users:
4 - default4 - default
5 - name: foobar5 - name: foobar
6 gecos: Foo B. Bar6 gecos: Foo B. Bar
7 primary-group: foobar7 primary_group: foobar
8 groups: users8 groups: users
9 selinux-user: staff_u9 selinux_user: staff_u
10 expiredate: 2012-09-0110 expiredate: 2012-09-01
11 ssh-import-id: foobar11 ssh_import_id: foobar
12 lock-passwd: false12 lock-passwd: false
13 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/13 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
14 - name: barfoo14 - name: barfoo
15 gecos: Bar B. Foo15 gecos: Bar B. Foo
16 sudo: ALL=(ALL) NOPASSWD:ALL16 sudo: ALL=(ALL) NOPASSWD:ALL
17 groups: users, admin17 groups: users, admin
18 ssh-import-id: None18 ssh_import_id: None
19 lock-passwd: true19 lock-passwd: true
20 ssh-authorized-keys:20 ssh_authorized_keys:
21 - <ssh pub key 1>21 - <ssh pub key 1>
22 - <ssh pub key 2>22 - <ssh pub key 2>
23 - name: cloudy23 - name: cloudy
@@ -29,10 +29,10 @@ users:
29 - sue29 - sue
30 - name: foobar_jr30 - name: foobar_jr
31 gecos: Foo B. Bar Jr31 gecos: Foo B. Bar Jr
32 primary-group: foobar32 primary_group: foobar
33 groups: users33 groups: users
34 selinux-user: staff_u34 selinux_user: staff_u
35 expiredate: 2012-09-0135 expiredate: 2012-09-01
36 ssh-import-id: foobar36 ssh_import_id: foobar
37 lock-passwd: false37 lock-passwd: false
38 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/38 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
diff --git a/tests/data/merge_sources/source7-1.yaml b/tests/data/merge_sources/source7-1.yaml
index 8fb9b32..6405fc9 100644
--- a/tests/data/merge_sources/source7-1.yaml
+++ b/tests/data/merge_sources/source7-1.yaml
@@ -4,20 +4,20 @@ users:
4 - default4 - default
5 - name: foobar5 - name: foobar
6 gecos: Foo B. Bar6 gecos: Foo B. Bar
7 primary-group: foobar7 primary_group: foobar
8 groups: users8 groups: users
9 selinux-user: staff_u9 selinux_user: staff_u
10 expiredate: 2012-09-0110 expiredate: 2012-09-01
11 ssh-import-id: foobar11 ssh_import_id: foobar
12 lock-passwd: false12 lock-passwd: false
13 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/13 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
14 - name: barfoo14 - name: barfoo
15 gecos: Bar B. Foo15 gecos: Bar B. Foo
16 sudo: ALL=(ALL) NOPASSWD:ALL16 sudo: ALL=(ALL) NOPASSWD:ALL
17 groups: users, admin17 groups: users, admin
18 ssh-import-id: None18 ssh_import_id: None
19 lock-passwd: true19 lock-passwd: true
20 ssh-authorized-keys:20 ssh_authorized_keys:
21 - <ssh pub key 1>21 - <ssh pub key 1>
22 - <ssh pub key 2>22 - <ssh pub key 2>
23 - name: cloudy23 - name: cloudy
diff --git a/tests/data/merge_sources/source7-2.yaml b/tests/data/merge_sources/source7-2.yaml
index 1e26201..0cd2897 100644
--- a/tests/data/merge_sources/source7-2.yaml
+++ b/tests/data/merge_sources/source7-2.yaml
@@ -6,11 +6,11 @@ users:
6 - sue6 - sue
7 - name: foobar_jr7 - name: foobar_jr
8 gecos: Foo B. Bar Jr8 gecos: Foo B. Bar Jr
9 primary-group: foobar9 primary_group: foobar
10 groups: users10 groups: users
11 selinux-user: staff_u11 selinux_user: staff_u
12 expiredate: 2012-09-0112 expiredate: 2012-09-01
13 ssh-import-id: foobar13 ssh_import_id: foobar
14 lock-passwd: false14 lock-passwd: false
15 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/15 passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/
1616
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index 8685b8e..5010190 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -366,8 +366,11 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
366 expected = ('none', 'tmpfs', '/run/lock')366 expected = ('none', 'tmpfs', '/run/lock')
367 self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))367 self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
368368
369 @mock.patch('cloudinit.util.os')
369 @mock.patch('cloudinit.util.subp')370 @mock.patch('cloudinit.util.subp')
370 def test_get_device_info_from_zpool(self, zpool_output):371 def test_get_device_info_from_zpool(self, zpool_output, m_os):
372 # mock /dev/zfs exists
373 m_os.path.exists.return_value = True
371 # mock subp command from util.get_mount_info_fs_on_zpool374 # mock subp command from util.get_mount_info_fs_on_zpool
372 zpool_output.return_value = (375 zpool_output.return_value = (
373 self.readResource('zpool_status_simple.txt'), ''376 self.readResource('zpool_status_simple.txt'), ''
@@ -376,9 +379,31 @@ class TestMountinfoParsing(helpers.ResourceUsingTestCase):
376 ret = util.get_device_info_from_zpool('vmzroot')379 ret = util.get_device_info_from_zpool('vmzroot')
377 self.assertEqual('gpt/system', ret)380 self.assertEqual('gpt/system', ret)
378 self.assertIsNotNone(ret)381 self.assertIsNotNone(ret)
382 m_os.path.exists.assert_called_with('/dev/zfs')
379383
384 @mock.patch('cloudinit.util.os')
385 def test_get_device_info_from_zpool_no_dev_zfs(self, m_os):
386 # mock /dev/zfs missing
387 m_os.path.exists.return_value = False
388 # save function return values and do asserts
389 ret = util.get_device_info_from_zpool('vmzroot')
390 self.assertIsNone(ret)
391
392 @mock.patch('cloudinit.util.os')
393 @mock.patch('cloudinit.util.subp')
394 def test_get_device_info_from_zpool_handles_no_zpool(self, m_sub, m_os):
395 """Handle case where there is no zpool command"""
396 # mock /dev/zfs exists
397 m_os.path.exists.return_value = True
398 m_sub.side_effect = util.ProcessExecutionError("No zpool cmd")
399 ret = util.get_device_info_from_zpool('vmzroot')
400 self.assertIsNone(ret)
401
402 @mock.patch('cloudinit.util.os')
380 @mock.patch('cloudinit.util.subp')403 @mock.patch('cloudinit.util.subp')
381 def test_get_device_info_from_zpool_on_error(self, zpool_output):404 def test_get_device_info_from_zpool_on_error(self, zpool_output, m_os):
405 # mock /dev/zfs exists
406 m_os.path.exists.return_value = True
382 # mock subp command from util.get_mount_info_fs_on_zpool407 # mock subp command from util.get_mount_info_fs_on_zpool
383 zpool_output.return_value = (408 zpool_output.return_value = (
384 self.readResource('zpool_status_simple.txt'), 'error'409 self.readResource('zpool_status_simple.txt'), 'error'

Subscribers

People subscribed via source and target branches