Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 912003 Details for
Bug 1112695
pcs tracebacks when ocf resource provides invalid metadata xml
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
proposed fix
0001-Fixed-tracebacks-when-resource-agent-provides-an-inv.patch (text/plain), 4.33 KB, created by
Tomas Jelinek
on 2014-06-25 09:44:13 UTC
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Tomas Jelinek
Created:
2014-06-25 09:44:13 UTC
Size:
4.33 KB
patch
obsolete
>From 4a8cc016b008c898e5a52216e45ccc7fca352c8a Mon Sep 17 00:00:00 2001 >From: Tomas Jelinek <tojeline@redhat.com> >Date: Tue, 24 Jun 2014 16:01:53 +0200 >Subject: [PATCH] Fixed tracebacks when resource agent provides an invalid > metadata xml > >--- > pcs/resource.py | 4 ++-- > pcs/utils.py | 45 +++++++++++++++++++++++++++------------------ > 2 files changed, 29 insertions(+), 20 deletions(-) > >diff --git a/pcs/resource.py b/pcs/resource.py >index c499e80..7c3caa4 100644 >--- a/pcs/resource.py >+++ b/pcs/resource.py >@@ -278,8 +278,8 @@ def resource_list_options(resource): > indent = name.__len__() + 4 > desc = format_desc(indent, desc) > print " " + name + ": " + desc >- except xml.parsers.expat.ExpatError: >- utils.err ("Unable to parse xml for: %s" % (resource)) >+ except xml.parsers.expat.ExpatError as e: >+ utils.err("Unable to parse xml for '%s': %s" % (resource, e)) > > if not found_resource: > utils.err ("Unable to find resource: %s" % resource) >diff --git a/pcs/utils.py b/pcs/utils.py >index 8a15111..b3207ed 100644 >--- a/pcs/utils.py >+++ b/pcs/utils.py >@@ -730,18 +730,23 @@ def get_default_op_values(ra_type): > return [] > > return_list = [] >- root = ET.fromstring(metadata) >- actions = root.findall(".//actions/action") >- for action in actions: >- if action.attrib["name"] in allowable_operations: >- new_operation = [] >- new_operation.append(action.attrib["name"]) >- for attrib in action.attrib: >- value = action.attrib[attrib] >- if attrib == "name" or (attrib == "depth" and value == "0"): >- continue >- new_operation.append(attrib + "=" + value) >- return_list.append(new_operation) >+ try: >+ root = ET.fromstring(metadata) >+ actions = root.findall(".//actions/action") >+ for action in actions: >+ if action.attrib["name"] in allowable_operations: >+ new_operation = [] >+ new_operation.append(action.attrib["name"]) >+ for attrib in action.attrib: >+ value = action.attrib[attrib] >+ if attrib == "name" or (attrib == "depth" and value == "0"): >+ continue >+ new_operation.append(attrib + "=" + value) >+ return_list.append(new_operation) >+ except xml.parsers.expat.ExpatError as e: >+ err("Unable to parse xml for '%s': %s" % (ra_type, e)) >+ except xml.etree.ElementTree.ParseError as e: >+ err("Unable to parse xml for '%s': %s" % (ra_type, e)) > > return return_list > >@@ -1277,8 +1282,6 @@ def validInstanceAttributes(res_id, ra_values, resource_type): > if metadata == False: > err("Unable to find resource: ocf:%s:%s" % (resProvider, resType)) > >- root = ET.fromstring(metadata) >- actions = root.find("parameters") > missing_required_parameters = [] > valid_parameters = ["pcmk_host_list", "pcmk_host_map", "pcmk_host_check", "pcmk_host_argument", "pcmk_arg_map", "pcmk_list_cmd", "pcmk_status_cmd", "pcmk_monitor_cmd"] > valid_parameters = valid_parameters + ["stonith-timeout", "priority"] >@@ -1288,10 +1291,16 @@ def validInstanceAttributes(res_id, ra_values, resource_type): > valid_parameters.append("pcmk_" + a + "_timeout") > valid_parameters.append("pcmk_" + a + "_retries") > bad_parameters = [] >- for action in actions.findall("parameter"): >- valid_parameters.append(action.attrib["name"]) >- if "required" in action.attrib and action.attrib["required"] == "1": >- missing_required_parameters.append(action.attrib["name"]) >+ try: >+ actions = ET.fromstring(metadata).find("parameters") >+ for action in actions.findall("parameter"): >+ valid_parameters.append(action.attrib["name"]) >+ if "required" in action.attrib and action.attrib["required"] == "1": >+ missing_required_parameters.append(action.attrib["name"]) >+ except xml.parsers.expat.ExpatError as e: >+ err("Unable to parse xml for '%s': %s" % (resource_type, e)) >+ except xml.etree.ElementTree.ParseError as e: >+ err("Unable to parse xml for '%s': %s" % (resource_type, e)) > for key,value in ra_values: > if key not in valid_parameters: > bad_parameters.append(key) >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1112695
: 912003