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
11c730c4
Commit
11c730c4
authored
Feb 16, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of
git://github.com/trendels/ansible
into testing
parents
36f613f5
8f708835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
18 deletions
+27
-18
library/user
+27
-18
No files found.
library/user
View file @
11c730c4
...
...
@@ -48,7 +48,9 @@ options:
groups:
required: false
description:
- Puts the user in this comma-delimited list of groups.
- Puts the user in this comma-delimited list of groups. When set to
the empty string ('groups='), the user is removed from all groups
except the primary group.
append:
required: false
description:
...
...
@@ -249,9 +251,10 @@ class User(object):
cmd
.
append
(
self
.
group
)
if
self
.
groups
is
not
None
:
for
g
in
self
.
groups
.
split
(
','
):
if
not
self
.
group_exists
(
g
):
self
.
module
.
fail_json
(
msg
=
"Group
%
s does not exist"
%
(
g
))
if
self
.
groups
!=
''
:
for
g
in
self
.
groups
.
split
(
','
):
if
not
self
.
group_exists
(
g
):
self
.
module
.
fail_json
(
msg
=
"Group
%
s does not exist"
%
(
g
))
cmd
.
append
(
'-G'
)
cmd
.
append
(
self
.
groups
)
...
...
@@ -301,23 +304,29 @@ class User(object):
if
self
.
groups
is
not
None
:
current_groups
=
self
.
user_group_membership
()
groups
=
self
.
groups
.
split
(
','
)
for
g
in
groups
:
if
not
self
.
group_exists
(
g
):
self
.
module
.
fail_json
(
msg
=
"Group
%
s does not exist"
%
(
g
))
group_diff
=
set
(
sorted
(
current_groups
))
.
symmetric_difference
(
set
(
sorted
(
groups
)))
groups_need_mod
=
False
groups
=
[]
if
group_diff
:
if
self
.
append
:
for
g
in
groups
:
if
g
in
group_diff
:
cmd
.
append
(
'-a'
)
groups_need_mod
=
True
break
else
:
if
self
.
groups
==
''
:
if
current_groups
and
not
self
.
append
:
groups_need_mod
=
True
else
:
groups
=
self
.
groups
.
split
(
','
)
for
g
in
groups
:
if
not
self
.
group_exists
(
g
):
self
.
module
.
fail_json
(
msg
=
"Group
%
s does not exist"
%
(
g
))
group_diff
=
set
(
sorted
(
current_groups
))
.
symmetric_difference
(
set
(
sorted
(
groups
)))
if
group_diff
:
if
self
.
append
:
for
g
in
groups
:
if
g
in
group_diff
:
cmd
.
append
(
'-a'
)
groups_need_mod
=
True
break
else
:
groups_need_mod
=
True
if
groups_need_mod
:
cmd
.
append
(
'-G'
)
...
...
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