yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #60951
[Bug 1354694] Re: useradd crashes if group list contains whitespace
This bug was fixed in the package cloud-init -
0.7.8-68-gca3ae67-0ubuntu1~16.10.1
---------------
cloud-init (0.7.8-68-gca3ae67-0ubuntu1~16.10.1) yakkety; urgency=medium
* debian/cherry-pick: add utility for cherry picking commits from upstream
into patches in debian/patches.
* New upstream snapshot.
- mounts: use mount -a again to accomplish mounts (LP: #1647708)
- CloudSigma: Fix bug where datasource was not loaded in local search.
(LP: #1648380)
- when adding a user, strip whitespace from group list
[Lars Kellogg-Stedman] (LP: #1354694)
- fix decoding of utf-8 chars in yaml test
- Replace usage of sys_netdev_info with read_sys_net (LP: #1625766)
- fix problems found in python2.6 test.
- OpenStack: extend physical types to include hyperv, hw_veb, vhost_user.
(LP: #1642679)
- tests: fix assumptions that expected no eth0 in system. (LP: #1644043)
- net/cmdline: Consider ip= or ip6= on command line not only ip=
(LP: #1639930)
- Just use file logging by default [Joshua Harlow] (LP: #1643990)
- Improve formatting for ProcessExecutionError [Wesley Wiedenmeier]
- flake8: fix trailing white space
- Doc: various documentation fixes [Sean Bright]
- cloudinit/config/cc_rh_subscription.py: Remove repos before adding
[Brent Baude]
- packages/redhat: fix rpm spec file.
- main: set TZ in environment if not already set. [Ryan Harper]
- disk_setup: Use sectors as unit when formatting MBR disks with sfdisk.
[Daniel Watkins] (LP: #1460715)
-- Scott Moser <smoser@xxxxxxxxxx> Mon, 19 Dec 2016 15:07:12 -0500
** Changed in: cloud-init (Ubuntu Yakkety)
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1354694
Title:
useradd crashes if group list contains whitespace
Status in cloud-init:
Fix Released
Status in cloud-init package in Ubuntu:
Fix Released
Status in cloud-init source package in Xenial:
Confirmed
Status in cloud-init source package in Yakkety:
Fix Released
Bug description:
=== Begin SRU Template ===
[Impact]
A specific usage of user data to cloud-init will fail to add a user.
This cloud-config:
#cloud-config
users:
- default
- name: foobar
gecos: "My User"
groups: sudo, adm
Will fail with information in the cloud-init log showing:
2016-12-19 21:39:32,713 - util.py[WARNING]: Failed to create group adm
2016-12-19 21:39:32,713 - util.py[DEBUG]: Failed to create group adm
Traceback (most recent call last):
...
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['groupadd', ' adm']
Exit code: 3
Reason: -
Stdout: ''
Stderr: "groupadd: ' adm' is not a valid group name\n"
While changing the last line to the following would work:
groups: [sudo, adm]
[Test Case]
$ cat > user-data <<"EOF"
#cloud-config
users:
- default
- name: foobar
gecos: "My User"
groups: sudo, adm
- name: wark
groups: [sudo, adm]
EOF
$ release=yakkety
$ name="$release-1354694"
$ lxc launch "ubuntu-daily:$release" "$name" \
"--config=user.user-data=$(cat user-data)"
$ sleep 10
## Check foobar is in expected groups
$ lxc exec $name -- groups foobar
foobar : foobar adm sudo
$ lxc exec $name -- groups wark
wark : wark adm sudo
$ lxc exec $name -- grep WARN /var/log/cloud-init.log || echo "no warn"
no warn
[Regression Potential]
There are 3 changes in this commit
a.) if 'groups' entry is a string, split on "," and strip pieces
The most likely path to failure here is if previously a non-string
(possibly bytes) was being passed in and now will be ignored.
That seems unlikely and clearly wrong input.
b.) fix and unit tests to explicitly set system=False or no_create_home=True.
Previously those paths did not test the value of the entry, only the
presense of the entry.
This meant that these 2 configs were the same:
users: {name: bob, system: True}
and
users: {name: bob, system: False}
That bug is fixed here so that 'system: False' is just explicitly
disabling the '--system' flag to adduser.
c.) debug message cleanup:
LOG.debug("created group %s for user %s", name, group)
LOG.debug("created group '%s' for user '%s'", group, name)
[Other Info]
Upstream commit at
https://git.launchpad.net/cloud-init/commit/?id=ca3ae67211d907b4cfdcd685c0ae4f9530cb7da1
=== End SRU Template ===
See downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1126365
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1354694/+subscriptions
References