mirror of
https://github.com/xcat2/confluent.git
synced 2025-08-26 05:00:46 +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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user