__acl: always check first if path exists

This commit is contained in:
ander 2019-04-16 14:44:32 +03:00
parent ef8ff06b5f
commit ab954ffbcf
3 changed files with 19 additions and 15 deletions

View File

@ -18,15 +18,16 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
acl_path="/$__object_id"
[ ! -e "$acl_path" ] && exit 0
if ! command -v getfacl 2>/dev/null
then
echo 'getfacl not available' >&2
exit 1
fi
if [ -e "/$__object_id" ]
then
getfacl "/$__object_id" 2>/dev/null \
| grep -E '^((default:)?(user|group):[^:]|(default:)?mask::)' \
|| true
fi
getfacl "$acl_path" 2>/dev/null \
| grep -E '^((default:)?(user|group):[^:]|(default:)?mask::)' \
|| true

View File

@ -18,11 +18,12 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
if [ -e "/$__object_id" ]
then
if [ -d "/$__object_id" ]
then echo d
elif [ -f "/$__object_id" ]
then echo f
fi
acl_path="/$__object_id"
[ ! -e "$acl_path" ] && exit 0
if [ -d "$acl_path" ]
then echo d
elif [ -f "$acl_path" ]
then echo f
fi

View File

@ -18,12 +18,14 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
acl_path="/$__object_id"
[ ! -e "$acl_path" ] && exit 0
os="$( cat "$__global/explorer/os" )"
file_type="$( cat "$__object/explorer/file_type" )"
acl_path="/$__object_id"
acl_is="$( cat "$__object/explorer/acl_is" )"
acl_should="$( for parameter in user group