Merge branch '__acl_file_directory_params' into 'master'

__acl: add --file and --directory for convenience

See merge request ungleich-public/cdist!836
This commit is contained in:
poljakowski 2020-01-20 09:10:07 +01:00
commit f7a5ac5f7a
4 changed files with 33 additions and 1 deletions

View File

@ -20,7 +20,13 @@
file_is="$( cat "$__object/explorer/file_is" )" file_is="$( cat "$__object/explorer/file_is" )"
[ "$file_is" = 'missing' ] && [ -z "$__cdist_dry_run" ] && exit 0 if [ "$file_is" = 'missing' ] \
&& [ -z "$__cdist_dry_run" ] \
&& \( [ ! -f "$__object/parameter/file" ] \
|| [ ! -f "$__object/parameter/directory" ] \)
then
exit 0
fi
os="$( cat "$__global/explorer/os" )" os="$( cat "$__global/explorer/os" )"

View File

@ -26,6 +26,12 @@ source
Ordering of entries is not important. Ordering of entries is not important.
When reading from file, comments and empty lines are ignored. When reading from file, comments and empty lines are ignored.
file
Create/change file with ``__file`` using ``user:group:mode`` pattern.
directory
Create/change directory with ``__directory`` using ``user:group:mode`` pattern.
BOOLEAN PARAMETERS BOOLEAN PARAMETERS
------------------ ------------------
@ -83,6 +89,13 @@ EXAMPLES
echo 'user:alice:rwx' \ echo 'user:alice:rwx' \
| __acl /path/to/directory --source - | __acl /path/to/directory --source -
# create/change directory too
__acl /path/to/directory \
--default \
--remove \
--directory root:root:770 \
--entry user:nobody:rwx
AUTHORS AUTHORS
------- -------

11
cdist/conf/type/__acl/manifest Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh -e
for p in file directory
do
[ ! -f "$__object/parameter/$p" ] && continue
"__$p" "/$__object_id" \
--owner "$( awk -F: '{print $1}' "$__object/parameter/$p" )" \
--group "$( awk -F: '{print $2}' "$__object/parameter/$p" )" \
--mode "$( awk -F: '{print $3}' "$__object/parameter/$p" )"
done

View File

@ -1,3 +1,5 @@
mask mask
other other
source source
file
directory