From 9d244c44433faaac05b7c716c10a039a51bece64 Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Fri, 8 Mar 2019 09:08:10 -0600 Subject: [PATCH] (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 --- divingbell/templates/bin/_perm.sh.tpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/divingbell/templates/bin/_perm.sh.tpl b/divingbell/templates/bin/_perm.sh.tpl index 58b87af..f73f67e 100644 --- a/divingbell/templates/bin/_perm.sh.tpl +++ b/divingbell/templates/bin/_perm.sh.tpl @@ -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}"