diff --git a/crmsh/constants.py b/crmsh/constants.py index a89fbd334..3987ea285 100644 --- a/crmsh/constants.py +++ b/crmsh/constants.py @@ -517,4 +517,6 @@ COROSYNC_STATUS_TYPES = ("ring", "quorum", "qdevice", "qnetd", "cpg") NO_SSH_ERROR_MSG = "ssh-related operations are disabled. crmsh works in local mode." + +SANITY_FATAL_RC = 100 # vim:ts=4:sw=4:et: diff --git a/crmsh/ra.py b/crmsh/ra.py index 211caabb0..fc202f4dd 100644 --- a/crmsh/ra.py +++ b/crmsh/ra.py @@ -640,8 +640,8 @@ def sanity_check_op(op, op_dict): if self.ra_class == "stonith" and op in ("start", "stop"): return rc if op not in self.actions(): - logger.warning("%s: action '%s' not found in Resource Agent meta-data", ident, op) - rc |= 1 + logger.error("Action '%s' not found in Resource Agent meta-data", op) + rc |= constants.SANITY_FATAL_RC return rc rc |= sanity_check_op_interval(op, op_dict) rc |= sanity_check_op_timeout(op, op_dict) diff --git a/crmsh/ui_configure.py b/crmsh/ui_configure.py index 4a868591f..85de94ce9 100644 --- a/crmsh/ui_configure.py +++ b/crmsh/ui_configure.py @@ -755,6 +755,8 @@ def _verify(self, set_obj_semantic, set_obj_all): rc1 = set_obj_all.verify() if config.core.check_frequency != "never": rc2 = set_obj_semantic.semantic_check(set_obj_all) + if rc2 >= constants.SANITY_FATAL_RC: + raise utils.TerminateSubCommand else: rc2 = 0 return rc1 and rc2 <= 1 @@ -934,7 +936,10 @@ def _commit(self, force=False, replace=False): rc1 = True if replace and not force: rc1 = cib_factory.is_current_cib_equal() - rc2 = self._verify(mkset_obj("xml", "changed"), mkset_obj("xml")) + try: + rc2 = self._verify(mkset_obj("xml", "changed"), mkset_obj("xml")) + except utils.TerminateSubCommand: + return False if rc1 and rc2: return cib_factory.commit(replace=replace) if force or config.core.force: diff --git a/crmsh/utils.py b/crmsh/utils.py index ac77669e5..f94564f98 100644 --- a/crmsh/utils.py +++ b/crmsh/utils.py @@ -288,7 +288,7 @@ def ask(msg, background_wait=True, cancel_option=False): if not can_ask(background_wait): return False - option_str = "y/n" + "/c" if cancel_option else "" + option_str = "y/n" + ("/c" if cancel_option else "") msg += ' ' if msg.endswith('? '): msg = msg[:-2] + f' ({option_str})? ' diff --git a/test/features/resource_set.feature b/test/features/resource_set.feature index f2f5f3815..b951d4582 100644 --- a/test/features/resource_set.feature +++ b/test/features/resource_set.feature @@ -185,3 +185,10 @@ Feature: Use "crm configure set" to update attributes and operations And Run "crm configure load xml update /tmp/d.xml" on "hanode1" And Try "crm configure show|grep -E "^xml