Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos.core
Commits
9ed94c78
Commit
9ed94c78
authored
Aug 08, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid changing code in order to do the testing.
parent
65fb2a39
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
slapos/format.py
slapos/format.py
+8
-11
No files found.
slapos/format.py
View file @
9ed94c78
...
...
@@ -400,7 +400,6 @@ class Partition:
self
.
user
=
user
self
.
address_list
=
address_list
or
[]
self
.
tap
=
tap
self
.
_os
=
os
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
path
,
self
.
user
,
self
.
address_list
,
self
.
tap
)
...
...
@@ -411,14 +410,14 @@ class Partition:
it the 750 permission. In case if path exists just modifies it.
"""
self
.
path
=
self
.
_
os
.
path
.
abspath
(
self
.
path
)
self
.
path
=
os
.
path
.
abspath
(
self
.
path
)
owner
=
self
.
user
if
self
.
user
else
User
(
'root'
)
if
not
self
.
_
os
.
path
.
exists
(
self
.
path
):
self
.
_
os
.
mkdir
(
self
.
path
,
0750
)
if
not
os
.
path
.
exists
(
self
.
path
):
os
.
mkdir
(
self
.
path
,
0750
)
if
alter_user
:
owner_pw
=
getpwnam
(
owner
.
name
)
self
.
_
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_gid
)
self
.
_
os
.
chmod
(
self
.
path
,
0750
)
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_gid
)
os
.
chmod
(
self
.
path
,
0750
)
class
User
:
"User: represent and manipulate a user on the system."
...
...
@@ -430,8 +429,6 @@ class User:
"""
self
.
name
=
str
(
user_name
)
self
.
additional_group_list
=
additional_group_list
self
.
_getpwnam
=
getpwnam
self
.
_grp
=
grp
def
__getinitargs__
(
self
):
return
(
self
.
name
,)
...
...
@@ -451,7 +448,7 @@ class User:
# This method shall check if all is correctly done
# This method shall not reset groups, just add them
try
:
self
.
_
grp
.
getgrnam
(
self
.
name
)
grp
.
getgrnam
(
self
.
name
)
except
KeyError
:
callAndRead
([
'groupadd'
,
self
.
name
])
...
...
@@ -460,7 +457,7 @@ class User:
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
append
(
self
.
name
)
try
:
self
.
_
getpwnam
(
self
.
name
)
getpwnam
(
self
.
name
)
except
KeyError
:
callAndRead
([
'useradd'
]
+
user_parameter_list
)
else
:
...
...
@@ -478,7 +475,7 @@ class User:
"""
try
:
self
.
_
getpwnam
(
self
.
name
)
getpwnam
(
self
.
name
)
return
True
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