diff --git a/bin/cdist-config b/bin/cdist-config index c63a0199..9ec1adac 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -67,7 +67,7 @@ __cdist_version="1.0.0" : ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type} # Used for IDs -__cdist_sane_regexp='[A-Za-z0-9]*[-A-Za-z0-9_]*' +__cdist_sane_regexp='[A-Za-z0-9/]*[-A-Za-z0-9_/]*' # Default remote user : ${__cdist_remote_user:=root} diff --git a/conf/manifest/init b/conf/manifest/init index 260fb490..16e27adf 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -6,6 +6,8 @@ echo "Running initial manifest for $__target_host" echo "We could access other manifests in $__manifest" +__file /etc/configured-via-cdist --type file + case "$__target_host" in localhost) __issue iddoesnotmatterhere diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index ca8f88a2..c7307f2b 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -28,9 +28,20 @@ type="$(cat "$__object/parameter/type")" if [ -f "$__object/parameter/destination" ]; then destination="$(cat "$__object/parameter/destination")" else - destination="$__object_id" + # If no destination has been supplied, the id is the destination + # Prepend /, which got lost in the object id (and relative paths + # don't make sense) + destination="/$__object_id" fi +# Ensure we have an absolute path +if ! $(echo "$destination" | grep -q ^/); then + echo "Error: Destination ($destination) of $__object_id is not absolute." >&2 + exit 1 +fi + +# FIXME: Add file copying part here + case "$type" in directory) echo mkdir \"$destination\"