ansible: ensure we can delete ansible files
If the source files mode are non writtable, then copytree/rmtree fails with a PermissionError. This change ensures the files are writtable before removing them. Change-Id: I2b07ddc5ee203e7e4077b58224469fed916dabf6
This commit is contained in:
@@ -321,6 +321,11 @@ class AnsibleManager:
|
||||
|
||||
def copyAnsibleFiles(self):
|
||||
if os.path.exists(self.zuul_ansible_dir):
|
||||
# Ensure we can delete the files by setting writtable mode
|
||||
for dirpath, dirnames, filenames in os.walk(self.zuul_ansible_dir):
|
||||
os.chmod(dirpath, 0o755)
|
||||
for filename in filenames:
|
||||
os.chmod(os.path.join(dirpath, filename), 0o600)
|
||||
shutil.rmtree(self.zuul_ansible_dir)
|
||||
|
||||
library_path = os.path.dirname(os.path.abspath(zuul.ansible.__file__))
|
||||
|
||||
Reference in New Issue
Block a user