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 897570 Details for
Bug 1099077
resource update on a clone ID returns error
[?]
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 code deduplication
0002-Deduplication-of-meta-attributes-update.patch (text/plain), 3.47 KB, created by
Tomas Jelinek
on 2014-05-20 13:01:03 UTC
(
hide
)
Description:
proposed code deduplication
Filename:
MIME Type:
Creator:
Tomas Jelinek
Created:
2014-05-20 13:01:03 UTC
Size:
3.47 KB
patch
obsolete
>From 8389f1ad1725bc3593d35b85e41d3de4e0cce904 Mon Sep 17 00:00:00 2001 >From: Tomas Jelinek <tojeline@redhat.com> >Date: Tue, 20 May 2014 14:16:12 +0200 >Subject: [PATCH 2/2] Deduplication of meta attributes update > >--- > pcs/resource.py | 48 ++++++++++++++++++------------------------------ > 1 file changed, 18 insertions(+), 30 deletions(-) > >diff --git a/pcs/resource.py b/pcs/resource.py >index 04d9bb0..30a7a06 100644 >--- a/pcs/resource.py >+++ b/pcs/resource.py >@@ -867,7 +867,16 @@ def resource_meta(res_id, argv): > else: > meta_attributes = meta_attributes[0] > >- meta_attrs = convert_args_to_tuples(argv) >+ update_meta_attributes( >+ meta_attributes, >+ convert_args_to_tuples(argv), >+ res_id + "-meta_attributes-" >+ ) >+ >+ utils.replace_cib_configuration(dom) >+ >+def update_meta_attributes(meta_attributes, meta_attrs, id_prefix): >+ dom = meta_attributes.ownerDocument > for (key,val) in meta_attrs: > meta_found = False > for ma in meta_attributes.getElementsByTagName("nvpair"): >@@ -880,12 +889,11 @@ def resource_meta(res_id, argv): > break > if not meta_found: > ma = dom.createElement("nvpair") >- ma.setAttribute("id", res_id + "-meta_attributes-" + key) >+ ma.setAttribute("id", id_prefix + key) > ma.setAttribute("name", key) > ma.setAttribute("value", val) > meta_attributes.appendChild(ma) >- >- utils.replace_cib_configuration(dom) >+ return meta_attributes > > # Takes in a resource id and an array of arrays with operation values starting > # with the operation name, followed by options >@@ -1093,20 +1101,7 @@ def resource_clone_create(argv, update = False, passed_dom = None): > meta.setAttribute("id",name + "-clone-meta") > clone.appendChild(meta) > >- args = convert_args_to_tuples(argv) >- for arg in args: >- if update: >- for nvpair in meta.getElementsByTagName("nvpair"): >- if nvpair.getAttribute("name") == arg[0]: >- meta.removeChild(nvpair) >- break >- if arg[1] == "": >- continue >- nvpair = dom.createElement("nvpair") >- nvpair.setAttribute("id", name+"-"+arg[0]) >- nvpair.setAttribute("name", arg[0]) >- nvpair.setAttribute("value", arg[1]) >- meta.appendChild(nvpair) >+ update_meta_attributes(meta, convert_args_to_tuples(argv), name + "-") > > if passed_dom: > return dom >@@ -1235,18 +1230,11 @@ def resource_master_create(argv, update=False, passed_dom = None): > meta.setAttribute("id", master_id + "-meta_attributes") > master_element.appendChild(meta) > >- for arg in convert_args_to_tuples(argv): >- for nvpair in meta.getElementsByTagName("nvpair"): >- if nvpair.getAttribute("name") == arg[0]: >- meta.removeChild(nvpair) >- break >- if arg[1] == "": >- continue >- nvpair = dom.createElement("nvpair") >- nvpair.setAttribute("id", meta.getAttribute("id") + "-" + arg[0]) >- nvpair.setAttribute("name", arg[0]) >- nvpair.setAttribute("value", arg[1]) >- meta.appendChild(nvpair) >+ update_meta_attributes( >+ meta, >+ convert_args_to_tuples(argv), >+ meta.getAttribute("id") + "-" >+ ) > if len(meta.getElementsByTagName("nvpair")) == 0: > master_element.removeChild(meta) > >-- >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 1099077
:
897569
| 897570 |
897573