cc_set_passwords fails to change passwords specified as chpasswd['list'] in cloud-config
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Yakkety |
Fix Released
|
Medium
|
Unassigned | ||
Zesty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=== Being SRU Template ===
[Impact]
Users of cloud-init can change passwords on a system by providing input
to chpasswd as a string:
#cloud-config
chpasswd:
list: |
user1:
Confusingly, the 'list' is actually not a list, but a multi-line string.
The change made in this bug supports either.
[Test Case]
There is an integration test in cloud-init that runs though this code.
To run that:
$ git clone https:/
$ cd cloud-init
# download the appropriate deb for cloud-init from -proposed
$ rel=xenial
$ pver=$(rmadison --url=ubuntu --suite=
$ fname="
$ wget "http://
$ ln -sf $fname cloud-init_
$ tox -e citest -- run -v -n $rel --deb=cloud-
-t tests/cloud_
-t tests/cloud_
That will install the new cloud-init into a container and run
with user data to excercise this new feature.
[Regression Potential]
Very low regression potential. The test case shown provides both
the previously supported path (a string) and the new path (a list).
[Other Info]
Upstream commit:
https:/
=== End SRU Template ===
If cloud-config contains list of user:password pairs as in example below
chpasswd:
list:
- user1:pwd001
- user2:pwd002
cc_set_passwords module fails to change passwords with error:
Feb 17 15:52:48 si-man [CLOUDINIT] stages.py[DEBUG]: Running module set-passwords (<module 'cloudinit.
Feb 17 15:52:48 si-man [CLOUDINIT] handlers.py[DEBUG]: start: modules-
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[DEBUG]: Writing to /var/lib/
Feb 17 15:52:48 si-man [CLOUDINIT] helpers.py[DEBUG]: Running config-
Feb 17 15:52:48 si-man [CLOUDINIT] cc_set_
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[DEBUG]: Running command ['chpasswd'] with allowed return codes [0] (shell=False, capture=True)
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[WARNING]: Failed to set passwords with chpasswd for ["['user1"]
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[DEBUG]: Failed to set passwords with chpasswd for ["['user1"
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[DEBUG]: Running command ['passwd', '--expire', "['user1"] with allowed return codes [0] (shell=False, capture=True)
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[WARNING]: Failed to set 'expire' for ['user1
Feb 17 15:52:48 si-man [CLOUDINIT] util.py[DEBUG]: Failed to set 'expire' for ['user1#
Feb 17 15:52:48 si-man [CLOUDINIT] cc_set_
The issue affects cloud-init installed in xenial-
# apt-cache policy cloud-init
cloud-init:
Installed: 0.7.8-49-
Candidate: 0.7.8-49-
Version table:
*** 0.7.8-49-
500 http://
100 /var/lib/
0.
500 http://
cc_set_passwords converts list of user:password lists to str and as result user names get corrupted.
Related branches
- Ryan Harper: Pending requested
-
Diff: 4168 lines (+2525/-393)47 files modifiedMakefile (+9/-5)
cloudinit/cmd/main.py (+150/-16)
cloudinit/config/cc_set_hostname.py (+1/-1)
cloudinit/config/cc_set_passwords.py (+20/-2)
cloudinit/distros/parsers/resolv_conf.py (+7/-4)
cloudinit/distros/rhel.py (+12/-7)
cloudinit/ec2_utils.py (+4/-1)
cloudinit/helpers.py (+2/-0)
cloudinit/net/eni.py (+19/-14)
cloudinit/net/sysconfig.py (+28/-13)
cloudinit/settings.py (+2/-0)
cloudinit/sources/DataSourceAliYun.py (+4/-0)
cloudinit/sources/DataSourceEc2.py (+145/-2)
cloudinit/sources/DataSourceOVF.py (+33/-4)
cloudinit/sources/DataSourceOpenStack.py (+12/-3)
cloudinit/sources/helpers/vmware/imc/config_nic.py (+6/-18)
cloudinit/ssh_util.py (+3/-0)
cloudinit/stages.py (+14/-1)
cloudinit/util.py (+0/-44)
cloudinit/warnings.py (+139/-0)
doc/examples/cloud-config.txt (+1/-1)
doc/rtd/topics/datasources/altcloud.rst (+2/-2)
doc/rtd/topics/datasources/openstack.rst (+35/-1)
doc/rtd/topics/format.rst (+7/-6)
packages/debian/rules.in (+2/-0)
setup.py (+2/-1)
systemd/cloud-init-generator (+37/-2)
tests/unittests/helpers.py (+26/-48)
tests/unittests/test__init__.py (+59/-33)
tests/unittests/test_atomic_helper.py (+2/-2)
tests/unittests/test_data.py (+37/-16)
tests/unittests/test_datasource/test_gce.py (+3/-1)
tests/unittests/test_datasource/test_openstack.py (+5/-6)
tests/unittests/test_distros/test_resolv.py (+1/-1)
tests/unittests/test_distros/test_user_data_normalize.py (+0/-0)
tests/unittests/test_ec2_util.py (+47/-2)
tests/unittests/test_net.py (+233/-45)
tests/unittests/test_sshutil.py (+23/-1)
tools/Z99-cloud-locale-test.sh (+74/-74)
tools/Z99-cloudinit-warnings.sh (+30/-0)
tools/ds-identify (+1252/-0)
tools/make-mime.py (+1/-1)
tools/make-tarball (+1/-1)
tools/mock-meta.py (+25/-12)
tools/read-version (+1/-1)
tools/validate-yaml.py (+1/-1)
tox.ini (+8/-0)
- Scott Moser: Approve
- Serg Lystopad (community): Needs Resubmitting
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 69 lines (+36/-5)1 file modifiedcloudinit/config/cc_set_passwords.py (+36/-5)
- Server Team CI bot: Needs Fixing (continuous-integration)
- cloud-init Commiters: Pending requested
-
Diff: 81 lines (+43/-5) (has conflicts)1 file modifiedcloudinit/config/cc_set_passwords.py (+43/-5)
description: | updated |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
status: | Confirmed → Fix Committed |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Zesty): | |
status: | New → Fix Released |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Yakkety): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Zesty): | |
importance: | Undecided → Medium |
description: | updated |
tags: |
added: verification-done-xenial verification-done-yakkety removed: verification-needed |
Hello Serg, or anyone else affected,
Accepted cloud-init into yakkety-proposed. The package will build now and be available at https:/ /launchpad. net/ubuntu/ +source/ cloud-init/ 0.7.9-90- g61eb03fe- 0ubuntu1~ 16.10.1 in a few hours, and then in the -proposed repository.
Please help us by testing this new package. See https:/ /wiki.ubuntu. com/Testing/ EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification- failed. In either case, details of your testing will help us make a better decision.
Further information regarding the verification process can be found at https:/ /wiki.ubuntu. com/QATeam/ PerformingSRUVe rification . Thank you in advance!