Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
106
Merge Requests
106
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
718ec498
Commit
718ec498
authored
Jul 27, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Again use local references to global modules.
Thanks to this blackbox testing is much easier.
parent
c854a012
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
slapos/format.py
slapos/format.py
+5
-3
No files found.
slapos/format.py
View file @
718ec498
...
@@ -430,6 +430,8 @@ class User:
...
@@ -430,6 +430,8 @@ class User:
"""
"""
self
.
name
=
str
(
user_name
)
self
.
name
=
str
(
user_name
)
self
.
additional_group_list
=
additional_group_list
self
.
additional_group_list
=
additional_group_list
self
.
_getpwnam
=
getpwnam
self
.
_grp
=
grp
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
name
,)
return
(
self
.
name
,)
...
@@ -449,7 +451,7 @@ class User:
...
@@ -449,7 +451,7 @@ class User:
# This method shall check if all is correctly done
# This method shall check if all is correctly done
# This method shall not reset groups, just add them
# This method shall not reset groups, just add them
try
:
try
:
grp
.
getgrnam
(
self
.
name
)
self
.
_
grp
.
getgrnam
(
self
.
name
)
except
KeyError
:
except
KeyError
:
callAndRead
([
'groupadd'
,
self
.
name
])
callAndRead
([
'groupadd'
,
self
.
name
])
...
@@ -458,7 +460,7 @@ class User:
...
@@ -458,7 +460,7 @@ class User:
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
append
(
self
.
name
)
user_parameter_list
.
append
(
self
.
name
)
try
:
try
:
getpwnam
(
self
.
name
)
self
.
_
getpwnam
(
self
.
name
)
except
KeyError
:
except
KeyError
:
callAndRead
([
'useradd'
]
+
user_parameter_list
)
callAndRead
([
'useradd'
]
+
user_parameter_list
)
else
:
else
:
...
@@ -476,7 +478,7 @@ class User:
...
@@ -476,7 +478,7 @@ class User:
"""
"""
try
:
try
:
getpwnam
(
self
.
name
)
self
.
_
getpwnam
(
self
.
name
)
return
True
return
True
except
KeyError
:
except
KeyError
:
...
...
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