From: Ondrej Lichtner olichtne@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@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.")
From: Ondrej Lichtner olichtne@redhat.com
The log message contained an undefined variable because of a copy paste error. This patch fixes the problem.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/PerfRepo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/PerfRepo.py b/lnst/Controller/PerfRepo.py index 305a766..6f9c439 100644 --- a/lnst/Controller/PerfRepo.py +++ b/lnst/Controller/PerfRepo.py @@ -881,7 +881,7 @@ class PerfRepoRESTAPI(object): metric.set_id(new_id) if log: logging.debug("POST %s success" % post_url) - logging.info("Obj url: %s" % self.get_obj_url(test)) + logging.info("Obj url: %s" % self.get_obj_url(metric)) return metric
def test_delete(self, test_id, log=True):
Fri, Oct 30, 2015 at 12:49:50PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@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@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
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
Ack to series.
Acked-by: Jan Tluka jtluka@redhat.com
Scratch this patchset, I sent a new, better, one. We do use this functionality as i have discovered.
On Fri, Oct 30, 2015 at 12:58:50PM +0100, Jan Tluka wrote:
Fri, Oct 30, 2015 at 12:49:50PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@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@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
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
Ack to series.
Acked-by: Jan Tluka jtluka@redhat.com
lnst-developers@lists.fedorahosted.org