replace __cdist_type_has_explorer with __cdist_dir_listing
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
e9fe915519
commit
29e029a2eb
3 changed files with 31 additions and 10 deletions
|
@ -330,15 +330,6 @@ __cdist_type_from_object()
|
|||
echo "${1%%/*}"
|
||||
}
|
||||
|
||||
__cdist_type_has_explorer()
|
||||
{
|
||||
# We only create output, if there's at least one explorer
|
||||
# and can thus be used as a boolean ;-)
|
||||
if [ -d "$(__cdist_type_explorer_dir "$1")" ]; then
|
||||
ls -1 "$(__cdist_type_explorer_dir "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
__cdist_type_explorer_pushed()
|
||||
{
|
||||
[ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \
|
||||
|
|
30
core/__cdist_dir_listing
Executable file
30
core/__cdist_dir_listing
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# List files in a directory, if it exists
|
||||
#
|
||||
# We only create output, if there's at least one entry
|
||||
# and can thus be used as a boolean ;-)
|
||||
#
|
||||
|
||||
__cdist_dir_listing()
|
||||
{
|
||||
[ -d "$1" ] && ls -1 "$1"
|
||||
}
|
|
@ -30,7 +30,7 @@ __cdist_object_explorer_run()
|
|||
__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
__cdist_has_explorer="$(__cdist_dir_listing "$(__cdist_type_explorer_dir "$__cdist_type")")"
|
||||
# Run the type explorers for the current object if any
|
||||
if [ "$__cdist_has_explorer" ]; then
|
||||
if ! __cdist_type_explorer_pushed "$__cdist_type"; then
|
||||
|
|
Loading…
Reference in a new issue