Blob Blame History Raw
From 82f9be59e55c5e5fa01242fb7da59e3610da3674 Mon Sep 17 00:00:00 2001
From: Chris Feist <cfeist@redhat.com>
Date: Wed, 7 Oct 2015 09:11:43 -0500
Subject: [PATCH] Fixes for managing special cases of unmanaged resources

---
 pcs/resource.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pcs/resource.py b/pcs/resource.py
index e50e20b..7f2d4c3 100644
--- a/pcs/resource.py
+++ b/pcs/resource.py
@@ -2349,11 +2349,11 @@ def resource_manage(argv, set_managed):
             if retval != 0:
                 utils.err("error attempting to unmanage resource: %s" % output)
         else:
-            # Remove the meta attribute from the id specified
-            xpath = "(//primitive|//group|//clone|//master)[@id='"+resource+"']/meta_attributes/nvpair[@name='is-managed']"
+            # Remove the meta attribute from the id specified (and all children)
+            xpath = "(//primitive|//group|//clone|//master)[@id='"+resource+"']//meta_attributes/nvpair[@name='is-managed']"
             utils.run(["cibadmin", "-D", "--xpath", xpath])
             # Remove the meta attribute from the parent of the id specified, if the parent is a clone or master
-            xpath = "(//master|//clone)[primitive[contains(@id, '"+resource+"')]]/meta_attributes/nvpair[@name='is-managed']"
+            xpath = "(//master|//clone)[(group|primitive)[@id='"+resource+"']]/meta_attributes/nvpair[@name='is-managed']"
             utils.run(["cibadmin", "-D", "--xpath", xpath])
             if isGroup:
                 for res in res_to_manage:
-- 
2.4.3