From: Ondrej Lichtner <olichtne(a)redhat.com>
The PerfRepo objects have the ability to be initialized from an XML
Element tree, corresponding to an XML response from the REST API.
However this feature causes a problem on RHEL 6 machines where only
Python 2.6 is available and the ElementTree API is different. Because of
this and the fact that we don't use this feature anywhere this patch
removes that functionality.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/PerfRepo.py | 40 +++++++++++++++-------------------------
1 file changed, 15 insertions(+), 25 deletions(-)
diff --git a/lnst/Controller/PerfRepo.py b/lnst/Controller/PerfRepo.py
index 3d2eed3..305a766 100644
--- a/lnst/Controller/PerfRepo.py
+++ b/lnst/Controller/PerfRepo.py
@@ -60,11 +60,9 @@ class PerfRepoTest(PerfRepoObject):
self._description = None
self._groupid = None
self._metrics = []
- elif type(xml) is StringType or isinstance(xml, Element):
- if type(xml) is StringType:
- root = ElementTree.fromstring(xml)
- else:
- root = xml
+ elif type(xml) is StringType:
+ root = ElementTree.fromstring(xml)
+
if root.tag != "test":
raise PerfRepoException("Invalid xml.")
@@ -171,11 +169,9 @@ class PerfRepoTestExecution(PerfRepoObject):
self._values = []
self._tags = []
self._parameters = []
- elif type(xml) is StringType or isinstance(xml, Element):
- if type(xml) is StringType:
- root = ElementTree.fromstring(xml)
- else:
- root = xml
+ elif type(xml) is StringType:
+ root = ElementTree.fromstring(xml)
+
if root.tag != "testExecution":
raise PerfRepoException("Invalid xml.")
@@ -340,11 +336,9 @@ class PerfRepoValue(PerfRepoObject):
self._metricName = None
self._result = None
self._parameters = []
- elif type(xml) is StringType or isinstance(xml, Element):
- if type(xml) is StringType:
- root = ElementTree.fromstring(xml)
- else:
- root = xml
+ elif type(xml) is StringType:
+ root = ElementTree.fromstring(xml)
+
if root.tag != "value":
raise PerfRepoException("Invalid xml.")
@@ -420,11 +414,9 @@ class PerfRepoMetric(PerfRepoObject):
self._name = None
self._description = None
self._comparator = None
- elif type(xml) is StringType or isinstance(xml, Element):
- if type(xml) is StringType:
- root = ElementTree.fromstring(xml)
- else:
- root = xml
+ elif type(xml) is StringType:
+ root = ElementTree.fromstring(xml)
+
if root.tag != "metric":
raise PerfRepoException("Invalid xml.")
@@ -493,11 +485,9 @@ class PerfRepoReport(PerfRepoObject):
self._name = None
self._type = None
self._properties = {}
- elif type(xml) is StringType or isinstance(xml, Element):
- if type(xml) is StringType:
- root = ElementTree.fromstring(xml)
- else:
- root = xml
+ elif type(xml) is StringType:
+ root = ElementTree.fromstring(xml)
+
if root.tag != "report":
raise PerfRepoException("Invalid xml.")
--
2.6.2