Recover file permissions after shrink a vmdk image

After vmware-vdiskmanager runs, the image is left with a 600
permission. This commit fixes it by preserving the file permission
before the shrink operation.
This commit is contained in:
Jonh Wendell 2015-01-27 21:12:39 -02:00
parent e1e1150a04
commit 8418090018

View file

@ -81,4 +81,6 @@ class ShrinkVolume(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
from bootstrapvz.common.tools import log_check_call from bootstrapvz.common.tools import log_check_call
perm = os.stat(info.volume.image_path).st_mode & 0777
log_check_call(['/usr/bin/vmware-vdiskmanager', '-k', info.volume.image_path]) log_check_call(['/usr/bin/vmware-vdiskmanager', '-k', info.volume.image_path])
os.chmod(info.volume.image_path, perm)