sebastien / cuisine

Chef-like functionality for Fabric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

group_user_ensure fails in suse 11 sp3

rgcr opened this issue · comments

commented

Hi Sebastian please check this

group_user_ensure(group='test', user='www')

I got this:

sudo: usermod -a -G 'test' 'www'
[mo9e] out: usermod: invalid option -- 'a'
[mo9e] out: Try `usermod --help' or `usermod --usage' for more information.
[mo9e] out:


Fatal error: sudo() received nonzero return code 2 while executing!

Requested: usermod -a -G 'test' 'www'
Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "usermod -a -G 'test' 'www'"

As per the man doesn't exist an option "-a"

Usage: usermod ...
usermod - modify a user account

  -c comment     Set the GECOS field for the new account
  -D binddn      Use dn "binddn" to bind to the LDAP directory
  -d homedir     Home directory for the new user
  -e expire      Date on which the new account will be disabled
  -f inactive    Days after a password expires until account is disabled
  -G group,...   List of supplementary groups
  -g gid         Name/number of the users primary group
  -l login       Change login name.
  -m             Move home directory to the new path
  -o             Allow duplicate (non-unique) UID
  -A group,...   List of groups the user should be added to
  -R group,...   List of groups the user should be removed from
  -P path        Search passwd, shadow and group file in "path"
  -p password    Encrypted password as returned by crypt(3)
  -s shell       Name of the user's login shell
  -u uid         Change the userid to the given number
  --service srv  Use nameservice 'srv'
  -L             Locks the password entry for "user"
  -U             Try to unlock the password entry for "user"
      --help     Give this help list
      --usage    Give a short usage message
  -v, --version  Print program version
Valid services are: files, ldap

SUSE's usermod is not the same as the one on Debian/Ubuntu. The one shipped here is from shadow-utils 4.1.5.1. Could you paste me the output of cat /etc/lsb-release on your remote system?

commented

There is the output:

~> cat /etc/*release*
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64"

Not sure I want to add a specific case to handle that, I don't see a combination of options that would work for both usermod commands. Do you have shadowutils installed?

commented

no, I have pwdutils

# rpm -qf /usr/sbin/usermod
pwdutils-3.2.15-0.13.1

You're welcome to create a pull request for that, as I don't have the environment at hand to test it -- this could be defined as a variant (such as what we already do with the package_* functions).