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
788680a1
Commit
788680a1
authored
Jun 03, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of
git://github.com/trbs/ansible
into more_users
parents
57f4e808
3b3afe22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
2 deletions
+88
-2
library/system/group
+88
-2
library/system/user
+0
-0
No files found.
library/system/group
View file @
788680a1
...
@@ -228,13 +228,13 @@ class FreeBsdGroup(Group):
...
@@ -228,13 +228,13 @@ class FreeBsdGroup(Group):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupdel'
,
self
.
name
]
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupdel'
,
self
.
name
]
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
def
group_add
(
self
,
**
kwargs
):
def
group_add
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupadd'
,
self
.
name
]
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupadd'
,
self
.
name
]
if
self
.
gid
is
not
None
:
if
self
.
gid
is
not
None
:
cmd
.
append
(
'-g
%
d'
%
int
(
self
.
gid
))
cmd
.
append
(
'-g
%
d'
%
int
(
self
.
gid
))
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
def
group_mod
(
self
,
**
kwargs
):
def
group_mod
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupmod'
,
self
.
name
]
cmd
=
[
self
.
module
.
get_bin_path
(
'pw'
,
True
),
'groupmod'
,
self
.
name
]
info
=
self
.
group_info
()
info
=
self
.
group_info
()
cmd_len
=
len
(
cmd
)
cmd_len
=
len
(
cmd
)
...
@@ -242,8 +242,94 @@ class FreeBsdGroup(Group):
...
@@ -242,8 +242,94 @@ class FreeBsdGroup(Group):
cmd
.
append
(
'-g
%
d'
%
int
(
self
.
gid
))
cmd
.
append
(
'-g
%
d'
%
int
(
self
.
gid
))
# modify the group if cmd will do anything
# modify the group if cmd will do anything
if
cmd_len
!=
len
(
cmd
):
if
cmd_len
!=
len
(
cmd
):
if
self
.
module
.
check_mode
:
return
(
True
,
''
,
''
)
return
self
.
execute_command
(
cmd
)
return
(
None
,
''
,
''
)
# ===========================================
class
OpenBsdGroup
(
Group
):
"""
This is a OpenBSD Group manipulation class.
This overrides the following methods from the generic class:-
- group_del()
- group_add()
- group_mod()
"""
platform
=
'OpenBSD'
distribution
=
None
GROUPFILE
=
'/etc/group'
def
group_del
(
self
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupdel'
,
True
),
self
.
name
]
return
self
.
execute_command
(
cmd
)
def
group_add
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupadd'
,
True
)]
if
self
.
gid
is
not
None
:
cmd
.
append
(
'-g'
)
cmd
.
append
(
'
%
d'
%
int
(
self
.
gid
))
cmd
.
append
(
self
.
name
)
return
self
.
execute_command
(
cmd
)
def
group_mod
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupmod'
,
True
)]
info
=
self
.
group_info
()
cmd_len
=
len
(
cmd
)
if
self
.
gid
is
not
None
and
int
(
self
.
gid
)
!=
info
[
2
]:
cmd
.
append
(
'-g'
)
cmd
.
append
(
'
%
d'
%
int
(
self
.
gid
))
if
len
(
cmd
)
==
1
:
return
(
None
,
''
,
''
)
if
self
.
module
.
check_mode
:
return
(
True
,
''
,
''
)
cmd
.
append
(
self
.
name
)
return
self
.
execute_command
(
cmd
)
# ===========================================
class
NetBsdGroup
(
Group
):
"""
This is a NetBSD Group manipulation class.
This overrides the following methods from the generic class:-
- group_del()
- group_add()
- group_mod()
"""
platform
=
'NetBSD'
distribution
=
None
GROUPFILE
=
'/etc/group'
def
group_del
(
self
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupdel'
,
True
),
self
.
name
]
return
self
.
execute_command
(
cmd
)
return
self
.
execute_command
(
cmd
)
def
group_add
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupadd'
,
True
)]
if
self
.
gid
is
not
None
:
cmd
.
append
(
'-g'
)
cmd
.
append
(
'
%
d'
%
int
(
self
.
gid
))
cmd
.
append
(
self
.
name
)
return
self
.
execute_command
(
cmd
)
def
group_mod
(
self
,
**
kwargs
):
cmd
=
[
self
.
module
.
get_bin_path
(
'groupmod'
,
True
)]
info
=
self
.
group_info
()
cmd_len
=
len
(
cmd
)
if
self
.
gid
is
not
None
and
int
(
self
.
gid
)
!=
info
[
2
]:
cmd
.
append
(
'-g'
)
cmd
.
append
(
'
%
d'
%
int
(
self
.
gid
))
if
len
(
cmd
)
==
1
:
return
(
None
,
''
,
''
)
return
(
None
,
''
,
''
)
if
self
.
module
.
check_mode
:
return
(
True
,
''
,
''
)
cmd
.
append
(
self
.
name
)
return
self
.
execute_command
(
cmd
)
# ===========================================
# ===========================================
...
...
library/system/user
View file @
788680a1
This diff is collapsed.
Click to expand it.
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