Commit 5294a8cb authored by Jean-Baptiste Petre's avatar Jean-Baptiste Petre Committed by Cédric de Saint Martin

Fix commit dab41f46 (chown).

parent dab41f46
...@@ -574,20 +574,23 @@ def chownSlaposDirectory(): ...@@ -574,20 +574,23 @@ def chownSlaposDirectory():
slapformat_partition_base_name = config.get('slapformat', 'partition_base_name') slapformat_partition_base_name = config.get('slapformat', 'partition_base_name')
slapformat_user_base_name = config.get('slapformat', 'user_base_name') slapformat_user_base_name = config.get('slapformat', 'user_base_name')
print "Changing owners of software directory and partitions directories..." path = slapos_slapgrid_instance
# chown of partitions (/srv/slapgrid/slappart*) print "Changing owners of software directory and partitions directories…"
for i in range(int(slapformat_partition)): for i in range(int(slapformat_partition)):
uid = getpwnam('%s%s' % (slapformat_user_base_name, i) )[2] uid = getpwnam('%s%s' % (slapformat_user_base_name, i) )[2]
gid = getpwnam('%s%s' % (slapformat_user_base_name, i) )[3] gid = getpwnam('%s%s' % (slapformat_user_base_name, i) )[3]
item = '%s%s' % (slapformat_partition_base_name, i) item = '%s%s' % (slapformat_partition_base_name, i)
itempath = os.path.join(slapos_slapgrid_instance, item) itempath = os.path.join(path, item)
os.chown(itempath, uid, gid) os.chown(itempath, uid, gid)
slapos_slapgrid_instance = "%s/%s%s" % ( slapos_slapgrid_instance, slapformat_partition_base_name, i)
for root, dirs, files in os.walk(slapos_slapgrid_instance): for i in range(int(slapformat_partition)):
for items in dirs, files: path = "%s/%s%s" % ( slapos_slapgrid_instance, slapformat_partition_base_name, i)
for item in items: for root, dirs, files in os.walk(path):
if not os.path.islink(item): for items in dirs, files:
os.chown(os.path.join(root, item), getpwnam('%s%s' % (slapformat_user_base_name, i) )[2], getpwnam('%s%s' % (slapformat_user_base_name, i) )[3]) for item in items:
if not os.path.islink(item):
os.chown(os.path.join(root, item), getpwnam('%s%s' % (slapformat_user_base_name, i) )[2], getpwnam('%s%s' % (slapformat_user_base_name, i) )[3])
# chown of software root (/opt/slapgrid) # chown of software root (/opt/slapgrid)
for root, dirs, files in os.walk(slapos_slapgrid_software): for root, dirs, files in os.walk(slapos_slapgrid_software):
......
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