Issue #20726 has been updated by Andrew Parker.

Repro steps:

on a centos6 box (built from the vagrant box 
http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box):

<pre>
> vagrant ssh
> sudo su
$ rpm -ivh 
http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm
$ # enable the puppetlabs-devel repo by editing /etc/yum.repos.d/puppetlabs.repo
$ yum install puppet
$ puppet resource user testing ensure=present home=/home/testing managehome=true
$ puppet resource user testing ensure=present home=/home/tested
</pre>

The second resource command fails with:

<pre>
Error: Could not set home on user[testing]: Execution of '/usr/sbin/usermod -d 
/home/tested testing -M' returned 2: Usage: usermod [options] LOGIN

Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                him/her from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -Z, --selinux-user            new SELinux user mapping for the user account


Error: /User[testing]/home: change from /home/testing to /home/tested failed: 
Could not set home on user[testing]: Execution of '/usr/sbin/usermod -d 
/home/tested testing -M' returned 2: Usage: usermod [options] LOGIN

Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                him/her from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -Z, --selinux-user            new SELinux user mapping for the user account
</pre>


----------------------------------------
Bug #20726: usermod command arguments out of order
https://projects.puppetlabs.com/issues/20726#change-91044

* Author: Kevin Sumner
* Status: Investigating
* Priority: High
* Assignee: 
* Category: user
* Target version: 3.2.0
* Affected Puppet version: 3.2.0-rc2
* Keywords: 
* Branch: 
----------------------------------------
Using 3.2.0-rc2 client pointed at a 3.2.0-rc2 server, I'm getting this:
<pre>
Error: Could not set home on user[nagios]: Execution of '/usr/sbin/usermod -d 
/var/lib/nagios nagios -M' returned 2: Usage: usermod [options] LOGIN

Options:
  -a, --append                  append the user to the supplemental GROUPS
                                (use only with -G)
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -Z, --selinux-user    new selinux user mapping for the user account
</pre>

Notice that the -M comes after the username, nagios.   That's causing the 
error.  Downgrading the client to 3.1.1 works correctly.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to