forked from ungleich-public/cdist
		
	Merge branch '__clean_path_add_path_param' into 'master'
[__clean_path] add --path parameter See merge request ungleich-public/cdist!889
This commit is contained in:
		
				commit
				
					
						b22e09e1af
					
				
			
		
					 4 changed files with 22 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -18,7 +18,12 @@
 | 
			
		|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
path="/$__object_id"
 | 
			
		||||
if [ -f "$__object/parameter/path" ]
 | 
			
		||||
then
 | 
			
		||||
    path="$( cat "$__object/parameter/path" )"
 | 
			
		||||
else
 | 
			
		||||
    path="/$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
[ ! -d "$path" ] && exit 0
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,12 @@
 | 
			
		|||
 | 
			
		||||
[ ! -s "$__object/explorer/list" ] && exit 0
 | 
			
		||||
 | 
			
		||||
path="/$__object_id"
 | 
			
		||||
if [ -f "$__object/parameter/path" ]
 | 
			
		||||
then
 | 
			
		||||
    path="$( cat "$__object/parameter/path" )"
 | 
			
		||||
else
 | 
			
		||||
    path="/$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
pattern="$( cat "$__object/parameter/pattern" )"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ DESCRIPTION
 | 
			
		|||
-----------
 | 
			
		||||
Remove files and directories which match the pattern.
 | 
			
		||||
 | 
			
		||||
Provided path (as __object_id) must be a directory.
 | 
			
		||||
Provided path must be a directory.
 | 
			
		||||
 | 
			
		||||
Patterns are passed to ``find``'s ``-regex`` - see ``find(1)`` for more details.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +29,9 @@ pattern
 | 
			
		|||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
path
 | 
			
		||||
   Path which will be cleaned. Defaults to ``$__object_id``.
 | 
			
		||||
 | 
			
		||||
exclude
 | 
			
		||||
   Pattern of files which are excluded from removal.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +49,11 @@ EXAMPLES
 | 
			
		|||
        --exclude '.+\(charset\.conf\|security\.conf\)' \
 | 
			
		||||
        --onchange 'service apache2 restart'
 | 
			
		||||
 | 
			
		||||
    __clean_path apache2-conf-enabled \
 | 
			
		||||
        --path /etc/apache2/conf-enabled \
 | 
			
		||||
        --pattern '.+' \
 | 
			
		||||
        --exclude '.+\(charset\.conf\|security\.conf\)' \
 | 
			
		||||
        --onchange 'service apache2 restart'
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
exclude
 | 
			
		||||
onchange
 | 
			
		||||
path
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue