diff options
author | sienkiew <sienkiew@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-06-28 16:50:12 -0400 |
---|---|---|
committer | sienkiew <sienkiew@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-06-28 16:50:12 -0400 |
commit | a25f7354195b3019df5c93a6a12000ceb0233ae0 (patch) | |
tree | 77241f03adea6b2c5b80199272aa68ee0a884d8e | |
parent | d301d803efda759cd03b01e7bc9afc454d39cae2 (diff) | |
download | steuermann-a25f7354195b3019df5c93a6a12000ceb0233ae0.tar.gz |
debug off, use sets for hostgroups
git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@734 d34015c8-bcbb-4646-8ac8-8ba5febf221d
-rw-r--r-- | steuermann/nodes.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/steuermann/nodes.py b/steuermann/nodes.py index bd273bf..23f5d0b 100644 --- a/steuermann/nodes.py +++ b/steuermann/nodes.py @@ -39,17 +39,17 @@ class command_tree(object): # before is the predecessor, after comes "AFTER before" for before, after, required, pos in self.node_order : if ( '*' in before ) or ( '?' in before ) or ( '[' in before ) or ( '@' in before ): - print "CONNECTING %-50s %-50s"%(before, after) + # print "CONNECTING %-50s %-50s"%(before, after) for x in self.node_index : if wildcard_name( wild=before, name=x ) : - print " found",x + # print " found",x # yes, the wild card matches this one; connect them # (but don't let a node come before itself because the wild card is too loose) if x != after : self.connect(x, after, required, pos) else : - print "CONNECTING %-50s %-50s"%(before, after) - print " found",after + # print "CONNECTING %-50s %-50s"%(before, after) + # print " found",after self.connect(before, after, required, pos) # Work out the depths of each node. @@ -80,7 +80,7 @@ class command_tree(object): # create a set of nodes for a particular command - called from within the parser def add_command_list( self, table, hostlist, command_list ) : - for host in hostlist : + for host in set(hostlist) : this_table = '%s:%s' % ( host, table ) for command, script, script_type, after_clause, pos in command_list : # this happens once for each CMD clause @@ -329,15 +329,15 @@ def read_file_list( file_list ) : imported = { } while len(file_list) > 0 : - print "START",file_list + # print "START",file_list # first name off the list current_file_name = file_list[0] file_list = file_list[1:] - print "LIST",file_list + # print "LIST",file_list # see if it imported already if current_file_name in imported : - print "SKIP",current_file_name + # print "SKIP",current_file_name continue imported[current_file_name] = 1 @@ -352,14 +352,12 @@ def read_file_list( file_list ) : file_list += di.import_list di.import_list = [ ] - print "END",file_list - di.finish() return di ##### -saved_conditions = { } +saved_conditions = { 'True' : True, 'False' : False } def declare_conditions( text, filename ) : # the parameter "text" is the token that begins "CONDITION\n" @@ -397,15 +395,15 @@ hostgroups = { } def define_hostgroup( name ) : if not name in hostgroups : - hostgroups[name] = [ ] + hostgroups[name] = set( ) def add_hostgroup( name, host ) : if host.startswith('@') : new = get_hostgroup(host) else : - new = [ host ] + new = set( [ host ] ) - hostgroups[name] = hostgroups[name] + new + hostgroups[name] |= new def get_hostgroup( name ) : return hostgroups[name] |