diff -Nru crmsh-1.2.5+hg1034/debian/changelog crmsh-1.2.5+hg1034/debian/changelog --- crmsh-1.2.5+hg1034/debian/changelog 2014-03-07 07:42:40.000000000 -0300 +++ crmsh-1.2.5+hg1034/debian/changelog 2014-08-05 14:15:06.000000000 -0300 @@ -1,3 +1,9 @@ +crmsh (1.2.5+hg1034-1ubuntu4) trusty; urgency=medium + + * cibconf: repair configure load update (LP: #1353011). + + -- Rafael David Tinoco Tue, 05 Aug 2014 14:08:59 -0300 + crmsh (1.2.5+hg1034-1ubuntu3) trusty; urgency=medium * d/control: Add missing dependency on python-lxml (LP: #1289262). diff -Nru crmsh-1.2.5+hg1034/debian/patches/Medium-cibconf-repair-configure-load-update.patch crmsh-1.2.5+hg1034/debian/patches/Medium-cibconf-repair-configure-load-update.patch --- crmsh-1.2.5+hg1034/debian/patches/Medium-cibconf-repair-configure-load-update.patch 1969-12-31 21:00:00.000000000 -0300 +++ crmsh-1.2.5+hg1034/debian/patches/Medium-cibconf-repair-configure-load-update.patch 2014-08-08 13:24:30.000000000 -0300 @@ -0,0 +1,179 @@ +Description: [PATCH] Medium: cibconf: repair configure load update + +The save method has to be told not to remove objects on load +update (as in edit). + +The file testcase was updated to test better the load update +command. + +Origin: upstream, commit: b146349 +Author: Dejan Muhamedagic +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1353011 +Last-Update: 2014-08-08 + +* Fixes LP: #1353011 +--- + modules/cibconfig.py | 24 ++++++++++++++---------- + modules/ui.py | 6 +++--- + test/testcases/file | 4 ++-- + test/testcases/file.exp | 6 +++--- + 4 files changed, 22 insertions(+), 18 deletions(-) + +diff --git a/modules/cibconfig.py b/modules/cibconfig.py +index cbd0e35..4189ba6 100644 +--- a/modules/cibconfig.py ++++ b/modules/cibconfig.py +@@ -278,7 +278,7 @@ class CibObjectSet(object): + s = ''.join(f) + if f != sys.stdin: + f.close() +- return self.save(s) ++ return self.save(s, no_remove=True) + + def repr(self, format=format): + ''' +@@ -287,7 +287,7 @@ class CibObjectSet(object): + ''' + return '' + +- def save(self, s): ++ def save(self, s, no_remove=False): + ''' + For each object: + - try to find a corresponding object in obj_set +@@ -454,7 +454,7 @@ class CibObjectSetCli(CibObjectSet): + id = type + return id + +- def save(self, s): ++ def save(self, s, no_remove=False): + ''' + Save a user supplied cli format configuration. + On errors user is typically asked to review the +@@ -465,7 +465,8 @@ class CibObjectSetCli(CibObjectSet): + changes are made. + ''' + edit_d = {} +- id_set = set([]) ++ id_set = set() ++ del_set = set() + rc = True + err_buf.start_tmp_lineno() + cp = CliParser() +@@ -484,10 +485,11 @@ class CibObjectSetCli(CibObjectSet): + err_buf.stop_tmp_lineno() + # we can't proceed if there was a syntax error, but we + # can ask the user to fix problems +- rc &= self.is_edit_valid(id_set) ++ if not no_remove: ++ rc &= self.is_edit_valid(id_set) ++ del_set = self.obj_ids - id_set + if not rc: + return rc +- del_set = self.obj_ids - id_set + mk_set = id_set - self.obj_ids + upd_set = id_set & self.obj_ids + rc = cib_factory.set_update(edit_d, mk_set, upd_set, del_set) +@@ -519,7 +521,7 @@ class CibObjectSetRaw(CibObjectSet): + else: + return node.get("id") + +- def save(self, s): ++ def save(self, s, no_remove=False): + try: + cib_elem = etree.fromstring(s) + except etree.ParseError, msg: +@@ -529,7 +531,8 @@ class CibObjectSetRaw(CibObjectSet): + if not show_unrecognized_elems(cib_elem): + return False + rc = True +- id_set = set([]) ++ id_set = set() ++ del_set = set() + edit_d = {} + for node in get_top_cib_nodes(cib_elem, []): + id = self._get_id(node) +@@ -542,10 +545,11 @@ class CibObjectSetRaw(CibObjectSet): + rc = False + id_set.add(id) + edit_d[id] = node +- rc &= self.is_edit_valid(id_set) ++ if not no_remove: ++ rc &= self.is_edit_valid(id_set) ++ del_set = self.obj_ids - id_set + if not rc: + return rc +- del_set = self.obj_ids - id_set + mk_set = id_set - self.obj_ids + upd_set = id_set & self.obj_ids + rc = cib_factory.set_update(edit_d, mk_set, upd_set, del_set, "xml") +diff --git a/modules/ui.py b/modules/ui.py +index eff3b64..9d8478e 100644 +--- a/modules/ui.py ++++ b/modules/ui.py +@@ -734,7 +734,7 @@ class Template(UserInterface): + if not utils.ask("This operation will erase all changes. Do you want to proceed?"): + return False + cib_factory.erase() +- set_obj = mkset_obj("NOOBJ") ++ set_obj = mkset_obj() + rc = set_obj.import_file(tmp) + try: + os.unlink(tmp) +@@ -1825,9 +1825,9 @@ class CibConfig(UserInterface): + return False + cib_factory.erase() + if xml: +- set_obj = mkset_obj("xml", "NOOBJ") ++ set_obj = mkset_obj("xml") + else: +- set_obj = mkset_obj("NOOBJ") ++ set_obj = mkset_obj() + return set_obj.import_file(url) + + def graph(self, cmd, *args): +diff --git a/test/testcases/file b/test/testcases/file +index e739d67..9f6a470 100644 +--- a/test/testcases/file ++++ b/test/testcases/file +@@ -2,10 +2,10 @@ configure save sample.txt + %ext cat sample.txt + configure erase nodes + configure load replace sample.txt ++%ext sed -i 's/60s/2m/' sample.txt + session Load update + configure +-erase +-erase nodes ++delete m1 p1 + load update sample.txt + . + configure show +diff --git a/test/testcases/file.exp b/test/testcases/file.exp +index bf08c66..0755a26 100644 +--- a/test/testcases/file.exp ++++ b/test/testcases/file.exp +@@ -17,11 +17,11 @@ property $id="cib-bootstrap-options" \ + .EXT >/dev/null &1 + .TRY configure load replace sample.txt + .EXT >/dev/null &1 ++.EXT sed -i 's/60s/2m/' sample.txt + .TRY Load update + .EXT >/dev/null &1 + .INP: configure +-.INP: erase +-.INP: erase nodes ++.INP: delete m1 p1 + .INP: load update sample.txt + .TRY configure show + .EXT >/dev/null &1 +@@ -36,5 +36,5 @@ primitive st stonith:null \ + ms m1 p2 + clone c1 p1 + property $id="cib-bootstrap-options" \ +- default-action-timeout="60s" ++ default-action-timeout="2m" + .EXT rm sample.txt +-- +1.9.1 + diff -Nru crmsh-1.2.5+hg1034/debian/patches/series crmsh-1.2.5+hg1034/debian/patches/series --- crmsh-1.2.5+hg1034/debian/patches/series 1969-12-31 21:00:00.000000000 -0300 +++ crmsh-1.2.5+hg1034/debian/patches/series 2014-08-05 14:08:35.000000000 -0300 @@ -0,0 +1 @@ +Medium-cibconf-repair-configure-load-update.patch