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
Ophélie Gagnard
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
Hide 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:
...
@@ -400,7 +400,6 @@ class Partition:
self
.
user
=
user
self
.
user
=
user
self
.
address_list
=
address_list
or
[]
self
.
address_list
=
address_list
or
[]
self
.
tap
=
tap
self
.
tap
=
tap
self
.
_os
=
os
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
path
,
self
.
user
,
self
.
address_list
,
self
.
tap
)
return
(
self
.
reference
,
self
.
path
,
self
.
user
,
self
.
address_list
,
self
.
tap
)
...
@@ -411,14 +410,14 @@ class Partition:
...
@@ -411,14 +410,14 @@ class Partition:
it the 750 permission. In case if path exists just modifies it.
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'
)
owner
=
self
.
user
if
self
.
user
else
User
(
'root'
)
if
not
self
.
_
os
.
path
.
exists
(
self
.
path
):
if
not
os
.
path
.
exists
(
self
.
path
):
self
.
_
os
.
mkdir
(
self
.
path
,
0750
)
os
.
mkdir
(
self
.
path
,
0750
)
if
alter_user
:
if
alter_user
:
owner_pw
=
getpwnam
(
owner
.
name
)
owner_pw
=
getpwnam
(
owner
.
name
)
self
.
_
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_gid
)
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_gid
)
self
.
_
os
.
chmod
(
self
.
path
,
0750
)
os
.
chmod
(
self
.
path
,
0750
)
class
User
:
class
User
:
"User: represent and manipulate a user on the system."
"User: represent and manipulate a user on the system."
...
@@ -430,8 +429,6 @@ class User:
...
@@ -430,8 +429,6 @@ 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
,)
...
@@ -451,7 +448,7 @@ class User:
...
@@ -451,7 +448,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
:
self
.
_
grp
.
getgrnam
(
self
.
name
)
grp
.
getgrnam
(
self
.
name
)
except
KeyError
:
except
KeyError
:
callAndRead
([
'groupadd'
,
self
.
name
])
callAndRead
([
'groupadd'
,
self
.
name
])
...
@@ -460,7 +457,7 @@ class User:
...
@@ -460,7 +457,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
:
self
.
_
getpwnam
(
self
.
name
)
getpwnam
(
self
.
name
)
except
KeyError
:
except
KeyError
:
callAndRead
([
'useradd'
]
+
user_parameter_list
)
callAndRead
([
'useradd'
]
+
user_parameter_list
)
else
:
else
:
...
@@ -478,7 +475,7 @@ class User:
...
@@ -478,7 +475,7 @@ class User:
"""
"""
try
:
try
:
self
.
_
getpwnam
(
self
.
name
)
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