#!/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.1.0
OF="plugin-saltminionsstatus.txt"

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"
log_entry $OF "Supportconfig Plugin for SaltStack, v${SVER}"

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