Set jobdir to 0755 before we delete it

Because it is possible to rsync different directory permissions from a
jobs, set them to 0755 to ensure we can delete the files within them
first.

Change-Id: Id21140aba7cfda985bd27ff5efe3e2a05722493a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-04-07 13:35:54 -04:00
parent 783da025ea
commit 1713ee675c
1 changed files with 5 additions and 0 deletions

View File

@ -131,6 +131,11 @@ class JobDir(object):
def __exit__(self, etype, value, tb):
if not self.keep:
# Ensure directories are writeable so that files can be removed
# from them.
for root, dirs, files in os.walk(self.root):
for d in dirs:
os.chmod(os.path.join(root, d), 0o755)
shutil.rmtree(self.root)