Several updates:
- Implemented option to translate sitecode to domainname. - Added filter: Skip nodes if they are already in the target domain. - Several minor changes.
This commit is contained in:
parent
0632593675
commit
8d4021f122
5 changed files with 44 additions and 21 deletions
|
@ -3,7 +3,7 @@ class Filter(object):
|
|||
self.__args__ = args
|
||||
self.__filters__ = self.__getFilters()
|
||||
|
||||
def filterLocalGraphs(self, localGraphs):
|
||||
def filterLocalGraphs(self, domain, localGraphs):
|
||||
filteredGraphs = []
|
||||
for localGraph in localGraphs:
|
||||
if localGraph.isAutoupdaterEnabledOnAllNodes() == False:
|
||||
|
@ -21,8 +21,14 @@ class Filter(object):
|
|||
def __getFilters(self):
|
||||
return [] if self.__args__.filters == None else self.__args__.filters
|
||||
|
||||
def filterNodes(self, nodes):
|
||||
def filterNodes(self, domain, nodes):
|
||||
filteredNodes = []
|
||||
for node in nodes:
|
||||
if 'domain_transitions_only' in self.__filters__:
|
||||
try:
|
||||
if domain.name == node.domName:
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
filteredNodes.append(node)
|
||||
return filteredNodes
|
||||
|
|
|
@ -17,9 +17,9 @@ class NginxConfGen(object):
|
|||
|
||||
def __genDomain__(self, domain):
|
||||
nodes = {}
|
||||
for localGraph in self.__filter__.filterLocalGraphs(domain.localGraphs):
|
||||
for localGraph in self.__filter__.filterLocalGraphs(domain, domain.localGraphs):
|
||||
try:
|
||||
for node in self.__filter__.filterNodes(localGraph.getNodesWithNoDependencies()):
|
||||
for node in self.__filter__.filterNodes(domain, localGraph.getNodesWithNoDependencies()):
|
||||
nodes[node.nodeID] = {
|
||||
'hostname' : node.hostname,
|
||||
'ipv6_addresses' : node.publicIPv6Addresses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue