community.general icon indicating copy to clipboard operation
community.general copied to clipboard

pacemaker_cluster: enhancements and add unit tests

Open munchtoast opened this issue 5 months ago • 4 comments

SUMMARY
  • Add unit tests for pacemaker_cluster
  • Enhance pacemaker_cluster to utilize module_utils/pacemaker.py
  • Enhance pacemaker_cluster to manage maintenance mode on cluster

Fixes #10200

ISSUE TYPE
  • Feature Pull Request
  • Refactoring Pull Request
  • Test Pull Request
COMPONENT NAME

pacemaker_cluster.py

ADDITIONAL INFORMATION

munchtoast avatar Jun 10 '25 16:06 munchtoast

cc @matbu click here for bot help

ansibullbot avatar Jun 10 '25 16:06 ansibullbot

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:73:0: unused-import: Unused get_pacemaker_maintenance_mode imported from ansible_collections.community.general.plugins.module_utils.pacemaker

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:73:0: unused-import: Unused get_pacemaker_maintenance_mode imported from ansible_collections.community.general.plugins.module_utils.pacemaker

The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:

plugins/modules/pacemaker_cluster.py:0:0: doc-choices-do-not-match-spec: Argument 'state' in argument_spec defines choices as (['cleanup', 'offline', 'online', 'restart']) but documentation defines choices as (['cleanup', 'offline', 'online', 'restart', 'maintenance'])
plugins/modules/pacemaker_cluster.py:0:0: doc-default-does-not-match-spec: Argument 'state' in argument_spec defines default as ('present') but documentation defines default as (None)

The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:

plugins/modules/pacemaker_cluster.py:0:0: doc-choices-do-not-match-spec: Argument 'state' in argument_spec defines choices as (['cleanup', 'offline', 'online', 'restart']) but documentation defines choices as (['cleanup', 'offline', 'online', 'restart', 'maintenance'])
plugins/modules/pacemaker_cluster.py:0:0: doc-default-does-not-match-spec: Argument 'state' in argument_spec defines default as ('present') but documentation defines default as (None)

The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:

plugins/modules/pacemaker_cluster.py:0:0: doc-choices-do-not-match-spec: Argument 'state' in argument_spec defines choices as (['cleanup', 'offline', 'online', 'restart']) but documentation defines choices as (['cleanup', 'offline', 'online', 'restart', 'maintenance'])
plugins/modules/pacemaker_cluster.py:0:0: doc-default-does-not-match-spec: Argument 'state' in argument_spec defines default as ('present') but documentation defines default as (None)

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:73:0: unused-import: Unused get_pacemaker_maintenance_mode imported from ansible_collections.community.general.plugins.module_utils.pacemaker

click here for bot help

ansibullbot avatar Jun 10 '25 16:06 ansibullbot

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:126:15: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:126:15: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:126:15: E111: indentation is not a multiple of 4

click here for bot help

ansibullbot avatar Jun 10 '25 22:06 ansibullbot

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

plugins/modules/pacemaker_cluster.py:110:1: W293: blank line contains whitespace
plugins/modules/pacemaker_cluster.py:133:15: E111: indentation is not a multiple of 4
plugins/modules/pacemaker_cluster.py:154:15: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

plugins/modules/pacemaker_cluster.py:110:1: W293: blank line contains whitespace
plugins/modules/pacemaker_cluster.py:133:15: E111: indentation is not a multiple of 4
plugins/modules/pacemaker_cluster.py:154:15: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

plugins/modules/pacemaker_cluster.py:110:1: W293: blank line contains whitespace
plugins/modules/pacemaker_cluster.py:133:15: E111: indentation is not a multiple of 4
plugins/modules/pacemaker_cluster.py:154:15: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:110:0: trailing-whitespace: Trailing whitespace

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:110:0: trailing-whitespace: Trailing whitespace

The test ansible-test sanity --test pylint [explain] failed with 1 error:

plugins/modules/pacemaker_cluster.py:110:0: trailing-whitespace: Trailing whitespace

click here for bot help

ansibullbot avatar Jun 17 '25 13:06 ansibullbot

If nobody objects, I'll merge this on the weekend!

felixfontein avatar Jul 10 '25 20:07 felixfontein

I think this is the only place where the issue URL fits. (Correct me if I'm wrong...)

I agree, that seems to be the only place.

russoz avatar Jul 13 '25 22:07 russoz

Backport to stable-11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-11/283d947f17d9ebe194d8aad4e7e09176d073c35b/pr-10227

Backported as https://github.com/ansible-collections/community.general/pull/10408

🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.

patchback[bot] avatar Jul 14 '25 05:07 patchback[bot]

@munchtoast thanks a lot for your contribution! @russoz thanks for reviewing!

felixfontein avatar Jul 14 '25 05:07 felixfontein