diff --git a/crmsh/constants.py b/crmsh/constants.py index f86c170a5..9698f695e 100644 --- a/crmsh/constants.py +++ b/crmsh/constants.py @@ -449,4 +449,6 @@ PCMK_SERVICE = "pacemaker.service" SBD_SERVICE = "sbd.service" + +SANITY_FATAL_RC = 100 # vim:ts=4:sw=4:et: diff --git a/crmsh/ra.py b/crmsh/ra.py index f4469c5a0..1961c32dd 100644 --- a/crmsh/ra.py +++ b/crmsh/ra.py @@ -608,8 +608,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 4700cd159..acc1da0e7 100644 --- a/crmsh/ui_configure.py +++ b/crmsh/ui_configure.py @@ -761,6 +761,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 @@ -940,7 +942,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 6e358c112..24f99549b 100644 --- a/crmsh/utils.py +++ b/crmsh/utils.py @@ -306,7 +306,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 e4286c840..91083f92e 100644 --- a/test/features/resource_set.feature +++ b/test/features/resource_set.feature @@ -201,3 +201,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