Commit da3cb0b6 authored by Marco Mariani's avatar Marco Mariani

removed broken test (was going through mocks), removed old slow chown code

parent 3da69c56
......@@ -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(
......
......@@ -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)
......
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment