Sha256: 94d599face9289d92fea47ee20366f797ba1e2be9fa68342843ecfd5b6e86625

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

#!/bin/bash

no_check=false
case "$1" in
--no-check)
        no_check=true
        shift
        ;;
esac
runit()
{
	case "$#" in
	0)
		echo "Running all states ..."
		sudo salt-call saltutil.sync_all
		sudo salt-call --retcode-passthrough state.highstate 
		ret=$?
		echo "exit status: $ret"
		;;
	*)
		for file; do
			echo "Running $file ..."
			sudo salt-call --retcode-passthrough state.sls "$file"
			ret=$?
			echo "exit status: $ret"
		done
		;;
	esac
}
case "$1" in
run)
        ret=
	shift
        if $no_check; then
                # Color is used when there is no checking (piped output)
                runit "$@"
                exit $ret
        fi
        runit "$@" 2>&1 | tee /tmp/t$$
        echo
        echo Checking results log:
        if egrep '^\[ERROR *\]' /tmp/t$$; then
                echo ERROR: `egrep '^\[ERROR *\]' /tmp/t$$ | wc -l` ERRORS FOUND IN LOG
                ret=1
        fi
        if egrep '^ *Result: *False' /tmp/t$$ > /dev/null; then
                echo 'WARNING (' `egrep '^ *Result: *False' /tmp/t$$ | wc -l` 'Results where False in log)'
                ret=${ret:-2}
        fi
        if [ -z "$ret" ] ; then
                echo SUCCESS
        fi
        rm -f /tmp/t$$
        exit $ret

	;;
grains)
	sudo salt-call grains.items
	;;
pillar)
	sudo salt-call pillar.items
	;;
packages)
	dpkg --get-selections | sed -n 's/\s\s*install//p'
	;;
search)
        aptitude search "$@"
        #apt-cache search "$@"
        ;;
install|remove|purge|update|upgrade|clean|autoremove)
	sudo apt-get "$@"
	;;
*)
	echo "usage: $0 grains|pillar|run [state]|packages|search|install package|remove package|purge package|autoclean|autoremove\n"
	;;
esac
		

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
salted-rails-0.0.9 salt/bin/provision