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
Léo-Paul Géneau
slapos.core
Commits
7d480307
Commit
7d480307
authored
Aug 08, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import whole module.
parent
8fe7ff08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
slapos/format.py
slapos/format.py
+8
-8
No files found.
slapos/format.py
View file @
7d480307
...
...
@@ -27,13 +27,13 @@
##############################################################################
from
optparse
import
OptionParser
,
Option
from
xml_marshaller
import
xml_marshaller
from
pwd
import
getpwnam
import
ConfigParser
import
grp
import
logging
import
netaddr
import
netifaces
import
os
import
pwd
import
random
import
slapos.slap
as
slap
import
socket
...
...
@@ -317,7 +317,7 @@ class Computer:
slapsoft
.
path
=
self
.
software_root
if
alter_user
:
slapsoft
.
create
()
slapsoft_pw
=
getpwnam
(
slapsoft
.
name
)
slapsoft_pw
=
pwd
.
getpwnam
(
slapsoft
.
name
)
os
.
chown
(
self
.
software_root
,
slapsoft_pw
.
pw_uid
,
slapsoft_pw
.
pw_gid
)
os
.
chmod
(
self
.
software_root
,
0755
)
...
...
@@ -415,7 +415,7 @@ class Partition:
if
not
os
.
path
.
exists
(
self
.
path
):
os
.
mkdir
(
self
.
path
,
0750
)
if
alter_user
:
owner_pw
=
getpwnam
(
owner
.
name
)
owner_pw
=
pwd
.
getpwnam
(
owner
.
name
)
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_gid
)
os
.
chmod
(
self
.
path
,
0750
)
...
...
@@ -457,7 +457,7 @@ class User:
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
append
(
self
.
name
)
try
:
getpwnam
(
self
.
name
)
pwd
.
getpwnam
(
self
.
name
)
except
KeyError
:
callAndRead
([
'useradd'
]
+
user_parameter_list
)
else
:
...
...
@@ -475,7 +475,7 @@ class User:
"""
try
:
getpwnam
(
self
.
name
)
pwd
.
getpwnam
(
self
.
name
)
return
True
except
KeyError
:
...
...
@@ -572,7 +572,7 @@ class Tap:
owner_id
=
int
(
open
(
check_file
).
read
().
strip
())
except
Exception
:
pass
if
(
owner_id
is
None
)
or
(
owner_id
!=
getpwnam
(
owner
.
name
).
pw_uid
):
if
(
owner_id
is
None
)
or
(
owner_id
!=
pwd
.
getpwnam
(
owner
.
name
).
pw_uid
):
callAndRead
([
'tunctl'
,
'-t'
,
self
.
name
,
'-u'
,
owner
.
name
])
callAndRead
([
'ip'
,
'link'
,
'set'
,
self
.
name
,
'up'
])
...
...
@@ -1100,7 +1100,7 @@ def main(*args):
"Run default configuration."
global
os
global
callAndRead
global
getpwnam
global
pwd
real_callAndRead
=
callAndRead
usage
=
"usage: %s [options] CONFIGURATION_FILE"
%
sys
.
argv
[
0
]
...
...
@@ -1128,7 +1128,7 @@ def main(*args):
pw_uid
=
12345
pw_gid
=
54321
return
result
getpwnam
=
fake_getpwnam
pwd
.
getpwnam
=
fake_getpwnam
else
:
dry_callAndRead
=
real_callAndRead
if
config
.
verbose
:
...
...
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