forked from ungleich-public/cdist
		
	Allow ids to contain slashes
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								91127357e7
							
						
					
				
			
			
				commit
				
					
						45429c2ca0
					
				
			
		
					 3 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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\"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue