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/>.
|
# 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
|
[ ! -d "$path" ] && exit 0
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,12 @@
|
||||||
|
|
||||||
[ ! -s "$__object/explorer/list" ] && exit 0
|
[ ! -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" )"
|
pattern="$( cat "$__object/parameter/pattern" )"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
Remove files and directories which match the pattern.
|
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.
|
Patterns are passed to ``find``'s ``-regex`` - see ``find(1)`` for more details.
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ pattern
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
path
|
||||||
|
Path which will be cleaned. Defaults to ``$__object_id``.
|
||||||
|
|
||||||
exclude
|
exclude
|
||||||
Pattern of files which are excluded from removal.
|
Pattern of files which are excluded from removal.
|
||||||
|
|
||||||
|
@ -46,6 +49,11 @@ EXAMPLES
|
||||||
--exclude '.+\(charset\.conf\|security\.conf\)' \
|
--exclude '.+\(charset\.conf\|security\.conf\)' \
|
||||||
--onchange 'service apache2 restart'
|
--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
|
AUTHORS
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
exclude
|
exclude
|
||||||
onchange
|
onchange
|
||||||
|
path
|
||||||
|
|
Loading…
Reference in a new issue