diff --git a/tsshbatch.py b/tsshbatch.py index b9c9903..8122a6e 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.202 2014/12/04 22:51:52 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.203 2014/12/04 23:11:50 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" PROGDATE = "2011-2014" @@ -786,18 +786,8 @@ # are understood to form the command. else: - - # First, do variable substitution on passed hosts - - for index in range(len(Hosts)): - Hosts[index] = VarSub(Hosts[index]) - - # Now save the command command = " ".join(args[0:]) - - - # Put it in a list data structure because this is what the # HostCommands() function expects. This is necessary to handle multi # command input from from a file. @@ -927,6 +917,14 @@ Commands[index] = VarSub(Commands[index]) index += 1 + # Dereference any variables in the list of hosts + + index = 0 + while (index < len(Hosts)): + + Hosts[index] = VarSub(Hosts[index]) + index += 1 + for prompt, description, items in ((TESTRUN, " ".join(OPTIONS), ["\n"]), (SYMTABLE, "", symtbl + ["\n"]), (HOSTLIST, "", Hosts + ["\n"]), @@ -979,6 +977,10 @@ if symbol not in protected: SymbolTable[symbol] = value + # Apply any relevant variable dereferencing + + host = VarSub(host) + if Get_Transfer_List: HostFileTransfer(host, UNAME, PWORD, Get_Transfer_List, GET=True)