Merge branch 'fix_user_non_root_on_rhel' of https://github.com/mscherer/ansible into mscherer-fix_user_non_root_on_rhel
This commit is contained in:
commit
eb0978e4db
1 changed files with 7 additions and 1 deletions
|
@ -336,8 +336,14 @@ class User(object):
|
||||||
|
|
||||||
def _check_usermod_append(self):
|
def _check_usermod_append(self):
|
||||||
# check if this version of usermod can append groups
|
# check if this version of usermod can append groups
|
||||||
|
usermod_path = self.module.get_bin_path('usermod', True)
|
||||||
|
|
||||||
cmd = [self.module.get_bin_path('usermod', True)]
|
# for some reason, usermod --help cannot be used by non root
|
||||||
|
# on RH/Fedora, due to lack of execute bit for others
|
||||||
|
if not os.access(usermod_path, os.X_OK):
|
||||||
|
return False
|
||||||
|
|
||||||
|
cmd = [usermod_path]
|
||||||
cmd.append('--help')
|
cmd.append('--help')
|
||||||
rc, data1, data2 = self.execute_command(cmd)
|
rc, data1, data2 = self.execute_command(cmd)
|
||||||
helpout = data1 + data2
|
helpout = data1 + data2
|
||||||
|
|
Loading…
Reference in a new issue