File 0015-medium-ui_cluster-Add-force-to-ha-cluster-remove-bsc.patch of Package crmsh
From a2d241d90164946e0740c791d8d1bb2ef66d22db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Tue, 13 Jun 2017 14:51:56 +0200
Subject: [PATCH 15/16] medium: ui_cluster: Add --force to ha-cluster-remove
(bsc#1044071)
---
crmsh/bootstrap.py | 5 +++--
crmsh/ui_cluster.py | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/crmsh/bootstrap.py b/crmsh/bootstrap.py
index 3d648539..2fcd55b6 100644
--- a/crmsh/bootstrap.py
+++ b/crmsh/bootstrap.py
@@ -1551,11 +1551,12 @@ def bootstrap_join(cluster_node=None, nic=None, quiet=False, yes_to_all=False, w
status("Done (log saved to %s)" % (LOG_FILE))
-def bootstrap_remove(cluster_node=None, quiet=False, yes_to_all=False):
+def bootstrap_remove(cluster_node=None, quiet=False, yes_to_all=False, force=False):
"""
-c <cluster-node> - node to remove from cluster
-q - quiet
-y - yes to all
+ -f - force removal of self
"""
global _context
_context = Context(quiet=quiet, yes_to_all=yes_to_all)
@@ -1573,7 +1574,7 @@ def bootstrap_remove(cluster_node=None, quiet=False, yes_to_all=False):
init()
remove_ssh()
if remove_localhost_check():
- if not config.core.force:
+ if not config.core.force and not force:
error("Removing self requires --force")
# get list of cluster nodes
me = utils.this_node()
diff --git a/crmsh/ui_cluster.py b/crmsh/ui_cluster.py
index 96166713..9be66522 100644
--- a/crmsh/ui_cluster.py
+++ b/crmsh/ui_cluster.py
@@ -288,6 +288,7 @@ If stage is not specified, each stage will be invoked in sequence.
parser.add_option("-q", "--quiet", help="Be quiet (don't describe what's happening, just do it)", action="store_true", dest="quiet")
parser.add_option("-y", "--yes", help='Answer "yes" to all prompts (use with caution)', action="store_true", dest="yes_to_all")
parser.add_option("-c", "--cluster-node", dest="cluster_node", help="IP address or hostname of cluster node which will be deleted", metavar="HOST")
+ parser.add_option("-F", "--force", dest="force", help="Remove current node", action="store_true")
options, args = parser.parse_args(list(args))
if options.cluster_node is not None and options.cluster_node not in args:
@@ -302,7 +303,8 @@ If stage is not specified, each stage will be invoked in sequence.
bootstrap.bootstrap_remove(
cluster_node=node,
quiet=options.quiet,
- yes_to_all=options.yes_to_all)
+ yes_to_all=options.yes_to_all,
+ force=options.force)
return True
def _parse_clustermap(self, clusters):
--
2.12.2