2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Fix problem where plugins could be called twice for same data

If a plugin has a default and is also explicitly defined,
the pluginapi would call the code twice.  Correct this by avoiding
calling the default if specific info not specified already
This commit is contained in:
Jarrod Johnson 2014-01-29 17:44:41 -05:00
parent 55ef78fc64
commit 285b1df3a5

View File

@ -190,13 +190,15 @@ def handle_path(path, operation, configmanager, inputdata=None):
elif 'pluginattrs' in plugroute:
nodeattr = configmanager.get_node_attributes(
[node], plugroute['pluginattrs'])
foundplug = False
for attrname in plugroute['pluginattrs']:
if attrname in nodeattr[node]:
foundplug = True
passvalue = pluginmap[nodeattr[node][attrname]['value']].__dict__[operation](
nodes=(node,), element=pathcomponents,
configmanager=configmanager,
inputdata=inputdata)
if 'default' in plugroute:
if (not foundplug) and 'default' in plugroute:
passvalue = pluginmap[plugroute['default']].__dict__[operation](
nodes=(node,), element=pathcomponents, configmanager=configmanager,
inputdata=inputdata)