forked from ungleich-public/cdist
		
	switch from chars to sane_regexp
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								6704ae7cc1
							
						
					
				
			
			
				commit
				
					
						b9fa9d8b11
					
				
			
		
					 2 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -58,7 +58,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
 | 
				
			||||||
__cdist_bin_prefix="__"
 | 
					__cdist_bin_prefix="__"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Used for IDs
 | 
					# Used for IDs
 | 
				
			||||||
__cdist_sane_chars='[A-Za-z0-9_]'
 | 
					__cdist_sane_regexp='[A-Za-z0-9]*[-A-Za-z0-9_]*'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Used to mark file that created a specific type
 | 
					# Used to mark file that created a specific type
 | 
				
			||||||
__cdist_object_source=".source"
 | 
					__cdist_object_source=".source"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ echo "I am $__cdist_myname and have been called with $@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__cdist_id="$1"; shift
 | 
					__cdist_id="$1"; shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "$__cdist_id" | grep -q "^${__cdist_sane_chars}*\$" || __cdist_usage "Provide sane id, please"
 | 
					echo "$__cdist_id" | grep -q "^${__cdist_sane_regexp}\$" || __cdist_usage "Provide sane id, please"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__cdist_tid="${__cdist_myname}/${__cdist_id}"
 | 
					__cdist_tid="${__cdist_myname}/${__cdist_id}"
 | 
				
			||||||
__cdist_ddir="$(__cdist_cache_host)/${__cdist_tid}"
 | 
					__cdist_ddir="$(__cdist_cache_host)/${__cdist_tid}"
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ mkdir -p "${__cdist_ddir}"
 | 
				
			||||||
while [ $# -gt 0 ]; do
 | 
					while [ $# -gt 0 ]; do
 | 
				
			||||||
   opt="$1"; shift
 | 
					   opt="$1"; shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   echo "$opt" | grep -q "^--${__cdist_sane_chars}*\$" || __cdist_usage "Provide sane options"
 | 
					   echo "$opt" | grep -q "^--${__cdist_sane_regexp}\$" || __cdist_usage "Provide sane options"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   opt_file="$(echo $opt | sed 's/^--//')"
 | 
					   opt_file="$(echo $opt | sed 's/^--//')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue