From 322ac90cf143100aef33a46ac2ef923251db9389 Mon Sep 17 00:00:00 2001 From: xin liang Date: Fri, 31 May 2024 17:18:10 +0800 Subject: [PATCH 1/3] Dev: Remove unused code about hb_delnode --- crmsh/config.py | 1 - crmsh/ui_node.py | 1 - doc/website-v1/configuration.adoc | 1 - etc/crm.conf.in | 1 - test/unittests/test.conf | 1 - 5 files changed, 5 deletions(-) diff --git a/crmsh/config.py b/crmsh/config.py index d9b385f843..14ad0148e6 100644 --- a/crmsh/config.py +++ b/crmsh/config.py @@ -269,7 +269,6 @@ def get(self, value): 'crm_dtd_dir': opt_dir('%(datadir)s/pacemaker'), 'pe_state_dir': opt_dir('%(varlib)s/pacemaker/pengine'), 'heartbeat_dir': opt_dir('%(varlib)s/heartbeat'), - 'hb_delnode': opt_program('', ('%(datadir)s/heartbeat/hb_delnode',)), 'hawk_wizards': opt_dir('%(wwwdir)s/hawk/config/wizard'), }, 'color': { diff --git a/crmsh/ui_node.py b/crmsh/ui_node.py index 3982af5281..16c369ea2a 100644 --- a/crmsh/ui_node.py +++ b/crmsh/ui_node.py @@ -287,7 +287,6 @@ class NodeMgmt(command.UI): shutdown="0" />'""") node_clear_state_118 = "stonith_admin --confirm %s" - hb_delnode = config.path.hb_delnode + " '%s'" crm_node = "crm_node" node_fence = "crm_attribute -t status -N '%s' -n terminate -v true" dc = "crmadmin -D" diff --git a/doc/website-v1/configuration.adoc b/doc/website-v1/configuration.adoc index 1339f19873..6fe28c1b7e 100644 --- a/doc/website-v1/configuration.adoc +++ b/doc/website-v1/configuration.adoc @@ -72,7 +72,6 @@ ocf_root = /usr/lib/ocf crm_dtd_dir = /usr/share/pacemaker pe_state_dir = /var/lib/pacemaker/pengine heartbeat_dir = /var/lib/heartbeat -hb_delnode = /usr/share/heartbeat/hb_delnode [color] style = color diff --git a/etc/crm.conf.in b/etc/crm.conf.in index b86c460793..8f2acc003d 100644 --- a/etc/crm.conf.in +++ b/etc/crm.conf.in @@ -50,7 +50,6 @@ ocf_root = @OCF_ROOT_DIR@ ; crm_dtd_dir = ; pe_state_dir = ; heartbeat_dir = -; hb_delnode = /usr/share/heartbeat/hb_delnode ; [color] ; style = color diff --git a/test/unittests/test.conf b/test/unittests/test.conf index efa09cf3e9..ae62911d98 100644 --- a/test/unittests/test.conf +++ b/test/unittests/test.conf @@ -8,4 +8,3 @@ ocf_root = . crm_dtd_dir = . pe_state_dir = . heartbeat_dir = . -hb_delnode = ./hb_delnode From c3ab29e8d7e852045cc6f1454e96a31ade3c6aa8 Mon Sep 17 00:00:00 2001 From: xin liang Date: Fri, 31 May 2024 17:39:39 +0800 Subject: [PATCH 2/3] Dev: crash_test.utils: Reuse color constants from crmsh.constants --- crmsh/crash_test/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crmsh/crash_test/utils.py b/crmsh/crash_test/utils.py index d3ebb7f99a..a2c26f454c 100644 --- a/crmsh/crash_test/utils.py +++ b/crmsh/crash_test/utils.py @@ -9,15 +9,16 @@ from . import config from crmsh import log from crmsh.sh import ShellUtils +from crmsh import constants logger = log.setup_logger(__name__) -CRED = '\033[31m' -CYELLOW = '\033[33m' -CGREEN = '\033[32m' -CEND = '\033[0m' +CRED = constants.RED +CYELLOW = constants.YELLOW +CGREEN = constants.GREEN +CEND = constants.END LEVEL = { "info": logging.INFO, From 427d4f3afbae8e7ddb8a8764fe132dab3169a577 Mon Sep 17 00:00:00 2001 From: xin liang Date: Fri, 31 May 2024 18:15:59 +0800 Subject: [PATCH 3/3] Dev: ui_configure: Remove _keywords interface and unused code which was not useful and easily outdated --- crmsh/constants.py | 74 ------------------------------------------- crmsh/ui_configure.py | 6 ---- 2 files changed, 80 deletions(-) diff --git a/crmsh/constants.py b/crmsh/constants.py index 99f38d51a3..d437870319 100644 --- a/crmsh/constants.py +++ b/crmsh/constants.py @@ -4,80 +4,6 @@ from .ordereddict import odict -# A list of all keywords introduced in the -# CIB language. -keywords = { - "node": "element", - "primitive": "element", - "resource": "element", - "group": "element", - "bundle": "element", - "clone": "element", - "ms": "element", - "master": "element", - "location": "element", - "colocation": "element", - "collocation": "element", - "order": "element", - "rsc_ticket": "element", - "rsc_template": "element", - "property": "element", - "rsc_defaults": "element", - "op_defaults": "element", - "acl_target": "element", - "acl_group": "element", - "user": "element", - "role": "element", - "fencing_topology": "element", - "fencing-topology": "element", - "tag": "element", - "alert": "element", - "monitor": "element", - "params": "subelement", - "meta": "subelement", - "attributes": "subelement", - "utilization": "subelement", - "operations": "subelement", - "op": "subelement", - "rule": "subelement", - "to": "subelement", - "inf": "value", - "INFINITY": "value", - "and": "op", - "or": "op", - "lt": "op", - "gt": "op", - "lte": "op", - "gte": "op", - "eq": "op", - "ne": "op", - "defined": "op", - "not_defined": "op", - "in_range": "op", - "in": "op", - "date_spec": "op", - "spec": "op", - "date": "value", - "yes": "value", - "no": "value", - "true": "value", - "false": "value", - "on": "value", - "off": "value", - "normal": "value", - "member": "value", - "ping": "value", - "remote": "value", - "start": "value", - "stop": "value", - "Mandatory": "value", - "Optional": "value", - "Serialize": "value", - "ref": "value", - "xpath": "value", - "xml": "element", -} - cib_cli_map = { "node": "node", "primitive": "primitive", diff --git a/crmsh/ui_configure.py b/crmsh/ui_configure.py index 7915eb23c3..8ea9c6e625 100644 --- a/crmsh/ui_configure.py +++ b/crmsh/ui_configure.py @@ -528,12 +528,6 @@ def do_regression_testing(self, context, param): def do_showobjects(self, context): cib_factory.showobjects() - @command.name('_keywords') - @command.skill_level('administrator') - def do_keywords(self, context): - for k, v in sorted(iter(constants.keywords.items()), key=lambda v: v[0].lower()): - print("%-16s %s" % (k, v)) - @command.level(ui_ra.RA) def do_ra(self): pass