• Scott Moser's avatar
    fix adding of users when no group is specified · d75a912f
    Scott Moser authored
    revision 1179 regressed adding a user that did not have a 'groups'
    entry present in cloud-config.
    This handles that correctly, making 'add_user' able to take:
      a.) groups="group1,group2"
      b.) groups=["group1", "group2"]
      c.) groups=None
      d.) no groups parameter
    
    Additionally, if a primary group is specified it will also be created.
    
    End result is that this is functional:
     #cloud-config
     groups: ["sudo"]
     users:
       - name: sysop
         primary-group: sysop
         groups: "sudo,adm"
         shell: /bin/bash
       - name: user1
         primary-group: users
         groups: sudo
       - name: foo1
       - name: bar
         gecos: Bar
         groups: ["bargroup"]
    
    Resulting in:
     $ groups sysop
     sysop : sysop adm sudo
     $ groups user1
     user1 : users sudo
     $ groups foo1
     foo1 : foo1
     $ groups bar
     bar : bar bargroup
    
    LP: #1562918
    d75a912f
Name
Last commit
Last update
bin Loading commit data...
cloudinit Loading commit data...
config Loading commit data...
doc Loading commit data...
packages Loading commit data...
systemd Loading commit data...
sysvinit Loading commit data...
templates Loading commit data...
tests Loading commit data...
tools Loading commit data...
udev Loading commit data...
upstart Loading commit data...
.bzrignore Loading commit data...
ChangeLog Loading commit data...
HACKING.rst Loading commit data...
LICENSE Loading commit data...
MANIFEST.in Loading commit data...
Makefile Loading commit data...
TODO.rst Loading commit data...
requirements.txt Loading commit data...
setup.py Loading commit data...
test-requirements.txt Loading commit data...
tox.ini Loading commit data...