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
4d8a1270
Commit
4d8a1270
authored
Apr 23, 2013
by
Jean-Baptiste Petre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chownDirectory recursif
parent
ff280e4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
slapos/format.py
slapos/format.py
+3
-2
slapos/util.py
slapos/util.py
+6
-0
No files found.
slapos/format.py
View file @
4d8a1270
...
...
@@ -65,6 +65,7 @@ def prettify_xml(xml):
from
slapos.util
import
mkdir_p
from
slapos.util
import
chownDirectory
class
OS
(
object
):
"""Wrap parts of the 'os' module to provide logging of performed actions."""
...
...
@@ -383,7 +384,7 @@ class Computer(object):
if
alter_user
:
slapsoft
.
create
()
slapsoft_pw
=
pwd
.
getpwnam
(
slapsoft
.
name
)
os
.
chown
(
self
.
software_root
,
slapsoft_pw
.
pw_uid
,
slapsoft_pw
.
pw_
gid
)
chownDirectory
(
path
,
uid
,
gid
)
os
.
chmod
(
self
.
software_root
,
0755
)
# Speed hack:
...
...
@@ -505,7 +506,7 @@ class Partition(object):
os
.
mkdir
(
self
.
path
,
0750
)
if
alter_user
:
owner_pw
=
pwd
.
getpwnam
(
owner
.
name
)
os
.
chown
(
self
.
path
,
owner_pw
.
pw_uid
,
owner_pw
.
pw_
gid
)
chownDirectory
(
path
,
uid
,
gid
)
os
.
chmod
(
self
.
path
,
0750
)
...
...
slapos/util.py
View file @
4d8a1270
...
...
@@ -17,3 +17,9 @@ def mkdir_p(path, mode=0o777):
else
:
raise
def
chownDirectory
(
path
,
uid
,
gid
):
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
for
items
in
dirs
,
files
:
for
item
in
items
:
os
.
chown
(
os
.
path
.
join
(
root
,
item
),
uid
,
gid
)
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