2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-24 10:30:22 +00:00

Add blink and identify reporting to redfish

This commit is contained in:
Jarrod Johnson 2019-08-05 16:22:50 -04:00
parent 4dab5fc527
commit c3176ab86a
6 changed files with 12 additions and 9 deletions

View File

@ -31,7 +31,7 @@ if path.startswith('/opt'):
import confluent.client as client
argparser = optparse.OptionParser(usage="Usage: %prog <noderange> [on|off]")
argparser = optparse.OptionParser(usage="Usage: %prog <noderange> [on|off|blink]")
(options, args) = argparser.parse_args()
try:
noderange = args[0]
@ -42,9 +42,6 @@ client.check_globbing(noderange)
identifystate = None
if len(sys.argv) > 2:
identifystate = sys.argv[2]
else:
argparser.print_help()
sys.exit(1)
session = client.Command()
exitcode = 0
sys.exit(

View File

@ -84,7 +84,7 @@ function _confluent_generic_completion()
}
_confluent_nodeidentify_completion()
{
COMP_CANDIDATES=("on,off -h")
COMP_CANDIDATES=("on,off,blink -h")
_confluent_generic_completion
}

View File

@ -3,7 +3,7 @@ nodeidentify(8) -- Control the identify LED of confluent nodes
## SYNOPSIS
`nodidentify <noderange> [on|off]`
`nodidentify <noderange> [on|off|blink]`
## DESCRIPTION
@ -13,6 +13,7 @@ options are supported:
* `on`: Turn on the identify LED
* `off`: Turn off the identify LED
* `blink`: Set the identify LED to blink (when supported by the system)
## EXAMPLES:

View File

@ -822,6 +822,7 @@ class InputIdentifyMessage(ConfluentInputMessage):
valid_values = set([
'on',
'off',
'blink',
])
keyname = 'identify'

View File

@ -1296,6 +1296,9 @@ class IpmiHandler(object):
def identify(self):
if 'update' == self.op:
identifystate = self.inputdata.inputbynode[self.node] == 'on'
if self.inputdata.inputbynode[self.node] == 'blink':
raise exc.InvalidArgumentException(
'"blink" is not supported with ipmi')
self.ipmicmd.set_identify(on=identifystate)
self.output.put(msg.IdentifyState(
node=self.node, state=self.inputdata.inputbynode[self.node]))

View File

@ -1163,13 +1163,14 @@ class IpmiHandler(object):
def identify(self):
if 'update' == self.op:
identifystate = self.inputdata.inputbynode[self.node] == 'on'
self.ipmicmd.set_identify(on=identifystate)
blinkstate = self.inputdata.inputbynode[self.node] == 'blink'
self.ipmicmd.set_identify(on=identifystate, blink=blinkstate)
self.output.put(msg.IdentifyState(
node=self.node, state=self.inputdata.inputbynode[self.node]))
return
elif 'read' == self.op:
# ipmi has identify as read-only for now
self.output.put(msg.IdentifyState(node=self.node, state=''))
identify = self.ipmicmd.get_identify().get('identifystate', '')
self.output.put(msg.IdentifyState(node=self.node, state=identify))
return
def power(self):