#!/bin/bash
#############################################################
# Name:        Supportconfig Plugin for Salt
# Description: Gathers minions status
# License:     GPLv2
# Author:      Bo Maryniuk <bo@suse.de>
# Written:     2016 Oct 28
#############################################################

SVER=0.0.1

for RCFILE in $(ls /usr/lib/supportconfig/resources/*.rc); do
    [ -s $RCFILE ] && . $RCFILE || { echo "ERROR: Initializing resource file: $RCFILE"; exit 1; }
done

check_packages_failhard "salt" "salt-master"
section_header "Supportconfig Plugin for SaltStack, v${SVER}"

# List of what minions are actually present according to the master
plugin_command "salt-run manage.list_state"
# ...and the opposite
plugin_command "salt-run manage.list_not_state"
# Joined minions
plugin_command "salt-run manage.joined"
