Merge branch '__update_alternatives_with_explorer' into 'master'

__update_alternatives: add state explorer

See merge request ungleich-public/cdist!848
This commit is contained in:
poljakowski 2020-02-19 14:51:48 +01:00
commit 44700424ba
2 changed files with 12 additions and 3 deletions

View File

@ -0,0 +1,8 @@
#!/bin/sh -e
path="$(cat "$__object/parameter/path")"
name="$__object_id"
link="$(readlink "/etc/alternatives/$name")"
if [ "$path" = "$link" ]
then echo present
else echo absent
fi

View File

@ -17,9 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Setup alternative - no standard way to create, always set
#
if [ "$(cat "$__object/explorer/state")" = 'present' ]
then exit 0
fi
path="$(cat "$__object/parameter/path")"
name="$__object_id"