Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
1c652492
Commit
1c652492
authored
May 08, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #335 from sfromm/user
User module fix
parents
b2485850
55061470
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
library/user
+13
-3
No files found.
library/user
View file @
1c652492
...
...
@@ -25,9 +25,13 @@ import os
import
pwd
import
grp
import
shlex
import
spwd
import
subprocess
import
sys
try
:
import
spwd
HAVE_SPWD
=
True
except
:
HAVE_SPWD
=
False
USERADD
=
"/usr/sbin/useradd"
USERMOD
=
"/usr/sbin/usermod"
...
...
@@ -119,6 +123,10 @@ def user_add(user, **kwargs):
else
:
return
False
"""
Without spwd, we would have to resort to reading /etc/shadow
to get the encrypted string. For now, punt on idempotent password changes.
"""
def
user_mod
(
user
,
**
kwargs
):
cmd
=
[
USERMOD
]
info
=
user_info
(
user
)
...
...
@@ -227,10 +235,12 @@ def user_info(user):
return
False
try
:
info
=
get_pwd_info
(
user
)
sinfo
=
spwd
.
getspnam
(
user
)
if
HAVE_SPWD
:
sinfo
=
spwd
.
getspnam
(
user
)
except
KeyError
:
return
False
info
[
1
]
=
sinfo
[
1
]
if
HAVE_SPWD
:
info
[
1
]
=
sinfo
[
1
]
return
info
# ===========================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment