From cff997bd0b663c577c21852d772b0966d2642a58 Mon Sep 17 00:00:00 2001 From: Juliana Motira Date: Wed, 22 Jul 2015 10:21:14 -0300 Subject: [PATCH] Adding IPMI user remove method Enabling IPMI user removing method and fixing json generation when href is a number. --- confluent_server/confluent/httpapi.py | 2 ++ confluent_server/confluent/messages.py | 2 +- .../confluent/plugins/hardwaremanagement/ipmi.py | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index f061b3f3..4c53a39e 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -515,6 +515,8 @@ def _assemble_json(responses, resource, url, extension): haldata = rsp.raw() for hk in haldata.iterkeys(): if 'href' in haldata[hk]: + if isinstance(haldata[hk]['href'], int): + haldata[hk]['href'] = str(haldata[hk]['href']) haldata[hk]['href'] += extension if hk in links: if isinstance(links[hk], list): diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index cdb221dd..981a7591 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -326,7 +326,7 @@ def get_input_message(path, operation, inputdata, nodes=None, multinode=False): elif path == ['events', 'hardware', 'decode']: return InputAlertData(path, inputdata, nodes) elif (path[:3] == ['configuration', 'management_controller', 'users'] and - operation != 'retrieve'): + operation != 'retrieve' and operation != 'delete'): return InputCredential(path, inputdata, nodes) elif inputdata: raise exc.InvalidArgumentException() diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 4a8f902b..943d9cd5 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -436,7 +436,7 @@ class IpmiHandler(object): privilege_level=user['privilege_level']) # A list of users for user in self.ipmicmd.get_users(channel=1): - self.output.put(msg.ChildCollection(user)) + self.output.put(msg.ChildCollection(user, candelete=True)) return elif len(self.element) == 4: user = int(self.element[-1]) @@ -700,3 +700,8 @@ def update(nodes, element, configmanager, inputdata): def retrieve(nodes, element, configmanager, inputdata): initthread() return perform_requests('read', nodes, element, configmanager, inputdata) + +def delete(nodes, element, configmanager, inputdata): + initthread() + return perform_requests( + 'delete', nodes, element, configmanager, inputdata)