#!/usr/bin/python ''' Created on July 4, 2014 @author: Hovanes Egiyan ''' import os, sys import iocReboot from iocPortMap import * def iocGroupReboot( groupName ) : """ Function to reboot IOC Group with groupName """ if groupName in iocGroupMap : for iocName in iocGroupMap[ groupName ] : host = hostPortMap[iocName]["host"] port = hostPortMap[iocName]["port"] iocReboot.iocReboot( host, port ) else : print "WARNING: Group " + groupName + " does not exist" return if __name__ == '__main__': args = sys.argv[1:] # Make sure only one command line argument exists" if( len(args) != 1 ) : raise Exception( "Need one and only one string argument to specify the IOC Group" ) if args[0] == "all" or args[0] == "ALL" : for groupName in iocPortMap.iocGroupMap.keys() : iocGroupReboot( groupName ) else : groupName = args[0] print "Will reboot IOC group " + groupName iocGroupReboot( groupName )