Merge "(perm) Fix CL for reverting missing file"

This commit is contained in:
Zuul 2019-03-19 19:12:14 +00:00 committed by Gerrit Code Review
commit 3bce1c1ac2
1 changed files with 6 additions and 3 deletions

View File

@ -97,11 +97,14 @@ revert_perm(){
for o_perm in ${revert_list}; do
first=1
while IFS=' ' read -r a1 a2; do
if [ "$first" -eq 1 ]; then
$(chmod $a1 $a2)
if [ "$first" -eq 1 && -e "$a2"]; then
$(chmod "$a1" "$a2")
first=0
elif [ -e "$a2"]; then
$(chown "$a1" "$a2")
else
$(chown $a1 $a2)
log.WARN "Unable to revert permissions on $a2"
continue
fi
done < "${backup_path}/${o_perm}"