2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-14 01:29:23 +00:00

Implement a nicer nodereseat unsupported command

This carries the error condition cleanly back to the command line.
This commit is contained in:
Jarrod Johnson 2017-11-28 13:42:21 -05:00
parent 16297b048f
commit 2c5432454a
2 changed files with 17 additions and 7 deletions

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import confluent.core as core
import confluent.messages as msg
import pyghmi.exceptions as pygexc
def update(nodes, element, configmanager, inputdata):
emebs = configmanager.get_node_attributes(
@ -19,8 +21,11 @@ def update(nodes, element, configmanager, inputdata):
for node in nodes:
em = emebs[node]['enclosure.manager']['value']
eb = emebs[node]['enclosure.bay']['value']
for rsp in core.handle_path(
'/nodes/{0}/_enclosure/reseat_bay'.format(em),
'update', configmanager,
inputdata={'reseat': int(eb)}):
yield rsp
try:
for rsp in core.handle_path(
'/nodes/{0}/_enclosure/reseat_bay'.format(em),
'update', configmanager,
inputdata={'reseat': int(eb)}):
yield rsp
except pygexc.UnsupportedFunctionality as uf:
yield msg.ConfluentNodeError(node, str(uf))

View File

@ -317,6 +317,8 @@ def perform_requests(operator, nodes, element, cfg, inputdata):
datum = resultdata.get(timeout=10)
while datum:
if datum != 'Done':
if isinstance(datum, Exception):
raise datum
yield datum
datum = resultdata.get_nowait()
except queue.Empty:
@ -824,8 +826,11 @@ class IpmiHandler(object):
def reseat_bay(self):
bay = self.inputdata.inputbynode[self.node]
self.ipmicmd.reseat_bay(bay)
self.output.put(msg.ReseatResult(self.node, 'success'))
try:
self.ipmicmd.reseat_bay(bay)
self.output.put(msg.ReseatResult(self.node, 'success'))
except pygexc.UnsupportedFunctionality as uf:
self.output.put(uf)
def bootdevice(self):
if 'read' == self.op: