2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-24 18:41:55 +00:00

Add concept of defaulting plugin

This commit is contained in:
Jarrod Johnson 2013-10-12 21:13:22 -04:00
parent 97d3eebff6
commit 53ce6f054c

View File

@ -60,9 +60,11 @@ nodeelements = {
},
'power/state': {
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
},
'boot/device': {
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
}
}
@ -71,7 +73,7 @@ def handle_path(path, operation, configmanager):
The plugins should generally return some sort of iterator.
An exception is made for console/session, which should return
a class with read(), write(bytes), and close()
a class with connect(), read(), write(bytes), and close()
'''
if (path.startswith("/node/") or path.startswith("/system/") or
# single node requests
@ -90,6 +92,9 @@ def handle_path(path, operation, configmanager):
return pluginmap[nodeattr[node][attrname]['value']].__dict__[operation](
nodes=(node,), element=element,
configmanager=configmanager)
if plugroute['default']:
return pluginmap[plugroute['default']].__dict__[operation](
nodes=(node,), element=element, configmanager=configmanager)