From 62ac582b6182e26bd913bb14929f43e62d5a9be6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 22 Feb 2018 14:56:25 -0500 Subject: [PATCH] Provide better reseat error message on non-enclosure If a user were to try to reseat a node that isn't enclosure based or at least does not have the configuration, provide a clue as to what happened. --- .../confluent/plugins/hardwaremanagement/enclosure.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/enclosure.py b/confluent_server/confluent/plugins/hardwaremanagement/enclosure.py index f9c1003e..a7db7123 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/enclosure.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/enclosure.py @@ -19,8 +19,15 @@ def update(nodes, element, configmanager, inputdata): emebs = configmanager.get_node_attributes( nodes, (u'enclosure.manager', u'enclosure.bay')) for node in nodes: - em = emebs[node]['enclosure.manager']['value'] - eb = emebs[node]['enclosure.bay']['value'] + try: + em = emebs[node]['enclosure.manager']['value'] + eb = emebs[node]['enclosure.bay']['value'] + except KeyError: + yield msg.ConfluentNodeError( + node, + 'Reseat is only supported on servers in an enclosure, and ' + 'with enclosure.manager and enclosure.bay defined') + continue try: for rsp in core.handle_path( '/nodes/{0}/_enclosure/reseat_bay'.format(em),