forked from ungleich-public/cdist
[__clean_path] add --path parameter
This commit is contained in:
parent
955243a93b
commit
7c490a703d
4 changed files with 22 additions and 3 deletions
|
@ -18,7 +18,12 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
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…
Reference in a new issue