#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` echo "setting up environment ..." export ROCON_CFG_FILE=$(pwd)/etc/rocon.conf # We do two loops of changes. On the second loop we add some extra fields after all hosts have been added. for LOOP in 1 2; do echo "this is loop #$LOOP" echo "initialising config file ..." mkdir -p etc > $ROCON_CFG_FILE echo "adding some hosts ..." rocon -A host1 rocon -A host2 rocon -A host3 rocon -A host4 if [ $LOOP = 2 ]; then sed -i 's/$/:extrafield1:extrafield2/' $ROCON_CFG_FILE fi rocon -r echo "adding a duplicate host ..." rocon -A host1 echo "deleting some hosts ..." rocon -D host4 rocon -r echo "deleting a non-existing host ..." rocon -D host5 echo "modifying all hosts with additional hostgroups ..." rocon -M +AllHosts 1 rocon -M +AllHosts2 1 rocon -M +AllHosts3 1 rocon -r echo "modifying all hosts with additional duplicate hostgroups (should silently ignore) ..." rocon -M +AllHosts 1 rocon -M +AllHosts2 1 rocon -M +AllHosts3 1 rocon -r echo "modifying all hosts with removal of hostgroups ..." # report after each removal so we can check commas correct rocon -M -AllHosts 1 rocon -r rocon -M -AllHosts2 1 rocon -r rocon -M -AllHosts3 1 rocon -r echo "modifying all hosts with removal of non-existent hostgroups (should silently ignore) ..." rocon -M -AllHosts 1 rocon -M -AllHosts2 1 rocon -M -AllHosts3 1 rocon -r done echo "all done"