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
Jérome Perrin
slapos.core
Commits
da3cb0b6
Commit
da3cb0b6
authored
May 09, 2014
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed broken test (was going through mocks), removed old slow chown code
parent
3da69c56
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
27 deletions
+8
-27
slapos/tests/slapformat.py
slapos/tests/slapformat.py
+0
-13
slapos/tests/util.py
slapos/tests/util.py
+4
-3
slapos/util.py
slapos/util.py
+4
-11
No files found.
slapos/tests/slapformat.py
View file @
da3cb0b6
...
...
@@ -501,19 +501,6 @@ class TestComputer(SlapformatMixin):
class
TestPartition
(
SlapformatMixin
):
def
test_createPath
(
self
):
global
USER_LIST
USER_LIST
=
[
'testuser'
]
self
.
partition
.
createPath
()
self
.
assertEqual
(
[
"mkdir('/part_path', 488)"
,
"chown('/part_path', 0, 0)"
,
"chmod('/part_path', 488)"
],
self
.
test_result
.
bucket
)
def
test_createPath_no_alter_user
(
self
):
self
.
partition
.
createPath
(
False
)
self
.
assertEqual
(
...
...
slapos/tests/util.py
View file @
da3cb0b6
...
...
@@ -75,11 +75,12 @@ class TestUtil(unittest.TestCase):
gid
=
getpwnam
(
user
)[
3
]
except
KeyError
:
raise
unittest
.
SkipTest
(
"user %s doesn't exist."
%
user
)
try
:
slapos
.
util
.
chownDirectory
(
root_slaptest
,
uid
,
gid
)
except
OSError
:
if
os
.
getuid
()
!=
0
:
raise
unittest
.
SkipTest
(
"No root privileges, impossible to chown."
)
slapos
.
util
.
chownDirectory
(
root_slaptest
,
uid
,
gid
)
uid_check_root_slaptest
=
os
.
stat
(
root_slaptest
)[
4
]
gid_check_root_slaptest
=
os
.
stat
(
root_slaptest
)[
5
]
self
.
assertTrue
(
uid
==
uid_check_root_slaptest
)
...
...
slapos/util.py
View file @
da3cb0b6
...
...
@@ -22,18 +22,11 @@ def mkdir_p(path, mode=0o700):
def
chownDirectory
(
path
,
uid
,
gid
):
chown_cmd
=
'/bin/chown'
if
os
.
path
.
exists
(
chown_cmd
):
subprocess
.
check_call
([
chown_cmd
,
'-R'
,
'%s:%s'
%
(
uid
,
gid
),
path
])
if
os
.
getuid
()
==
0
:
subprocess
.
check_call
([
'/bin/chown'
,
'-R'
,
'%s:%s'
%
(
uid
,
gid
),
path
])
else
:
# slow fallback.. not unix?
print
'chown..'
,
path
os
.
chown
(
path
,
uid
,
gid
)
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
for
items
in
dirs
,
files
:
for
item
in
items
:
if
not
os
.
path
.
islink
(
os
.
path
.
join
(
root
,
item
)):
os
.
chown
(
os
.
path
.
join
(
root
,
item
),
uid
,
gid
)
# we are probably inside webrunner
subprocess
.
check_call
([
'/bin/chgrp'
,
'-R'
,
'%s'
%
gid
,
path
])
def
parse_certificate_key_pair
(
html
):
...
...
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