From 356c42ba3b1495767b75089865f87c9237b16e7f Mon Sep 17 00:00:00 2001 From: munchtoast Date: Wed, 4 Jun 2025 10:23:25 -0400 Subject: [PATCH] feat(initial): Add working changes to pacemaker_stonith --- plugins/modules/pacemaker_stonith.py | 12 ++++++------ .../unit/plugins/modules/test_pacemaker_stonith.yaml | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/modules/pacemaker_stonith.py b/plugins/modules/pacemaker_stonith.py index 71ed21e7c1..000a62f22c 100644 --- a/plugins/modules/pacemaker_stonith.py +++ b/plugins/modules/pacemaker_stonith.py @@ -14,7 +14,7 @@ module: pacemaker_stonith short_description: Manage pacemaker stonith author: - Dexter Le (@munchtoast) -version_added: 10.6.0 +version_added: 10.8.0 description: - This module can manage stonith in a Pacemaker cluster using the pacemaker CLI. extends_documentation_fragment: @@ -156,11 +156,11 @@ class PacemakerStonith(StateModuleHelper): self.runner = pacemaker_runner(self.module, cli_action='stonith') self.vars.set('previous_value', self._get()) self.vars.set('value', self.vars.previous_value, change=True, diff=True) - self.vars.set('resource_type', self.vars.stonith_type) - self.vars.set('resource_option', self.vars.stonith_option) - self.vars.set('resource_operation', self.vars.stonith_operation) - self.vars.set('resource_meta', self.vars.stonith_meta) - self.vars.set('resource_argument', self.vars.stonith_argument) + self.module.params['resource_type'] = dict(resource_name=self.vars.stonith_type) + self.module.params['resource_option'] = self.vars.stonith_option + self.module.params['resource_operation'] = self.vars.stonith_operation + self.module.params['resource_meta'] = self.vars.stonith_meta + self.module.params['resource_argument'] = self.vars.stonith_argument def _process_command_output(self, fail_on_err, ignore_err_msg=""): def process(rc, out, err): diff --git a/tests/unit/plugins/modules/test_pacemaker_stonith.yaml b/tests/unit/plugins/modules/test_pacemaker_stonith.yaml index 6c3a85f764..8d938026ed 100644 --- a/tests/unit/plugins/modules/test_pacemaker_stonith.yaml +++ b/tests/unit/plugins/modules/test_pacemaker_stonith.yaml @@ -96,6 +96,11 @@ test_cases: rc: 1 out: "" err: "Error: Resource 'virtual-stonith' does not exist.\n" + - command: ["/testbin/pcs", stonith, status, virtual-stonith] + environ: *env-def + rc: 1 + out: "" + err: "" - id: test_absent_minimal_input_stonith_exists input: state: absent @@ -116,6 +121,11 @@ test_cases: rc: 0 out: "" err: "Attempting to stop: virtual-ip... Stopped\n" + - command: ["/testbin/pcs", stonith, status, virtual-stonith] + environ: *env-def + rc: 1 + out: "" + err: "" - id: test_enabled_minimal_input_stonith_not_exists input: state: enabled