summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/drac/common.py
diff options
context:
space:
mode:
authorLucas Alvares Gomes <lucasagomes@gmail.com>2014-08-25 11:11:53 +0100
committerLucas Alvares Gomes <lucasagomes@gmail.com>2014-09-01 10:44:30 +0100
commit2eb3c12ce3fb2b2eb4408367f2c950724a098d93 (patch)
treeb7c3423ee96df67330445f4a4ae52e7e47021454 /ironic/drivers/modules/drac/common.py
parent49877f6bf78de5eb21b5f454c0d380d79885201d (diff)
downloadironic-2eb3c12ce3fb2b2eb4408367f2c950724a098d93.tar.gz
Implements the DRAC ManagementInterface for get/set boot device
What it says. The get_sensors_data() won't be implemented as part of this patch because it's outside the scope of the blueprint. Co-Authored-By: Imre Farkas <ifarkas@redhat.com> Implements blueprint drac-management-driver Change-Id: I9cae3156b6af016bfbf64cb3c117fdec8536f714
Diffstat (limited to 'ironic/drivers/modules/drac/common.py')
-rw-r--r--ironic/drivers/modules/drac/common.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ironic/drivers/modules/drac/common.py b/ironic/drivers/modules/drac/common.py
index a9ae83765..dedf89ea0 100644
--- a/ironic/drivers/modules/drac/common.py
+++ b/ironic/drivers/modules/drac/common.py
@@ -100,15 +100,20 @@ def get_wsman_client(node):
return client
-def find_xml(doc, item, namespace):
+def find_xml(doc, item, namespace, find_all=False):
"""Find the first or all elements in a ElementTree object.
:param doc: the element tree object.
:param item: the element name.
:param namespace: the namespace of the element.
- :returns: The element object or None if the element is not found.
+ :param find_all: Boolean value, if True find all elements, if False
+ find only the first one. Defaults to False.
+ :returns: The element object if find_all is False or a list of
+ element objects if find_all is True.
"""
query = ('.//{%(namespace)s}%(item)s' % {'namespace': namespace,
'item': item})
+ if find_all:
+ return doc.findall(query)
return doc.find(query)