(perm) Fix CL for reverting missing file

- When reverting permissions on a file, there is no check for existence
  causing a deleted file to CL the perm module

Change-Id: Ifae0ac196acf8ac2ccef84102967b6b4305a7691
This commit is contained in:
Scott Hussey 2019-03-08 09:08:10 -06:00
parent ecade10b2d
commit 9d244c4443
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}"