When removing instance : chmoding directories that are not writable because...

When removing instance : chmoding directories that are not writable because some instances do 'chmod 555' on directories.
parent aed4d531
......@@ -88,6 +88,12 @@ def removeInstance():
flash('Instantiation in progress, cannot remove')
elif os.path.exists(app.config['instance_root']):
svcStopAll(app.config)
for root, dirs, files in os.walk(app.config['instance_root']):
for fname in dirs:
fullPath = os.path.join(root, fname)
if not os.access(fullPath, os.W_OK) :
# Some directories may be read-only, preventing to remove files in it
os.chmod(fullPath, 0744)
shutil.rmtree(app.config['instance_root'])
flash('Instance removed')
return redirect(url_for('inspectInstance'))
......
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