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

Merge pull request #13 from jufm/master

Changing LEDs structure
This commit is contained in:
Jarrod Johnson 2015-08-24 13:53:12 -04:00
commit 455feb867d
3 changed files with 17 additions and 11 deletions

View File

@ -208,11 +208,11 @@ noderesources = {
}),
},
'led': {
'all': PluginRoute({
'all': PluginCollection({
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
})
}
},
},
}

View File

@ -829,12 +829,10 @@ class LEDStatus(ConfluentMessage):
self.notnode = name is None
self.desc = 'led status'
self.kvpairs = {}
for led_category in data:
self.kvpairs[led_category] = [data[led_category]]
if not self.notnode:
self.kvpairs = {name: self.kvpairs}
if self.notnode:
self.kvpairs = {'leds':data}
else:
self.kvpairs = {name: {'leds':data}}
class NetworkConfiguration(ConfluentMessage):

View File

@ -595,9 +595,15 @@ class IpmiHandler(object):
raise Exception('Unsupported scenario...')
def list_leds(self):
led_categories = {}
for category, leds in self.ipmicmd.get_leds():
led_categories[category] = leds
self.output.put(msg.ChildCollection('all'))
for category, info in self.ipmicmd.get_leds():
self.output.put(msg.ChildCollection(simplify_name(category)))
def read_leds(self, component):
led_categories = []
for category, info in self.ipmicmd.get_leds():
if component == 'all' or component == simplify_name(category):
led_categories.append({category: info})
self.output.put(msg.LEDStatus(led_categories, self.node))
def read_inventory(self, component):
@ -639,6 +645,8 @@ class IpmiHandler(object):
return self.list_sensors()
elif len(self.element) == 3 and self.element[-2] == 'led':
return self.list_leds()
elif len(self.element) == 4 and self.element[1] == 'led':
return self.read_leds(self.element[-1])
elif len(self.element) == 4: # resource requested
return self.read_sensors(self.element[-1])