Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2014-06-06 14:36:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2014-06-05 
10:50:09.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2014-06-06 
14:36:43.000000000 +0200
@@ -1,0 +2,6 @@
+Thu Jun  5 09:28:05 UTC 2014 - kgronl...@suse.com
+
+- high: cibconfig: Fix bug in copy_nvpairs (bnc#881369)
+- upstream: 2.0.0-111-gf36401b 
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.126CpM/_old  2014-06-06 14:36:44.000000000 +0200
+++ /var/tmp/diff_new_pack.126CpM/_new  2014-06-06 14:36:44.000000000 +0200
@@ -41,7 +41,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0+
 Group:          %{pkg_group}
-Version:        2.0+git109
+Version:        2.0+git111
 Release:        %{?crmsh_release}%{?dist}
 Url:            http://crmsh.github.io
 Source0:        crmsh.tar.bz2

++++++ crmsh.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/modules/cibconfig.py 
new/crmsh/modules/cibconfig.py
--- old/crmsh/modules/cibconfig.py      2014-06-03 22:39:19.000000000 +0200
+++ new/crmsh/modules/cibconfig.py      2014-06-05 11:15:01.000000000 +0200
@@ -185,6 +185,28 @@
     return fill_nvpairs(name, node, attrs, id_hint)
 
 
+def copy_nvpair(nvpairs, nvp, id_hint=None):
+    """
+    Copies the given nvpair into the given tag containing nvpairs
+    """
+    common_debug("copy_nvpair: %s" % (etree.tostring(nvp)))
+    if 'value' not in nvp.attrib:
+        nvpairs.append(copy.deepcopy(nvp))
+        return
+    n = nvp.get('name')
+    if id_hint is None:
+        id_hint = n
+    for nvp2 in nvpairs:
+        if nvp2.get('name') == n:
+            nvp2.set('value', nvp.get('value'))
+            break
+    else:
+        m = copy.deepcopy(nvp)
+        nvpairs.append(m)
+        if 'id' not in m.attrib:
+            m.set('id', idmgmt.new(m, id_hint))
+
+
 def copy_nvpairs(tonode, fromnode):
     """
     copy nvpairs from fromnode to tonode.
@@ -197,21 +219,6 @@
         else:
             tonode.append(copy.deepcopy(cnode))
 
-    def copy_nvpair(nvp):
-        if 'value' not in nvp:
-            tonode.append(copy.deepcopy(nvp))
-            return
-        n = nvp.get('name')
-        for nvp2 in tonode:
-            if nvp2.get('name') == n:
-                nvp2.set('value', nvp.get('value'))
-                break
-        else:
-            m = copy.deepcopy(nvp)
-            tonode.append(m)
-            if 'id' not in m.attrib:
-                m.set('id', idmgmt.new(m, id_hint))
-
     def copy_id(node):
         nid = node.get('id')
         for nvp2 in tonode:
@@ -221,13 +228,13 @@
         else:
             tonode.append(copy.deepcopy(node))
 
-    common_debug("copy_nvpairs: %s" % (etree.tostring(fromnode)))
+    common_debug("copy_nvpairs: %s -> %s" % (etree.tostring(fromnode), 
etree.tostring(tonode)))
     id_hint = tonode.get('id')
     for c in fromnode:
         if is_comment(c):
             copy_comment(c)
         elif c.tag == "nvpair":
-            copy_nvpair(c)
+            copy_nvpair(tonode, c, id_hint=id_hint)
         elif 'id' in c.attrib:  # ok, it has an id, we can work with this
             copy_id(c)
         else:  # no idea what this is, just copy it
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/test/testcases/edit.exp 
new/crmsh/test/testcases/edit.exp
--- old/crmsh/test/testcases/edit.exp   2014-06-03 22:39:19.000000000 +0200
+++ new/crmsh/test/testcases/edit.exp   2014-06-05 11:15:01.000000000 +0200
@@ -120,9 +120,6 @@
 .TRY configure filter 'sed "s/stonith-enabled=true//"'
 .EXT crm_resource --list-standards
 .EXT crm_resource --list-ocf-alternatives Dummy
-.EXT crm_resource --show-metadata ocf:heartbeat:Dummy
-.EXT crm_resource --show-metadata stonith:heartbeat:null
-.EXT stonithd metadata
 .EXT crmd metadata
 .EXT pengine metadata
 .EXT cib metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/test/unittests/test_bugs.py 
new/crmsh/test/unittests/test_bugs.py
--- old/crmsh/test/unittests/test_bugs.py       2014-06-03 22:39:19.000000000 
+0200
+++ new/crmsh/test/unittests/test_bugs.py       2014-06-05 11:15:01.000000000 
+0200
@@ -270,3 +270,31 @@
     obj3 = factory.create_object('group', 'g2', 'p1')
     print obj3
     assert obj3 is False
+
+
+def test_copy_nvpairs():
+    from cibconfig import copy_nvpairs
+
+    to = etree.fromstring('''
+    <node>
+    <nvpair name="stonith-enabled" value="true"/>
+    </node>
+    ''')
+    copy_nvpairs(to, etree.fromstring('''
+    <node>
+    <nvpair name="stonith-enabled" value="false"/>
+    </node>
+    '''))
+
+    eq_(['stonith-enabled'], to.xpath('./nvpair/@name'))
+    eq_(['false'], to.xpath('./nvpair/@value'))
+
+    copy_nvpairs(to, etree.fromstring('''
+    <node>
+    <nvpair name="stonith-enabled" value="true"/>
+    </node>
+    '''))
+
+    eq_(['stonith-enabled'], to.xpath('./nvpair/@name'))
+    eq_(['true'], to.xpath('./nvpair/@value'))
+

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to