diff --git a/.gitignore b/.gitignore index 26b9e4d..4f3de5d 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,7 @@ /pcs-0.11.8.tar.gz /pcs-web-ui-0.1.20.tar.gz /pcs-web-ui-node-modules-0.1.20.tar.xz +/pcs-web-ui-0.1.22.tar.gz +/pcs-web-ui-node-modules-0.1.22.tar.xz +/pcs-0.11.9.tar.gz +/dacite-1.9.2.tar.gz diff --git a/overhaul-fence-agents-mocking.patch b/overhaul-fence-agents-mocking.patch deleted file mode 100644 index 967e96a..0000000 --- a/overhaul-fence-agents-mocking.patch +++ /dev/null @@ -1,3687 +0,0 @@ -From 96671c6b44e6a599c72bddb384167e7266418e26 Mon Sep 17 00:00:00 2001 -From: Tomas Jelinek -Date: Wed, 24 Jul 2024 14:38:31 +0200 -Subject: [PATCH] tests: overhaul fence agents mocking - -* add a stonith_admin mock to support validating instance atributes by - agents -* rename agents to make it clear we're working with mocks and to show - what each mock is used for -* create custom metedata for agents to fit usecases in tests -* tier1 tests do not require fence agents to be installed in the system, - all is mocked now ---- - .gitignore | 1 + - configure.ac | 1 + - pcs_test/Makefile.am | 11 +- - .../tier1/cib_resource/test_clone_unclone.py | 2 +- - .../tier1/cib_resource/test_stonith_create.py | 169 ++- - .../test_stonith_enable_disable.py | 39 +- - pcs_test/tier1/legacy/test_resource.py | 8 +- - pcs_test/tier1/legacy/test_stonith.py | 1007 +++++------------ - pcs_test/tier1/test_status.py | 20 +- - pcs_test/tools/bin_mock/__init__.py | 4 + - .../stonith__fence_apc_metadata.xml | 277 ----- - .../stonith__fence_ilo_metadata.xml | 269 ----- - ...stonith__fence_pcsmock_action_metadata.xml | 31 + - ...stonith__fence_pcsmock_method_metadata.xml | 32 + - ...tonith__fence_pcsmock_minimal_metadata.xml | 22 + - ...stonith__fence_pcsmock_params_metadata.xml | 107 ++ - ...nith__fence_pcsmock_unfencing_metadata.xml | 22 + - .../stonith__fence_scsi_metadata.xml | 182 --- - .../stonith__fence_xvm_metadata.xml | 120 -- - .../tools/bin_mock/pcmk/crm_resource_mock.py | 28 +- - pcs_test/tools/bin_mock/pcmk/stonith_admin.in | 5 + - .../tools/bin_mock/pcmk/stonith_admin_mock.py | 60 + - 22 files changed, 710 insertions(+), 1707 deletions(-) - delete mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_apc_metadata.xml - delete mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_ilo_metadata.xml - create mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_action_metadata.xml - create mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_method_metadata.xml - create mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_minimal_metadata.xml - create mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_params_metadata.xml - create mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_unfencing_metadata.xml - delete mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_scsi_metadata.xml - delete mode 100644 pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_xvm_metadata.xml - create mode 100755 pcs_test/tools/bin_mock/pcmk/stonith_admin.in - create mode 100644 pcs_test/tools/bin_mock/pcmk/stonith_admin_mock.py - -diff --git a/.gitignore b/.gitignore -index b08138ea..6b39468d 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -32,6 +32,7 @@ pcs_test/smoke.sh - pcs_test/tools/bin_mock/pcmk/crm_resource - pcs_test/tools/bin_mock/pcmk/pacemaker_metadata - pcs_test/tools/bin_mock/pcmk/pacemaker-fenced -+pcs_test/tools/bin_mock/pcmk/stonith_admin - pcs_test/resources/*.tmp - pcs_test/resources/temp*.xml - pcs_test/resources/temp* -diff --git a/configure.ac b/configure.ac -index 6ca44faa..71bbd1b3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -629,6 +629,7 @@ AC_CONFIG_FILES([pcs_test/pcs_for_tests], [chmod +x pcs_test/pcs_for_tests]) - AC_CONFIG_FILES([pcs_test/suite], [chmod +x pcs_test/suite]) - AC_CONFIG_FILES([pcs_test/tools/bin_mock/pcmk/crm_resource], [chmod +x pcs_test/tools/bin_mock/pcmk/crm_resource]) - AC_CONFIG_FILES([pcs_test/tools/bin_mock/pcmk/pacemaker-fenced], [chmod +x pcs_test/tools/bin_mock/pcmk/pacemaker-fenced]) -+AC_CONFIG_FILES([pcs_test/tools/bin_mock/pcmk/stonith_admin], [chmod +x pcs_test/tools/bin_mock/pcmk/stonith_admin]) - AC_CONFIG_FILES([pcsd/pcsd], [chmod +x pcsd/pcsd]) - AC_CONFIG_FILES([scripts/pcsd.sh], [chmod +x scripts/pcsd.sh]) - -diff --git a/pcs_test/Makefile.am b/pcs_test/Makefile.am -index 4ca7d1ee..85dece70 100644 ---- a/pcs_test/Makefile.am -+++ b/pcs_test/Makefile.am -@@ -415,18 +415,19 @@ EXTRA_DIST = \ - tools/bin_mock/pcmk/crm_resource.d/ocf__pacemaker__remote_metadata.xml \ - tools/bin_mock/pcmk/crm_resource.d/ocf__pacemaker__Stateful_metadata.xml \ - tools/bin_mock/pcmk/crm_resource.d/ocf__pacemaker__SystemHealth_metadata.xml \ -- tools/bin_mock/pcmk/crm_resource.d/stonith__fence_apc_metadata.xml \ -- tools/bin_mock/pcmk/crm_resource.d/stonith__fence_ilo_metadata.xml \ -- tools/bin_mock/pcmk/crm_resource.d/stonith__fence_scsi_metadata.xml \ -- tools/bin_mock/pcmk/crm_resource.d/stonith__fence_xvm_metadata.xml \ -+ tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_action_metadata.xml \ -+ tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_method_metadata.xml \ -+ tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_minimal_metadata.xml \ -+ tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_params_metadata.xml \ -+ tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_unfencing_metadata.xml \ - tools/bin_mock/pcmk/crm_resource.d/systemd__test@a__b_metadata.xml \ - tools/bin_mock/pcmk/crm_resource_mock.py \ -- tools/bin_mock/pcmk/pacemaker-fenced \ - tools/bin_mock/pcmk/pacemaker_metadata.d/pacemaker_based.xml \ - tools/bin_mock/pcmk/pacemaker_metadata.d/pacemaker_controld.xml \ - tools/bin_mock/pcmk/pacemaker_metadata.d/pacemaker_fenced.xml \ - tools/bin_mock/pcmk/pacemaker_metadata.d/pacemaker_schedulerd.xml \ - tools/bin_mock/pcmk/pacemaker_metadata.py \ -+ tools/bin_mock/pcmk/stonith_admin_mock.py \ - tools/case_analysis.py \ - tools/check/__init__.py \ - tools/check/test_misc.py \ -diff --git a/pcs_test/tier1/cib_resource/test_clone_unclone.py b/pcs_test/tier1/cib_resource/test_clone_unclone.py -index 9a4c0185..3f991c23 100644 ---- a/pcs_test/tier1/cib_resource/test_clone_unclone.py -+++ b/pcs_test/tier1/cib_resource/test_clone_unclone.py -@@ -34,7 +34,7 @@ FIXTURE_PRIMITIVE_FOR_CLONE = _get_primitive_fixture("C") - FIXTURE_CLONE = f"""{FIXTURE_PRIMITIVE_FOR_CLONE}""" - - FIXTURE_STONITH_FOR_CLONE = """ -- -+ - - -diff --git a/pcs_test/tier1/cib_resource/test_stonith_create.py b/pcs_test/tier1/cib_resource/test_stonith_create.py -index a42c3dd6..9b43a1a2 100644 ---- a/pcs_test/tier1/cib_resource/test_stonith_create.py -+++ b/pcs_test/tier1/cib_resource/test_stonith_create.py -@@ -1,5 +1,3 @@ --import re -- - from pcs_test.tier1.cib_resource.common import ResourceTest - from pcs_test.tools.bin_mock import get_mock_settings - from pcs_test.tools.misc import is_minimum_pacemaker_version -@@ -12,12 +10,17 @@ ERRORS_HAVE_OCCURRED = ( - - - class PlainStonith(ResourceTest): -+ def setUp(self): -+ super().setUp() -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) -+ - def test_simplest(self): -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") - self.assert_effect( -- "stonith create S fence_xvm".split(), -+ "stonith create S fence_pcsmock_minimal".split(), - """ -- -+ - - -- -+ - - -@@ -117,16 +81,18 @@ class PlainStonith(ResourceTest): - - - """, -- stderr_full=error, -- stderr_regexp=error_re, -+ stderr_full=( -+ "Warning: Agent 'stonith:absent' is not installed or " -+ "does not provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata\n" -+ ), - ) - - def test_disabled_puts_target_role_stopped(self): -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") - self.assert_effect( -- "stonith create S fence_xvm --disabled".split(), -+ "stonith create S fence_pcsmock_minimal --disabled".split(), - """ -- -+ - - -- -+ - - -- -+ - - -- -+ - - -- -+ - - - -- -+ - - - -- -+ - - - - -- -+ - - - -- -+ - - - - -- -+ - - - -- -+ - - - - -- -+ - - - - -- -+ - - -- -+ - - -- -+ - - - -- -+ - - - """ - -- self.assert_effect("stonith create S fence_xvm".split(), result_xml) -+ self.assert_effect( -+ "stonith create S fence_pcsmock_minimal".split(), result_xml -+ ) - self.assert_effect("stonith enable S".split(), result_xml) - - - class Disable(ResourceTest): -+ def setUp(self): -+ super().setUp() -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) -+ - def test_disable_enabled_stonith(self): -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") - self.assert_effect( -- "stonith create S fence_xvm".split(), -+ "stonith create S fence_pcsmock_minimal".split(), - """ -- -+ - - -- -+ - - -- -+ - - - """ - self.assert_effect( -- "stonith create S fence_xvm --disabled".split(), result_xml -+ "stonith create S fence_pcsmock_minimal --disabled".split(), -+ result_xml, - ) - self.assert_effect("stonith disable S".split(), result_xml) -diff --git a/pcs_test/tier1/legacy/test_resource.py b/pcs_test/tier1/legacy/test_resource.py -index c6709682..ec7bed01 100644 ---- a/pcs_test/tier1/legacy/test_resource.py -+++ b/pcs_test/tier1/legacy/test_resource.py -@@ -138,8 +138,8 @@ class ResourceDescribe(TestCase, AssertPcsMixin): - "resource describe ocf:pacemaker:nonexistent".split(), - ( - "Error: Agent 'ocf:pacemaker:nonexistent' is not installed or does " -- "not provide valid metadata: Metadata query for " -- "ocf:pacemaker:nonexistent failed: Input/output error\n" -+ "not provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata\n" - + ERRORS_HAVE_OCCURRED - ), - ) -@@ -5018,8 +5018,8 @@ class UpdateInstanceAttrs( - agent = "ocf:pacemaker:nonexistent" - message = ( - f"Agent '{agent}' is not installed or does " -- "not provide valid metadata: Metadata query for " -- f"{agent} failed: Input/output error" -+ "not provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata" - ) - self.assert_pcs_success( - f"resource create --force D0 {agent}".split(), -diff --git a/pcs_test/tier1/legacy/test_stonith.py b/pcs_test/tier1/legacy/test_stonith.py -index 6d0bff24..d8d1f4e0 100644 ---- a/pcs_test/tier1/legacy/test_stonith.py -+++ b/pcs_test/tier1/legacy/test_stonith.py -@@ -40,12 +40,12 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - - def test_success(self): - self.assert_pcs_success( -- "stonith describe fence_apc".split(), -+ "stonith describe fence_pcsmock_params".split(), - stdout_start=dedent( - """\ -- fence_apc - Fence agent for APC over telnet/ssh -+ fence_pcsmock_params - Mock agent for pcs tests - agent with various params - -- fence_apc is an I/O Fencing agent which can be used with the APC network power switch. It logs into device via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions. -+ This is an agent with params for pcs tests - - Stonith options: - """ -@@ -54,7 +54,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - - def test_full(self): - self.assert_pcs_success( -- "stonith describe fence_apc --full".split(), -+ "stonith describe fence_pcsmock_params --full".split(), - stdout_regexp=".*pcmk_list_retries.*", - ) - -@@ -63,10 +63,9 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "stonith describe fence_noexist".split(), - ( - "Error: Agent 'stonith:fence_noexist' is not installed or does not " -- "provide valid metadata: Agent fence_noexist not found or does " -- "not support meta-data: Invalid argument (22), " -- "Metadata query for stonith:fence_noexist failed: Input/output " -- "error\n" + ERRORS_HAVE_OCCURRED -+ "provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata\n" -+ + ERRORS_HAVE_OCCURRED - ), - ) - -@@ -85,17 +84,17 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - def test_pcsd_interface(self): - self.maxDiff = None - stdout, stderr, returncode = self.pcs_runner.run( -- "stonith get_fence_agent_info stonith:fence_apc".split() -+ "stonith get_fence_agent_info stonith:fence_pcsmock_params".split() - ) - self.assertEqual( - json.loads(stdout), - { -- "name": "stonith:fence_apc", -+ "name": "stonith:fence_pcsmock_params", - "standard": "stonith", - "provider": None, -- "type": "fence_apc", -- "shortdesc": "Fence agent for APC over telnet/ssh", -- "longdesc": "fence_apc is an I/O Fencing agent which can be used with the APC network power switch. It logs into device via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions.", -+ "type": "fence_pcsmock_params", -+ "shortdesc": "Mock agent for pcs tests - agent with various params", -+ "longdesc": "This is an agent with params for pcs tests", - "parameters": [ - { - "name": "action", -@@ -115,81 +114,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "cmd_prompt", -- "shortdesc": "Force Python regex for command prompt", -- "longdesc": None, -- "type": "string", -- "default": "['\\n>', '\\napc>']", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": True, -- "deprecated_by": ["command_prompt"], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "command_prompt", -- "shortdesc": "Force Python regex for command prompt", -- "longdesc": None, -- "type": "string", -- "default": "['\\n>', '\\napc>']", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "identity_file", -- "shortdesc": "Identity file (private key) for SSH", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "inet4_only", -- "shortdesc": "Forces agent to use IPv4 addresses only", -- "longdesc": None, -- "type": "boolean", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "inet6_only", -- "shortdesc": "Forces agent to use IPv6 addresses only", -- "longdesc": None, -- "type": "boolean", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "ip", - "shortdesc": "IP address or hostname of fencing device", -@@ -220,21 +144,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "ipport", -- "shortdesc": "TCP/UDP port to use for connection with device", -- "longdesc": None, -- "type": "integer", -- "default": "23", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "login", - "shortdesc": "Login name", -@@ -265,21 +174,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "passwd_script", -- "shortdesc": "Script to run to retrieve password", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": True, -- "deprecated_by": ["password_script"], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "password", - "shortdesc": "Login password or passphrase", -@@ -295,51 +189,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "password_script", -- "shortdesc": "Script to run to retrieve password", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "plug", -- "shortdesc": "Physical plug number on device, UUID or identification of machine", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "port", -- "shortdesc": "Physical plug number on device, UUID or identification of machine", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": True, -- "deprecated_by": ["plug"], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "secure", - "shortdesc": "Use SSH connection", -@@ -370,36 +219,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "ssh_options", -- "shortdesc": "SSH options to use", -- "longdesc": None, -- "type": "string", -- "default": "-1 -c blowfish", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "switch", -- "shortdesc": "Physical switch number on device", -- "longdesc": None, -- "type": "string", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "username", - "shortdesc": "Login name", -@@ -415,21 +234,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "quiet", -- "shortdesc": "Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog.", -- "longdesc": None, -- "type": "boolean", -- "default": None, -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "verbose", - "shortdesc": "Verbose mode", -@@ -475,141 +279,6 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "unique_group": None, - "reloadable": False, - }, -- { -- "name": "separator", -- "shortdesc": "Separator for CSV created by 'list' operation", -- "longdesc": None, -- "type": "string", -- "default": ",", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "delay", -- "shortdesc": "Wait X seconds before fencing is started", -- "longdesc": None, -- "type": "second", -- "default": "0", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "login_timeout", -- "shortdesc": "Wait X seconds for cmd prompt after login", -- "longdesc": None, -- "type": "second", -- "default": "5", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "power_timeout", -- "shortdesc": "Test X seconds for status change after ON/OFF", -- "longdesc": None, -- "type": "second", -- "default": "20", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "power_wait", -- "shortdesc": "Wait X seconds after issuing ON/OFF", -- "longdesc": None, -- "type": "second", -- "default": "0", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "shell_timeout", -- "shortdesc": "Wait X seconds for cmd prompt after issuing command", -- "longdesc": None, -- "type": "second", -- "default": "3", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "retry_on", -- "shortdesc": "Count of attempts to retry power on", -- "longdesc": None, -- "type": "integer", -- "default": "1", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "ssh_path", -- "shortdesc": "Path to ssh binary", -- "longdesc": None, -- "type": "string", -- "default": "/usr/bin/ssh", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, -- { -- "name": "telnet_path", -- "shortdesc": "Path to telnet binary", -- "longdesc": None, -- "type": "string", -- "default": "/usr/bin/telnet", -- "enum_values": None, -- "required": False, -- "advanced": False, -- "deprecated": False, -- "deprecated_by": [], -- "deprecated_desc": None, -- "unique_group": None, -- "reloadable": False, -- }, - { - "name": "pcmk_host_argument", - "shortdesc": "An alternate parameter to supply instead of 'port'", -@@ -1018,17 +687,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "status", -- "timeout": None, -- "interval": None, -- "role": None, -- "start-delay": None, -- "OCF_CHECK_LEVEL": None, -- "automatic": False, -- "on_target": False, -- }, -- { -- "name": "list", -+ "name": "metadata", - "timeout": None, - "interval": None, - "role": None, -@@ -1038,7 +697,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "list-status", -+ "name": "status", - "timeout": None, - "interval": None, - "role": None, -@@ -1058,7 +717,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "metadata", -+ "name": "list", - "timeout": None, - "interval": None, - "role": None, -@@ -1068,7 +727,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "manpage", -+ "name": "list-status", - "timeout": None, - "interval": None, - "role": None, -@@ -1078,8 +737,8 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "validate-all", -- "timeout": None, -+ "name": "stop", -+ "timeout": "20s", - "interval": None, - "role": None, - "start-delay": None, -@@ -1088,7 +747,7 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "stop", -+ "name": "start", - "timeout": "20s", - "interval": None, - "role": None, -@@ -1098,8 +757,8 @@ class StonithDescribeTest(TestCase, AssertPcsMixin): - "on_target": False, - }, - { -- "name": "start", -- "timeout": "20s", -+ "name": "validate-all", -+ "timeout": None, - "interval": None, - "role": None, - "start-delay": None, -@@ -1133,7 +792,9 @@ class StonithTest(TestCase, AssertPcsMixin): - self.temp_corosync_conf = get_tmp_file("tier1_test_stonith") - write_file_to_tmpfile(rc("corosync.conf"), self.temp_corosync_conf) - self.pcs_runner = PcsRunner(self.temp_cib.name) -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) - self.pcs_runner.mock_settings["corosync_conf_file"] = ( - self.temp_corosync_conf.name - ) -@@ -1142,16 +803,14 @@ class StonithTest(TestCase, AssertPcsMixin): - self.temp_cib.close() - self.temp_corosync_conf.close() - -- @skip_unless_crm_rule() -- def test_stonith_creation(self): -+ def test_stonith_creation_nonexistent_agent(self): - self.assert_pcs_fail( - "stonith create test1 fence_noexist".split(), - ( - "Error: Agent 'stonith:fence_noexist' is not installed or does not " -- "provide valid metadata: Agent fence_noexist not found or does " -- "not support meta-data: Invalid argument (22), " -- "Metadata query for stonith:fence_noexist failed: Input/output " -- "error, use --force to override\n" + ERRORS_HAVE_OCCURRED -+ "provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata, " -+ "use --force to override\n" + ERRORS_HAVE_OCCURRED - ), - ) - -@@ -1159,67 +818,33 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith create test1 fence_noexist --force".split(), - stderr_full=( - "Warning: Agent 'stonith:fence_noexist' is not installed or does not " -- "provide valid metadata: Agent fence_noexist not found or does " -- "not support meta-data: Invalid argument (22), " -- "Metadata query for stonith:fence_noexist failed: Input/output " -- "error\n" -- ), -- ) -- -- self.assert_pcs_fail( -- "stonith create test2 fence_apc".split(), -- ( -- "Error: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified, use --force to override\n" -- "Error: stonith option 'username' or 'login' (deprecated) has " -- "to be specified, use --force to override\n" -- + ERRORS_HAVE_OCCURRED -+ "provide valid metadata: " -+ "pcs mock error message: unable to load agent metadata\n" - ), - ) - - self.assert_pcs_success( -- "stonith create test2 fence_apc --force".split(), -- stderr_start=( -- "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified\n" -- "Warning: stonith option 'username' or 'login' (deprecated) has to " -- "be specified\n" -- ), -- ) -- -- self.assert_pcs_fail( -- "stonith create test3 fence_apc bad_argument=test".split(), -- stderr_start=( -- "Error: invalid stonith option 'bad_argument', allowed options are:" -- ), -- ) -- -- self.assert_pcs_fail( -- "stonith create test9 fence_apc pcmk_status_action=xxx".split(), -- ( -- "Error: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified, use --force to override\n" -- "Error: stonith option 'username' or 'login' (deprecated) has " -- "to be specified, use --force to override\n" -- + ERRORS_HAVE_OCCURRED -+ "stonith config".split(), -+ dedent( -+ """\ -+ Resource: test1 (class=stonith type=fence_noexist) -+ Operations: -+ monitor: test1-monitor-interval-60s -+ interval=60s -+ """ - ), - ) - -+ def test_stonith_creation_pcmk_status_action(self): - self.assert_pcs_success( -- "stonith create test9 fence_apc pcmk_status_action=xxx --force".split(), -- stderr_start=( -- "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified\n" -- "Warning: stonith option 'username' or 'login' (deprecated) has to " -- "be specified\n" -- ), -+ "stonith create test9 fence_pcsmock_minimal pcmk_status_action=xxx".split(), - ) - - self.assert_pcs_success( - "stonith config test9".split(), - dedent( - """\ -- Resource: test9 (class=stonith type=fence_apc) -+ Resource: test9 (class=stonith type=fence_pcsmock_minimal) - Attributes: test9-instance_attributes - pcmk_status_action=xxx - Operations: -@@ -1229,34 +854,12 @@ class StonithTest(TestCase, AssertPcsMixin): - ), - ) - -- self.assert_pcs_success( -- "stonith delete test9".split(), -- stderr_full="Deleting Resource - test9\n", -- ) -- -- self.assert_pcs_fail( -- "stonith create test3 fence_ilo ip=test".split(), -- ( -- "Error: stonith option 'username' or 'login' (deprecated) has " -- "to be specified, use --force to override\n" -- + ERRORS_HAVE_OCCURRED -- ), -- ) -- -- self.assert_pcs_success( -- "stonith create test3 fence_ilo ip=test --force".split(), -- stderr_start=( -- "Warning: stonith option 'username' or 'login' (deprecated) " -- "has to be specified\n" -- ), -- ) -- -+ def test_stonith_creation_pcmk_params(self): - # Testing that pcmk_host_check, pcmk_host_list & pcmk_host_map are - # allowed for stonith agents - self.assert_pcs_success( - ( -- "stonith create apc-fencing fence_apc ip=morph-apc username=apc " -- "password=apc switch=1 " -+ "stonith create fencing fence_pcsmock_minimal " - "pcmk_host_map=buzz-01:1;buzz-02:2;buzz-03:3;buzz-04:4;buzz-05:5 " - "pcmk_host_check=static-list " - "pcmk_host_list=buzz-01,buzz-02,buzz-03,buzz-04,buzz-05" -@@ -1264,77 +867,105 @@ class StonithTest(TestCase, AssertPcsMixin): - ) - - self.assert_pcs_fail( -- "resource config apc-fencing".split(), -+ "resource config fencing".split(), - ( -- "Warning: Unable to find resource 'apc-fencing'\n" -+ "Warning: Unable to find resource 'fencing'\n" - "Error: No resource found\n" - ), - ) - - self.assert_pcs_success( -- "stonith config apc-fencing".split(), -+ "stonith config fencing".split(), - dedent( - """\ -- Resource: apc-fencing (class=stonith type=fence_apc) -- Attributes: apc-fencing-instance_attributes -- ip=morph-apc -- password=apc -+ Resource: fencing (class=stonith type=fence_pcsmock_minimal) -+ Attributes: fencing-instance_attributes - pcmk_host_check=static-list - pcmk_host_list=buzz-01,buzz-02,buzz-03,buzz-04,buzz-05 - pcmk_host_map=buzz-01:1;buzz-02:2;buzz-03:3;buzz-04:4;buzz-05:5 -- switch=1 -- username=apc - Operations: -- monitor: apc-fencing-monitor-interval-60s -+ monitor: fencing-monitor-interval-60s - interval=60s - """ - ), - ) - -+ def test_stonith_creation_pcmk_host_list(self): -+ self.assert_pcs_success( -+ [ -+ "stonith", -+ "create", -+ "F1", -+ "fence_pcsmock_minimal", -+ "pcmk_host_list=nodea nodeb", -+ ], -+ ) -+ - self.assert_pcs_success( -- "stonith remove apc-fencing".split(), -- stderr_full="Deleting Resource - apc-fencing\n", -+ "stonith config F1".split(), -+ dedent( -+ """\ -+ Resource: F1 (class=stonith type=fence_pcsmock_minimal) -+ Attributes: F1-instance_attributes -+ pcmk_host_list="nodea nodeb" -+ Operations: -+ monitor: F1-monitor-interval-60s -+ interval=60s -+ """ -+ ), - ) - -+ def test_stonith_creation(self): - self.assert_pcs_fail( -+ "stonith create test2 fence_pcsmock_params".split(), - ( -- "stonith create apc-fencing fence_apc ip=morph-apc username=apc " -- "--agent-validation" -- ).split(), -- stderr_start="Error: Validation result from agent", -+ "Error: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -+ "specified, use --force to override\n" -+ "Error: stonith option 'username' or 'login' (deprecated) has " -+ "to be specified, use --force to override\n" -+ + ERRORS_HAVE_OCCURRED -+ ), - ) - - self.assert_pcs_success( -- ( -- "stonith create apc-fencing fence_apc ip=morph-apc username=apc " -- "--agent-validation --force" -- ).split(), -- stderr_start="Warning: Validation result from agent", -+ "stonith create test2 fence_pcsmock_params --force".split(), -+ stderr_start=( -+ "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -+ "specified\n" -+ "Warning: stonith option 'username' or 'login' (deprecated) has to " -+ "be specified\n" -+ ), - ) - -- self.assert_pcs_success( -- "stonith remove apc-fencing".split(), -- stderr_full="Deleting Resource - apc-fencing\n", -+ self.assert_pcs_fail( -+ "stonith create test3 fence_pcsmock_params bad_argument=test".split(), -+ stderr_start=( -+ "Error: invalid stonith option 'bad_argument', allowed options are:" -+ ), - ) - - self.assert_pcs_fail( -- "stonith update test3 bad_ipaddr=test username=login".split(), -- stderr_regexp=( -- "^Error: invalid stonith option 'bad_ipaddr', allowed options" -- " are: [^\n]+, use --force to override\n$" -+ "stonith create test3 fence_pcsmock_params ip=test".split(), -+ ( -+ "Error: stonith option 'username' or 'login' (deprecated) has " -+ "to be specified, use --force to override\n" -+ + ERRORS_HAVE_OCCURRED - ), - ) - - self.assert_pcs_success( -- "stonith update test3 username=testA --agent-validation".split(), -- stderr_start="Warning: The resource was misconfigured before the update,", -+ "stonith create test3 fence_pcsmock_params ip=test --force".split(), -+ stderr_start=( -+ "Warning: stonith option 'username' or 'login' (deprecated) " -+ "has to be specified\n" -+ ), - ) - - self.assert_pcs_success( - "stonith config test2".split(), - dedent( - """\ -- Resource: test2 (class=stonith type=fence_apc) -+ Resource: test2 (class=stonith type=fence_pcsmock_params) - Operations: - monitor: test2-monitor-interval-60s - interval=60s -@@ -1346,18 +977,13 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config".split(), - dedent( - """\ -- Resource: test1 (class=stonith type=fence_noexist) -- Operations: -- monitor: test1-monitor-interval-60s -- interval=60s -- Resource: test2 (class=stonith type=fence_apc) -+ Resource: test2 (class=stonith type=fence_pcsmock_params) - Operations: - monitor: test2-monitor-interval-60s - interval=60s -- Resource: test3 (class=stonith type=fence_ilo) -+ Resource: test3 (class=stonith type=fence_pcsmock_params) - Attributes: test3-instance_attributes - ip=test -- username=testA - Operations: - monitor: test3-monitor-interval-60s - interval=60s -@@ -1370,23 +996,16 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith", - "create", - "test-fencing", -- "fence_apc", -+ "fence_pcsmock_minimal", - "pcmk_host_list=rhel7-node1 rhel7-node2", - "op", - "monitor", - "interval=61s", -- "--force", - ], -- stderr_start=( -- "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to " -- "be specified\n" -- "Warning: stonith option 'username' or 'login' (deprecated) has to " -- "be specified\n" -- ), - ) - - self.assert_pcs_success( -- "config show".split(), -+ "config".split(), - dedent( - """\ - Cluster Name: test99 -@@ -1395,22 +1014,17 @@ class StonithTest(TestCase, AssertPcsMixin): - Pacemaker Nodes: - - Stonith Devices: -- Resource: test1 (class=stonith type=fence_noexist) -- Operations: -- monitor: test1-monitor-interval-60s -- interval=60s -- Resource: test2 (class=stonith type=fence_apc) -+ Resource: test2 (class=stonith type=fence_pcsmock_params) - Operations: - monitor: test2-monitor-interval-60s - interval=60s -- Resource: test3 (class=stonith type=fence_ilo) -+ Resource: test3 (class=stonith type=fence_pcsmock_params) - Attributes: test3-instance_attributes - ip=test -- username=testA - Operations: - monitor: test3-monitor-interval-60s - interval=60s -- Resource: test-fencing (class=stonith type=fence_apc) -+ Resource: test-fencing (class=stonith type=fence_pcsmock_minimal) - Attributes: test-fencing-instance_attributes - pcmk_host_list="rhel7-node1 rhel7-node2" - Operations: -@@ -1420,10 +1034,81 @@ class StonithTest(TestCase, AssertPcsMixin): - ), - ) - -+ def test_stonith_agent_validation(self): -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) -+ self.assert_pcs_fail( -+ ( -+ "stonith create fencing fence_pcsmock_params " -+ "ip=is_invalid=True username=apc " -+ "--agent-validation" -+ ).split(), -+ stderr_full=( -+ "Error: Validation result from agent (use --force to override):\n" -+ " pcsmock validation failure\n" + ERRORS_HAVE_OCCURRED -+ ), -+ ) -+ -+ self.assert_pcs_success( -+ ( -+ "stonith create fencing fence_pcsmock_params " -+ "ip=is_invalid=True username=apc " -+ "--agent-validation --force" -+ ).split(), -+ stderr_full=( -+ "Warning: Validation result from agent:\n" -+ " pcsmock validation failure\n" -+ ), -+ ) -+ -+ self.assert_pcs_success( -+ "stonith config".split(), -+ dedent( -+ """\ -+ Resource: fencing (class=stonith type=fence_pcsmock_params) -+ Attributes: fencing-instance_attributes -+ ip="is_invalid=True" -+ username=apc -+ Operations: -+ monitor: fencing-monitor-interval-60s -+ interval=60s -+ """ -+ ), -+ ) -+ -+ self.assert_pcs_fail( -+ "stonith update fencing bad_ipaddr=test username=login".split(), -+ stderr_regexp=( -+ "^Error: invalid stonith option 'bad_ipaddr', allowed options" -+ " are: [^\n]+, use --force to override\n$" -+ ), -+ ) -+ -+ self.assert_pcs_success( -+ "stonith update fencing username=testA --agent-validation".split(), -+ stderr_start="Warning: The resource was misconfigured before the update,", -+ ) -+ -+ self.assert_pcs_success( -+ "stonith config".split(), -+ dedent( -+ """\ -+ Resource: fencing (class=stonith type=fence_pcsmock_params) -+ Attributes: fencing-instance_attributes -+ ip="is_invalid=True" -+ username=testA -+ Operations: -+ monitor: fencing-monitor-interval-60s -+ interval=60s -+ """ -+ ), -+ ) -+ - def test_stonith_create_requires_either_new_or_deprecated(self): - # 'ipaddr' and 'login' are obsoleted by 'ip' and 'username' - self.assert_pcs_fail( -- "stonith create test2 fence_apc".split(), -+ "stonith create test2 fence_pcsmock_params".split(), - ( - "Error: stonith option 'ip' or 'ipaddr' (deprecated) has to be " - "specified, use --force to override\n" -@@ -1436,7 +1121,7 @@ class StonithTest(TestCase, AssertPcsMixin): - def test_stonith_create_deprecated_and_obsoleting(self): - # 'ipaddr' and 'login' are obsoleted by 'ip' and 'username' - self.assert_pcs_success( -- "stonith create S fence_apc ip=i login=l password=1234".split(), -+ "stonith create S fence_pcsmock_params ip=i login=l password=1234".split(), - stderr_full=( - "Warning: stonith option 'login' is deprecated and might be " - "removed in a future release, therefore it should not be " -@@ -1447,7 +1132,7 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config S".split(), - dedent( - """\ -- Resource: S (class=stonith type=fence_apc) -+ Resource: S (class=stonith type=fence_pcsmock_params) - Attributes: S-instance_attributes - ip=i - login=l -@@ -1466,7 +1151,7 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith", - "create", - "S", -- "fence_apc", -+ "fence_pcsmock_params", - "ip=i1", - "login=l", - "ipaddr=i2", -@@ -1486,7 +1171,7 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config S".split(), - dedent( - """\ -- Resource: S (class=stonith type=fence_apc) -+ Resource: S (class=stonith type=fence_pcsmock_params) - Attributes: S-instance_attributes - ip=i1 - ipaddr=i2 -@@ -1501,65 +1186,62 @@ class StonithTest(TestCase, AssertPcsMixin): - ) - - def test_stonith_create_provides_unfencing(self): -- self.assert_pcs_success_ignore_output( -- ("stonith", "create", "f1", "fence_scsi", "--force") -+ self.assert_pcs_success( -+ ("stonith", "create", "f1", "fence_pcsmock_unfencing") - ) -- self.assert_pcs_success_ignore_output( -+ self.assert_pcs_success( - ( - "stonith", - "create", - "f2", -- "fence_scsi", -+ "fence_pcsmock_unfencing", - "meta", - "provides=unfencing", -- "--force", - ) - ) -- self.assert_pcs_success_ignore_output( -+ self.assert_pcs_success( - ( - "stonith", - "create", - "f3", -- "fence_scsi", -+ "fence_pcsmock_unfencing", - "meta", - "provides=something", -- "--force", - ) - ) -- self.assert_pcs_success_ignore_output( -+ self.assert_pcs_success( - ( - "stonith", - "create", - "f4", -- "fence_xvm", -+ "fence_pcsmock_minimal", - "meta", - "provides=something", -- "--force", - ) - ) - self.assert_pcs_success( - "stonith config".split(), - dedent( - """\ -- Resource: f1 (class=stonith type=fence_scsi) -+ Resource: f1 (class=stonith type=fence_pcsmock_unfencing) - Meta Attributes: f1-meta_attributes - provides=unfencing - Operations: - monitor: f1-monitor-interval-60s - interval=60s -- Resource: f2 (class=stonith type=fence_scsi) -+ Resource: f2 (class=stonith type=fence_pcsmock_unfencing) - Meta Attributes: f2-meta_attributes - provides=unfencing - Operations: - monitor: f2-monitor-interval-60s - interval=60s -- Resource: f3 (class=stonith type=fence_scsi) -+ Resource: f3 (class=stonith type=fence_pcsmock_unfencing) - Meta Attributes: f3-meta_attributes - provides=unfencing - Operations: - monitor: f3-monitor-interval-60s - interval=60s -- Resource: f4 (class=stonith type=fence_xvm) -+ Resource: f4 (class=stonith type=fence_pcsmock_minimal) - Meta Attributes: f4-meta_attributes - provides=something - Operations: -@@ -1571,7 +1253,7 @@ class StonithTest(TestCase, AssertPcsMixin): - - def test_stonith_create_action(self): - self.assert_pcs_fail( -- "stonith create test fence_apc ip=i username=u action=a".split(), -+ "stonith create test fence_pcsmock_action action=a".split(), - ( - "Error: stonith option 'action' is deprecated and might be " - "removed in a future release, therefore it should not be" -@@ -1581,7 +1263,7 @@ class StonithTest(TestCase, AssertPcsMixin): - ) - - self.assert_pcs_success( -- "stonith create test fence_apc ip=i username=u action=a --force".split(), -+ "stonith create test fence_pcsmock_action action=a --force".split(), - stderr_start=( - "Warning: stonith option 'action' is deprecated and might be " - "removed in a future release, therefore it should not be " -@@ -1593,11 +1275,9 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config".split(), - dedent( - """\ -- Resource: test (class=stonith type=fence_apc) -+ Resource: test (class=stonith type=fence_pcsmock_action) - Attributes: test-instance_attributes - action=a -- ip=i -- username=u - Operations: - monitor: test-monitor-interval-60s - interval=60s -@@ -1607,24 +1287,20 @@ class StonithTest(TestCase, AssertPcsMixin): - - def test_stonith_create_action_empty(self): - self.assert_pcs_fail( -- "stonith create test fence_apc ip=i username=u action=".split(), -+ "stonith create test fence_pcsmock_action action=".split(), - "Error: action cannot be empty\n" + ERRORS_HAVE_OCCURRED, - ) - - def test_stonith_update_action(self): - self.assert_pcs_success( -- "stonith create test fence_apc ip=i username=u password=1234".split() -+ "stonith create test fence_pcsmock_action".split() - ) - - self.assert_pcs_success( - "stonith config".split(), - dedent( - """\ -- Resource: test (class=stonith type=fence_apc) -- Attributes: test-instance_attributes -- ip=i -- password=1234 -- username=u -+ Resource: test (class=stonith type=fence_pcsmock_action) - Operations: - monitor: test-monitor-interval-60s - interval=60s -@@ -1655,12 +1331,9 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config".split(), - dedent( - """\ -- Resource: test (class=stonith type=fence_apc) -+ Resource: test (class=stonith type=fence_pcsmock_action) - Attributes: test-instance_attributes - action=a -- ip=i -- password=1234 -- username=u - Operations: - monitor: test-monitor-interval-60s - interval=60s -@@ -1674,11 +1347,7 @@ class StonithTest(TestCase, AssertPcsMixin): - "stonith config".split(), - dedent( - """\ -- Resource: test (class=stonith type=fence_apc) -- Attributes: test-instance_attributes -- ip=i -- password=1234 -- username=u -+ Resource: test (class=stonith type=fence_pcsmock_action) - Operations: - monitor: test-monitor-interval-60s - interval=60s -@@ -1697,74 +1366,29 @@ class StonithTest(TestCase, AssertPcsMixin): - "Error: must specify one (and only one) node to confirm fenced\n", - ) - -- def test_pcmk_host_list(self): -- self.assert_pcs_success( -- [ -- "stonith", -- "create", -- "F1", -- "fence_apc", -- "pcmk_host_list=nodea nodeb", -- "--force", -- ], -- stderr_start=( -- "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified\n" -- "Warning: stonith option 'username' or 'login' (deprecated) has to " -- "be specified\n" -- ), -- ) -- -- self.assert_pcs_success( -- "stonith config F1".split(), -- dedent( -- """\ -- Resource: F1 (class=stonith type=fence_apc) -- Attributes: F1-instance_attributes -- pcmk_host_list="nodea nodeb" -- Operations: -- monitor: F1-monitor-interval-60s -- interval=60s -- """ -- ), -- ) -- - def test_stonith_delete_removes_level(self): - shutil.copyfile(rc("cib-empty-with3nodes.xml"), self.temp_cib.name) - -- deprecated_warnings = ( -- "Warning: stonith option 'ip' or 'ipaddr' (deprecated) has to be " -- "specified\n" -- "Warning: stonith option 'username' or 'login' (deprecated) has to " -- "be specified\n" -- ) - self.assert_pcs_success( -- "stonith create n1-ipmi fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n1-ipmi fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n2-ipmi fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n2-ipmi fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n1-apc1 fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n1-apc1 fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n1-apc2 fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n1-apc2 fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n2-apc1 fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n2-apc1 fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n2-apc2 fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n2-apc2 fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success( -- "stonith create n2-apc3 fence_apc --force".split(), -- stderr_start=deprecated_warnings, -+ "stonith create n2-apc3 fence_pcsmock_minimal".split(), - ) - self.assert_pcs_success_all( - [ -@@ -1780,13 +1404,13 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -- * n1-apc1\t(stonith:fence_apc):\tStopped -- * n1-apc2\t(stonith:fence_apc):\tStopped -- * n2-apc1\t(stonith:fence_apc):\tStopped -- * n2-apc2\t(stonith:fence_apc):\tStopped -- * n2-apc3\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1804,13 +1428,13 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -- n1-apc1\t(stonith:fence_apc):\tStopped -- n1-apc2\t(stonith:fence_apc):\tStopped -- n2-apc1\t(stonith:fence_apc):\tStopped -- n2-apc2\t(stonith:fence_apc):\tStopped -- n2-apc3\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1833,12 +1457,12 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -- * n1-apc1\t(stonith:fence_apc):\tStopped -- * n1-apc2\t(stonith:fence_apc):\tStopped -- * n2-apc1\t(stonith:fence_apc):\tStopped -- * n2-apc3\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1856,12 +1480,12 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -- n1-apc1\t(stonith:fence_apc):\tStopped -- n1-apc2\t(stonith:fence_apc):\tStopped -- n2-apc1\t(stonith:fence_apc):\tStopped -- n2-apc3\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1884,11 +1508,11 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -- * n1-apc1\t(stonith:fence_apc):\tStopped -- * n1-apc2\t(stonith:fence_apc):\tStopped -- * n2-apc3\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1906,11 +1530,11 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -- n1-apc1\t(stonith:fence_apc):\tStopped -- n1-apc2\t(stonith:fence_apc):\tStopped -- n2-apc3\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-apc3\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1933,10 +1557,10 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -- * n1-apc1\t(stonith:fence_apc):\tStopped -- * n1-apc2\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1953,10 +1577,10 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -- n1-apc1\t(stonith:fence_apc):\tStopped -- n1-apc2\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc1\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1978,9 +1602,9 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -- * n1-apc2\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -1997,9 +1621,9 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -- n1-apc2\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n1-apc2\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -2021,8 +1645,8 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- * n1-ipmi\t(stonith:fence_apc):\tStopped -- * n2-ipmi\t(stonith:fence_apc):\tStopped -+ * n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ * n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -2038,8 +1662,8 @@ class StonithTest(TestCase, AssertPcsMixin): - ["stonith"], - outdent( - """\ -- n1-ipmi\t(stonith:fence_apc):\tStopped -- n2-ipmi\t(stonith:fence_apc):\tStopped -+ n1-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped -+ n2-ipmi\t(stonith:fence_pcsmock_minimal):\tStopped - - Fencing Levels: - Target: rh7-1 -@@ -2058,11 +1682,8 @@ class StonithTest(TestCase, AssertPcsMixin): - ) - - self.pcs_runner.corosync_conf_opt = None -- self.assert_pcs_success_ignore_output( -- ( -- "stonith create test_stonith fence_apc ip=i username=u " -- "pcmk_host_argument=node1 --force" -- ).split() -+ self.assert_pcs_success( -+ "stonith create test_stonith fence_pcsmock_minimal".split() - ) - - self.pcs_runner.corosync_conf_opt = self.temp_corosync_conf.name -@@ -2092,16 +1713,16 @@ _fixture_stonith_level_cache_lock = Lock() - - class StonithLevelTestCibFixture(CachedCibFixture): - def _fixture_stonith_resource(self, name): -- self.assert_pcs_success_ignore_output( -+ self._pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) -+ self.assert_pcs_success( - [ - "stonith", - "create", - name, -- "fence_apc", -+ "fence_pcsmock_minimal", - "pcmk_host_list=rh7-1 rh7-2", -- "ip=i", -- "username=u", -- "--force", - ] - ) - -@@ -2136,7 +1757,9 @@ class LevelTestsBase(TestCase, AssertPcsMixin): - self.temp_cib = get_tmp_file("tier1_test_stonith_level") - write_file_to_tmpfile(rc("cib-empty-withnodes.xml"), self.temp_cib) - self.pcs_runner = PcsRunner(self.temp_cib.name) -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) - self.config = "" - self.config_lines = [] - -@@ -2144,16 +1767,13 @@ class LevelTestsBase(TestCase, AssertPcsMixin): - self.temp_cib.close() - - def fixture_stonith_resource(self, name): -- self.assert_pcs_success_ignore_output( -+ self.assert_pcs_success( - [ - "stonith", - "create", - name, -- "fence_apc", -+ "fence_pcsmock_minimal", - "pcmk_host_list=rh7-1 rh7-2", -- "ip=i", -- "username=u", -- "--force", - ] - ) - -@@ -2597,17 +2217,17 @@ class LevelConfig(LevelTestsBase): - if PCMK_2_0_3_PLUS: - result = outdent( - """\ -- * F1\t(stonith:fence_apc):\tStopped -- * F2\t(stonith:fence_apc):\tStopped -- * F3\t(stonith:fence_apc):\tStopped -+ * F1\t(stonith:fence_pcsmock_minimal):\tStopped -+ * F2\t(stonith:fence_pcsmock_minimal):\tStopped -+ * F3\t(stonith:fence_pcsmock_minimal):\tStopped - """ - ) - else: - result = outdent( - """\ -- F1\t(stonith:fence_apc):\tStopped -- F2\t(stonith:fence_apc):\tStopped -- F3\t(stonith:fence_apc):\tStopped -+ F1\t(stonith:fence_pcsmock_minimal):\tStopped -+ F2\t(stonith:fence_pcsmock_minimal):\tStopped -+ F3\t(stonith:fence_pcsmock_minimal):\tStopped - """ - ) - self.assert_pcs_success( -@@ -2628,27 +2248,21 @@ class LevelConfig(LevelTestsBase): - indent( - dedent( - """ -- Resource: F1 (class=stonith type=fence_apc) -+ Resource: F1 (class=stonith type=fence_pcsmock_minimal) - Attributes: F1-instance_attributes -- ip=i - pcmk_host_list="rh7-1 rh7-2" -- username=u - Operations: - monitor: F1-monitor-interval-60s - interval=60s -- Resource: F2 (class=stonith type=fence_apc) -+ Resource: F2 (class=stonith type=fence_pcsmock_minimal) - Attributes: F2-instance_attributes -- ip=i - pcmk_host_list="rh7-1 rh7-2" -- username=u - Operations: - monitor: F2-monitor-interval-60s - interval=60s -- Resource: F3 (class=stonith type=fence_apc) -+ Resource: F3 (class=stonith type=fence_pcsmock_minimal) - Attributes: F3-instance_attributes -- ip=i - pcmk_host_list="rh7-1 rh7-2" -- username=u - Operations: - monitor: F3-monitor-interval-60s - interval=60s -@@ -3383,26 +2997,19 @@ class LevelVerify(LevelTestsBase): - - - class StonithUpdate(ResourceTest): -- # added in fence-agents-all-4.11.0 -- agent_secure_warning = ( -- "(" -- "Warning: Validation result from agent:\n" -- " WARNING:root:Parse error: Ignoring option 'secure' because it does " -- "not have value\n" -- ")?" -- ) -- - def setUp(self): - super().setUp() -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) - self.fixture_create_stonith() - - def fixture_create_stonith(self): - self.assert_effect( -- "stonith create S fence_apc ip=i login=l ssh=0 debug=d password=1234".split(), -+ "stonith create S fence_pcsmock_params ip=i login=l ssh=0 debug=d password=1234".split(), - """ - -- -+ - - - - """, -- stderr_regexp=( -+ stderr_full=( - "Warning: stonith option 'login' is deprecated and might be " - "removed in a future release, therefore it should not " - "be used, use 'username' instead\n" - "Warning: stonith option 'debug' is deprecated and might be " - "removed in a future release, therefore it should not " - "be used, use 'debug_file' instead\n" -- + self.agent_secure_warning - ), - ) - -@@ -3444,7 +3050,7 @@ class StonithUpdate(ResourceTest): - "stonith update S debug=D".split(), - """ - -- -+ - - - - """, -- stderr_regexp=( -+ stderr_full=( - "Warning: stonith option 'debug' is deprecated and might be " - "removed in a future release, therefore it should not " - "be used, use 'debug_file' instead\n" -- + self.agent_secure_warning - ), - ) - -@@ -3483,7 +3088,7 @@ class StonithUpdate(ResourceTest): - "stonith update S debug=".split(), - """ - -- -+ - - - - """, -- stderr_regexp=self.agent_secure_warning, - ) - - def test_unset_deprecated_required_param(self): -@@ -3521,7 +3125,7 @@ class StonithUpdate(ResourceTest): - "stonith update S ssh=1".split(), - """ - -- -+ - - -- -+ - - -- -+ - - - - """, -- stderr_regexp=self.agent_secure_warning, - ) - - def test_unset_obsoleting_required_set_deprecated(self): -@@ -3625,7 +3228,7 @@ class StonithUpdate(ResourceTest): - "stonith update S ip= ipaddr=I".split(), - """ - -- -+ - - - - """, -- stderr_regexp=( -+ stderr_full=( - "Warning: stonith option 'ipaddr' is deprecated and might be " - "removed in a future release, therefore it should not " -- "be used, use 'ip' instead\n" + self.agent_secure_warning -+ "be used, use 'ip' instead\n" - ), - ) - -@@ -3663,7 +3266,7 @@ class StonithUpdate(ResourceTest): - "stonith update S ip=I1 ipaddr=I2".split(), - """ - -- -+ - - - - """, -- stderr_regexp=( -+ stderr_full=( - "Warning: stonith option 'ipaddr' is deprecated and might be " - "removed in a future release, therefore it should not " -- "be used, use 'ip' instead\n" + self.agent_secure_warning -+ "be used, use 'ip' instead\n" - ), - ) -diff --git a/pcs_test/tier1/test_status.py b/pcs_test/tier1/test_status.py -index 4d472208..f6780c60 100644 ---- a/pcs_test/tier1/test_status.py -+++ b/pcs_test/tier1/test_status.py -@@ -27,6 +27,9 @@ class StonithWarningTest(TestCase, AssertPcsMixin): - self.temp_cib = get_tmp_file("tier0_statust_stonith_warning") - write_file_to_tmpfile(self.empty_cib, self.temp_cib) - self.pcs_runner = PcsRunner(self.temp_cib.name) -+ self.pcs_runner.mock_settings = get_mock_settings( -+ "crm_resource_exec", "stonith_admin_exec" -+ ) - - def tearDown(self): - self.temp_cib.close() -@@ -34,8 +37,7 @@ class StonithWarningTest(TestCase, AssertPcsMixin): - def fixture_stonith_action(self): - self.assert_pcs_success( - ( -- "stonith create Sa fence_apc ip=i username=u action=reboot " -- "--force" -+ "stonith create Sa fence_pcsmock_action action=reboot --force" - ).split(), - stderr_start=( - "Warning: stonith option 'action' is deprecated and might be " -@@ -45,15 +47,8 @@ class StonithWarningTest(TestCase, AssertPcsMixin): - ) - - def fixture_stonith_cycle(self): -- self.assert_pcs_success_ignore_output( -- ( -- "stonith", -- "create", -- "Sc", -- "fence_ipmilan", -- "method=cycle", -- "--force", -- ) -+ self.assert_pcs_success( -+ "stonith create Sc fence_pcsmock_method method=cycle".split() - ) - - def fixture_resource(self): -@@ -208,14 +203,13 @@ class StonithWarningTest(TestCase, AssertPcsMixin): - - def test_no_stonith_warning_when_stonith_in_group(self): - self.assert_pcs_success( -- "stonith create S fence_xvm --group G".split(), -+ "stonith create S fence_pcsmock_minimal --group G".split(), - stderr_full=( - "Deprecation Warning: Option to group stonith resource is " - "deprecated and will be removed in a future release.\n" - ), - ) - self.pcs_runner.corosync_conf_opt = self.corosync_conf -- self.pcs_runner.mock_settings = get_mock_settings("crm_resource_exec") - if PCMK_2_0_3_PLUS: - self.assert_pcs_success( - ["status"], -diff --git a/pcs_test/tools/bin_mock/__init__.py b/pcs_test/tools/bin_mock/__init__.py -index 653bf81b..9bef8e64 100644 ---- a/pcs_test/tools/bin_mock/__init__.py -+++ b/pcs_test/tools/bin_mock/__init__.py -@@ -8,10 +8,14 @@ CRM_RESOURCE_BIN = os.path.abspath( - PACEMAKER_FENCED_BIN = os.path.abspath( - os.path.join(BIN_MOCK_DIR, "pcmk/pacemaker-fenced") - ) -+STONITH_ADMIN_BIN = os.path.abspath( -+ os.path.join(BIN_MOCK_DIR, "pcmk/stonith_admin") -+) - - MOCK_SETTINGS = { - "crm_resource_exec": CRM_RESOURCE_BIN, - "pacemaker_fenced_exec": PACEMAKER_FENCED_BIN, -+ "stonith_admin_exec": STONITH_ADMIN_BIN, - } - - -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_apc_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_apc_metadata.xml -deleted file mode 100644 -index 6d159b4f..00000000 ---- a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_apc_metadata.xml -+++ /dev/null -@@ -1,277 +0,0 @@ -- -- -- fence_apc is an I/O Fencing agent which can be used with the APC network power switch. It logs into device via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions. -- -- -- http://www.apc.com -- -- -- -- -- -- -- Fencing action -- -- -- -- -- -- -- Force Python regex for command prompt -- -- -- -- -- -- -- Force Python regex for command prompt -- -- -- -- -- -- -- Identity file (private key) for SSH -- -- -- -- -- -- -- Forces agent to use IPv4 addresses only -- -- -- -- -- -- -- Forces agent to use IPv6 addresses only -- -- -- -- -- -- -- IP address or hostname of fencing device -- -- -- -- -- -- -- IP address or hostname of fencing device -- -- -- -- -- -- -- TCP/UDP port to use for connection with device -- -- -- -- -- -- -- Login name -- -- -- -- -- -- -- Login password or passphrase -- -- -- -- -- -- -- Script to run to retrieve password -- -- -- -- -- -- -- Login password or passphrase -- -- -- -- -- -- -- Script to run to retrieve password -- -- -- -- -- -- -- Physical plug number on device, UUID or identification of machine -- -- -- -- -- -- -- Physical plug number on device, UUID or identification of machine -- -- -- -- -- -- -- Use SSH connection -- -- -- -- -- -- -- Use SSH connection -- -- -- -- -- -- -- SSH options to use -- -- -- -- -- -- -- Physical switch number on device -- -- -- -- -- -- -- Login name -- -- -- -- -- -- -- Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog. -- -- -- -- -- -- -- Verbose mode -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Display version information and exit -- -- -- -- -- -- -- Display help and exit -- -- -- -- -- -- -- Separator for CSV created by 'list' operation -- -- -- -- -- -- -- Wait X seconds before fencing is started -- -- -- -- -- -- -- Wait X seconds for cmd prompt after login -- -- -- -- -- -- -- Test X seconds for status change after ON/OFF -- -- -- -- -- -- -- Wait X seconds after issuing ON/OFF -- -- -- -- -- -- -- Wait X seconds for cmd prompt after issuing command -- -- -- -- -- -- -- Count of attempts to retry power on -- -- -- -- -- -- -- Path to ssh binary -- -- -- -- -- -- -- Path to telnet binary -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_ilo_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_ilo_metadata.xml -deleted file mode 100644 -index 5c6e1c3b..00000000 ---- a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_ilo_metadata.xml -+++ /dev/null -@@ -1,269 +0,0 @@ -- -- -- -- fence_ilo is an I/O Fencing agent used for HP servers with the Integrated Light Out (iLO) PCI card.The agent opens an SSL connection to the iLO card. Once the SSL connection is established, the agent is able to communicate with the iLO card through an XML stream. -- -- -- http://www.hp.com -- -- -- -- -- -- -- Fencing action -- -- -- -- -- -- -- Forces agent to use IPv4 addresses only -- -- -- -- -- -- -- Forces agent to use IPv6 addresses only -- -- -- -- -- -- -- IP address or hostname of fencing device -- -- -- -- -- -- -- IP address or hostname of fencing device -- -- -- -- -- -- -- TCP/UDP port to use for connection with device -- -- -- -- -- -- -- Login name -- -- -- -- -- -- -- Disable TLS negotiation and force SSL3.0. This should only be used for devices that do not support TLS1.0 and up. -- -- -- -- -- -- -- Login password or passphrase -- -- -- -- -- -- -- Script to run to retrieve password -- -- -- -- -- -- -- Login password or passphrase -- -- -- -- -- -- -- Script to run to retrieve password -- -- -- -- -- -- -- IP address or hostname of fencing device (together with --port-as-ip) -- -- -- -- -- -- -- IP address or hostname of fencing device (together with --port-as-ip) -- -- -- -- -- -- -- Force ribcl version to use -- -- -- -- -- -- -- Force ribcl version to use -- -- -- -- -- -- -- Use SSL connection with verifying certificate -- -- -- -- -- -- -- Use SSL connection without verifying certificate -- -- -- -- -- -- -- Use SSL connection with verifying certificate -- -- -- -- -- -- -- Disable TLS negotiation and force TLS1.0. This should only be used for devices that do not support TLS1.1 and up. -- -- -- -- -- -- -- Login name -- -- -- -- -- -- -- Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog. -- -- -- -- -- -- -- Verbose mode -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Display version information and exit -- -- -- -- -- -- -- Display help and exit -- -- -- -- -- -- -- Wait X seconds before fencing is started -- -- -- -- -- -- -- Wait X seconds for cmd prompt after login -- -- -- -- -- -- -- Make "port/plug" to be an alias to IP address -- -- -- -- -- -- -- Test X seconds for status change after ON/OFF -- -- -- -- -- -- -- Wait X seconds after issuing ON/OFF -- -- -- -- -- -- -- Wait X seconds for cmd prompt after issuing command -- -- -- -- -- -- -- Count of attempts to retry power on -- -- -- -- -- -- -- Path to gnutls-cli binary -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_action_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_action_metadata.xml -new file mode 100644 -index 00000000..fd40fa87 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_action_metadata.xml -@@ -0,0 +1,31 @@ -+ -+ -+ This is an agent with action parameter for pcs tests -+ -+ -+ -+ -+ -+ -+ Fencing action (null, off, on, [reboot], status, list, list-status, monitor, validate-all, metadata) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_method_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_method_metadata.xml -new file mode 100644 -index 00000000..cdccdd9c ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_method_metadata.xml -@@ -0,0 +1,32 @@ -+ -+ -+ This is an agent with method parameter for pcs tests -+ -+ -+ -+ -+ -+ -+ Method to fence -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_minimal_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_minimal_metadata.xml -new file mode 100644 -index 00000000..c9fa8008 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_minimal_metadata.xml -@@ -0,0 +1,22 @@ -+ -+ -+ This is a minimalistic agent for pcs tests -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_params_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_params_metadata.xml -new file mode 100644 -index 00000000..088ca985 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_params_metadata.xml -@@ -0,0 +1,107 @@ -+ -+ -+ This is an agent with params for pcs tests -+ -+ -+ -+ -+ -+ -+ Fencing action -+ -+ -+ -+ -+ -+ -+ IP address or hostname of fencing device -+ -+ -+ -+ -+ -+ -+ IP address or hostname of fencing device -+ -+ -+ -+ -+ -+ -+ Login name -+ -+ -+ -+ -+ -+ -+ Login password or passphrase -+ -+ -+ -+ -+ -+ -+ Login password or passphrase -+ -+ -+ -+ -+ -+ -+ Use SSH connection -+ -+ -+ -+ -+ -+ -+ Use SSH connection -+ -+ -+ -+ -+ -+ -+ Login name -+ -+ -+ -+ -+ -+ -+ Verbose mode -+ -+ -+ -+ -+ -+ -+ Write debug information to given file -+ -+ -+ -+ -+ -+ -+ Write debug information to given file -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_unfencing_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_unfencing_metadata.xml -new file mode 100644 -index 00000000..db211744 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_pcsmock_unfencing_metadata.xml -@@ -0,0 +1,22 @@ -+ -+ -+ This is an agent which provides unfencing for pcs tests -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_scsi_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_scsi_metadata.xml -deleted file mode 100644 -index 259a1593..00000000 ---- a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_scsi_metadata.xml -+++ /dev/null -@@ -1,182 +0,0 @@ -- -- -- fence_scsi is an I/O fencing agent that uses SCSI-3 persistent reservations to control access to shared storage devices. These devices must support SCSI-3 persistent reservations (SPC-3 or greater) as well as the "preempt-and-abort" subcommand. --The fence_scsi agent works by having each node in the cluster register a unique key with the SCSI device(s). Once registered, a single node will become the reservation holder by creating a "write exclusive, registrants only" reservation on the device(s). The result is that only registered nodes may write to the device(s). When a node failure occurs, the fence_scsi agent will remove the key belonging to the failed node from the device(s). The failed node will no longer be able to write to the device(s). A manual reboot is required. -- -- -- -- -- -- -- -- Fencing action -- -- -- -- -- -- -- Use the APTPL flag for registrations. This option is only used for the 'on' action. -- -- -- -- -- -- -- List of devices to use for current operation. Devices can be comma-separated list of raw devices (eg. /dev/sdc). Each device must support SCSI-3 persistent reservations. -- -- -- -- -- -- -- Key to use for the current operation. This key should be unique to a node. For the "on" action, the key specifies the key use to register the local node. For the "off" action, this key specifies the key to be removed from the device(s). -- -- -- -- -- -- -- Name of the node to be fenced. The node name is used to generate the key value used for the current operation. This option will be ignored when used with the -k option. -- -- -- -- -- -- -- Name of the node to be fenced. The node name is used to generate the key value used for the current operation. This option will be ignored when used with the -k option. -- -- -- -- -- -- -- Log output (stdout and stderr) to file -- -- -- -- -- -- -- Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog. -- -- -- -- -- -- -- Verbose mode -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Write debug information to given file -- -- -- -- -- -- -- Display version information and exit -- -- -- -- -- -- -- Display help and exit -- -- -- -- -- -- -- Wait X seconds before fencing is started -- -- -- -- -- -- -- Wait X seconds for cmd prompt after login -- -- -- -- -- -- -- Test X seconds for status change after ON/OFF -- -- -- -- -- -- -- Wait X seconds after issuing ON/OFF -- -- -- -- -- -- -- Wait X seconds for cmd prompt after issuing command -- -- -- -- -- -- -- Count of attempts to retry power on -- -- -- -- -- -- -- Path to corosync-cmapctl binary -- -- -- -- -- -- -- Path to sg_persist binary -- -- -- -- -- -- -- Path to sg_turs binary -- -- -- -- -- -- -- Path to vgs binary -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_xvm_metadata.xml b/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_xvm_metadata.xml -deleted file mode 100644 -index d359854e..00000000 ---- a/pcs_test/tools/bin_mock/pcmk/crm_resource.d/stonith__fence_xvm_metadata.xml -+++ /dev/null -@@ -1,120 +0,0 @@ -- -- -- fence_xvm is an I/O Fencing agent which can be used withvirtual machines. -- -- -- -- -- -- -- Specify (stdin) or increment (command line) debug level -- -- -- -- -- -- -- IP Family ([auto], ipv4, ipv6) -- -- -- -- -- -- -- Multicast address (default=225.0.0.12 / ff05::3:1) -- -- -- -- -- -- -- TCP, Multicast, or VMChannel IP port (default=1229) -- -- -- -- -- -- -- Multicast retransmit time (in 1/10sec; default=20) -- -- -- -- -- -- -- Authentication (none, sha1, [sha256], sha512) -- -- -- -- -- -- -- Packet hash strength (none, sha1, [sha256], sha512) -- -- -- -- -- -- -- Shared key file (default=/etc/cluster/fence_xvm.key) -- -- -- -- -- -- -- Virtual Machine (domain name) to fence -- -- -- -- -- -- -- Treat [domain] as UUID instead of domain name. This is provided for compatibility with older fence_xvmd installations. -- -- -- -- -- -- -- Fencing action (null, off, on, [reboot], status, list, list-status, monitor, validate-all, metadata) -- -- -- -- -- -- -- Fencing timeout (in seconds; default=30) -- -- -- -- -- -- -- Fencing delay (in seconds; default=0) -- -- -- -- -- -- -- Virtual Machine (domain name) to fence (deprecated; use port) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -diff --git a/pcs_test/tools/bin_mock/pcmk/crm_resource_mock.py b/pcs_test/tools/bin_mock/pcmk/crm_resource_mock.py -index f1d8d069..58cf25e6 100644 ---- a/pcs_test/tools/bin_mock/pcmk/crm_resource_mock.py -+++ b/pcs_test/tools/bin_mock/pcmk/crm_resource_mock.py -@@ -26,7 +26,6 @@ def get_arg_values(argv, name): - - - def main(): -- # pylint: disable=too-many-branches - argv = sys.argv[1:] - if not argv: - raise AssertionError() -@@ -52,10 +51,11 @@ def main(): - "ocf:pacemaker:remote", - "ocf:pacemaker:Stateful", - "ocf:pacemaker:SystemHealth", -- "stonith:fence_apc", -- "stonith:fence_ilo", -- "stonith:fence_scsi", -- "stonith:fence_xvm", -+ "stonith:fence_pcsmock_action", -+ "stonith:fence_pcsmock_method", -+ "stonith:fence_pcsmock_minimal", -+ "stonith:fence_pcsmock_params", -+ "stonith:fence_pcsmock_unfencing", - "systemd:test@a:b", - ) - # known_agents_map = {item.lower()} -@@ -63,21 +63,11 @@ def main(): - write_local_file_to_stdout( - "{}_metadata.xml".format(arg.replace(":", "__")) - ) -- elif arg == "ocf:pacemaker:nonexistent": -- sys.stderr.write( -- "Metadata query for ocf:pacemaker:nonexistent failed: " -- "Input/output error\n" -- ) -- raise SystemExit(5) -- elif arg == "stonith:fence_noexist": -+ else: - sys.stderr.write( -- "Agent fence_noexist not found or does not support meta-data: " -- "Invalid argument (22)\nMetadata query for " -- "stonith:fence_noexist failed: Input/output error\n" -+ "pcs mock error message: unable to load agent metadata" - ) -- raise SystemExit(5) -- else: -- raise AssertionError() -+ raise SystemExit(1) - elif arg in option_file_map: - if argv: - raise AssertionError() -@@ -100,7 +90,7 @@ def main(): - is_invalid = "fake=is_invalid=True" in argv - output = "" - if is_invalid: -- output = """Validation failure""" -+ output = """pcsmock validation failure""" - stdout = """ - - -diff --git a/pcs_test/tools/bin_mock/pcmk/stonith_admin.in b/pcs_test/tools/bin_mock/pcmk/stonith_admin.in -new file mode 100755 -index 00000000..bf48b5c4 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/stonith_admin.in -@@ -0,0 +1,5 @@ -+#!@PYTHON@ -+ -+from stonith_admin_mock import main -+ -+main() -diff --git a/pcs_test/tools/bin_mock/pcmk/stonith_admin_mock.py b/pcs_test/tools/bin_mock/pcmk/stonith_admin_mock.py -new file mode 100644 -index 00000000..133097b5 ---- /dev/null -+++ b/pcs_test/tools/bin_mock/pcmk/stonith_admin_mock.py -@@ -0,0 +1,60 @@ -+import os.path -+import sys -+from textwrap import dedent -+ -+CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) -+DATA_DIR = os.path.join(CURRENT_DIR, "{}.d".format(sys.argv[0])) -+ -+ -+def get_arg_values(argv, name): -+ values = [] -+ next_value = len(argv) -+ for i, value in enumerate(argv): -+ if value == name: -+ next_value = i + 1 -+ elif i == next_value: -+ values.append(value) -+ return values -+ -+ -+def main(): -+ argv = sys.argv[1:] -+ if not argv: -+ raise AssertionError() -+ -+ arg = argv.pop(0) -+ -+ if arg == "--validate": -+ if get_arg_values(argv, "--output-as")[0] != "xml": -+ raise AssertionError() -+ is_invalid = False -+ for arg in argv: -+ if "=" in arg and arg.split("=", 1)[1] == "is_invalid=True": -+ is_invalid = True -+ break -+ output = "" -+ if is_invalid: -+ output = """pcsmock validation failure""" -+ cmd_str = " ".join(sys.argv) -+ agent_type = get_arg_values(argv, "--agent")[0] -+ stdout = dedent( -+ f""" -+ -+ -+ -+ {output} -+ -+ -+ -+ -+ """ -+ ) -+ sys.stdout.write(stdout) -+ if is_invalid: -+ raise SystemExit(1) -+ else: -+ raise AssertionError() -+ -+ -+if __name__ == "__main__": -+ main() --- -2.45.2 - diff --git a/pcs.spec b/pcs.spec index 2e39495..90ce7d8 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,5 +1,5 @@ Name: pcs -Version: 0.11.8 +Version: 0.11.9 Release: 1%{?dist} # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses @@ -11,33 +11,51 @@ Group: System Environment/Base Summary: Pacemaker/Corosync Configuration System BuildArch: noarch -# When specifying a commit, use its long hash -%global version_or_commit %{version} -# %%global version_or_commit 10069ca47e5c9f4ac1abd8bc4cd99281ead047b7 +# Remove a tilde used by RPM to get the correct upstream version +%global clean_version %(echo %{version} | sed 's/~//') + +# To build an official pcs release, comment out branch_or_commit +# Use long commit hash or branch name to build an unreleased version +# %%global branch_or_commit 1353dfbb3af82d77f4de17a3fa4cbde185bb2b2d +%if 0%{?branch_or_commit:1} + %global version_or_commit %{branch_or_commit} +%else + %global version_or_commit %{clean_version} +%endif %global pcs_source_name %{name}-%{version_or_commit} -# ui_commit can be determined by hash, tag or branch -%global ui_commit 0.1.20 -%global ui_modules_version 0.1.20 -%global ui_src_name pcs-web-ui-%{ui_commit} +# To build an official pcs-web-ui release, comment out ui_branch_or_commit +# Last tagged version, also used as fallback version for untagged tarballs +%global ui_version 0.1.22 +%global ui_modules_version 0.1.22 +# Use long commit hash or branch name to build an unreleased version +# %%global ui_branch_or_commit 34372d1268f065ed186546f55216aaa2d7e76b54 +%if 0%{?ui_branch_or_commit:1} + %global ui_version_or_commit %{ui_branch_or_commit} +%else + %global ui_version_or_commit %{ui_version} +%endif +%global ui_src_name pcs-web-ui-%{ui_version_or_commit} + %global pyagentx_version 0.4.pcs.2 -%global dacite_version 1.8.1 +%global dacite_version 1.9.2 %global required_pacemaker_version 2.1.0 %global pcs_bundled_dir pcs_bundled -%global pcsd_public_dir pcsd/public -%global ui_build_dir_standalone build_standalone -%global ui_build_dir_cockpit build_cockpit -%global ui_cockpit_dest ha-cluster -%global ui_appstream_metainfo org.clusterlabs.cockpit_pcs_web_ui.metainfo.xml +%global pcsd_webui_dir %{_prefix}/lib/pcsd/public/ui + +%global cockpit_dir %{_datadir}/cockpit/ +%global metainfo_dir %{_datadir}/metainfo +%global ui_metainfo_name org.clusterlabs.cockpit_pcs_web_ui.metainfo.xml +%global ui_metainfo %{metainfo_dir}/%{ui_metainfo_name} %global pkg_pcs_snmp pcs-snmp %global pkg_cockpit_ha_cluster cockpit-ha-cluster # prepend v for folder in GitHub link when using tagged tarball -%if "%{version}" == "%{version_or_commit}" +%if "%{clean_version}" == "%{version_or_commit}" %global v_prefix v %endif @@ -47,12 +65,11 @@ Source0: %{url}/archive/%{?v_prefix}%{version_or_commit}/%{pcs_source_name}.tar. Source41: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}/pyagentx-%{pyagentx_version}.tar.gz Source42: https://github.com/konradhalas/dacite/archive/v%{dacite_version}/dacite-%{dacite_version}.tar.gz -Source100: https://github.com/ClusterLabs/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz -Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_modules_version}.tar.xz +Source100: https://github.com/ClusterLabs/pcs-web-ui/archive/%{ui_version_or_commit}/%{ui_src_name}.tar.gz +Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_version_or_commit}/pcs-web-ui-node-modules-%{ui_modules_version}.tar.xz # pcs patches: <= 200 # Patch0: name.patch -Patch0: overhaul-fence-agents-mocking.patch # ui patches: >200 # Patch201: name-web-ui.patch @@ -65,6 +82,8 @@ BuildRequires: automake BuildRequires: make # printf from coreutils is used in makefile, head is used in spec BuildRequires: coreutils +# find is used in Makefile and also somewhere else +BuildRequires: findutils # python for pcs BuildRequires: python3 >= 3.9 BuildRequires: python3-dateutil >= 2.7.0 @@ -100,17 +119,20 @@ BuildRequires: rubygem(rexml) BuildRequires: rubygem-test-unit # for touching patch files (sanitization function) BuildRequires: diffstat -# for post, preun and postun macros -BuildRequires: systemd +# for systemd scriptlet macros +BuildRequires: systemd-rpm-macros # pam is used for authentication inside daemon (python ctypes) # needed for tier0 tests during build BuildRequires: pam # for working with qdevice certificates (certutil) - used in configure.ac BuildRequires: nss-tools +# pcs now provides a pc file +BuildRequires: pkgconfig # for building web ui BuildRequires: nodejs-npm + # cluster stack packages for pkg-config # corosync has different package names on distributions but all provide # corosync-devel @@ -144,7 +166,6 @@ Requires: rubygem-mustermann Requires: rubygem-puma Requires: rubygem-rack Requires: rubygem-rack-protection -Requires: rubygem-rack-test Requires: rubygem-sinatra Requires: rubygem-tilt %if 0%{?fedora} || 0%{?rhel} >= 9 @@ -159,10 +180,6 @@ Requires: (corosync >= 3.0 if pacemaker) # pcs enables corosync encryption by default so we require libknet1-plugins-all Requires: (libknet1-plugins-all if corosync) Requires: pacemaker-cli >= %{required_pacemaker_version} -# for post, preun and postun macros -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd # pam is used for authentication inside daemon (python ctypes) # more details: https://bugzilla.redhat.com/show_bug.cgi?id=1717113 Requires: pam @@ -175,6 +192,7 @@ Requires: nss-tools Provides: bundled(dacite) = %{dacite_version} + # pcs-snmp subpackage definition %package -n %{pkg_pcs_snmp} Group: System Environment/Base @@ -209,6 +227,7 @@ Requires: pcs = %{version}-%{release} Requires: cockpit-bridge + %description pcs is a corosync and pacemaker configuration tool. It permits users to easily view, modify and create pacemaker based clusters. @@ -221,8 +240,9 @@ SNMP agent that provides information about pacemaker cluster to the master agent Cockpit application for managing Pacemaker based clusters. Uses Pacemaker/Corosync Configuration System (pcs) in the background. -%prep + +%prep # -- following is inspired by python-simplejon.el5 -- # Update timestamps on the files touched by a patch, to avoid non-equal # .pyc/.pyo files across the multilib peers within a build @@ -266,7 +286,16 @@ update_times_patch(){ # * http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html # * https://rpm-software-management.github.io/rpm/manual/autosetup.html # patch web-ui sources -%autosetup -D -T -b 100 -a 101 -S git -n %{ui_src_name} -N +# -n — Set Name of Build Directory +# -T — Do Not Perform Default Archive Unpacking +# -b — Unpack The nth Sources Before Changing Directory +# -a — Unpack The nth Sources After Changing Directory +# -N — disables automatic patch application, use autopatch to apply patches +# +# 1. unpack sources (-b 100) +# 2. then cd into sources tree (the setup macro itself) +# 3. then unpack node_modules into sources tree (-a 101). +%autosetup -T -b 100 -a 101 -N -n %{ui_src_name} %autopatch -p1 -m 201 # update_times_patch %%{PATCH201} @@ -274,12 +303,16 @@ update_times_patch(){ %autosetup -S git -n %{pcs_source_name} -N %autopatch -p1 -M 200 # update_times_patch %%{PATCH0} -update_times_patch %{PATCH0} + # generate .tarball-version if building from an untagged commit, not a released version # autogen uses git-version-gen which uses .tarball-version for generating version number -%if "%{version}" != "%{version_or_commit}" - echo "%version+$(echo "%{version_or_commit}" | head -c 8)" > %{_builddir}/%{pcs_source_name}/.tarball-version +%if "%{clean_version}" != "%{version_or_commit}" + echo "%{clean_version}+$(echo "%{version_or_commit}" | head -c 8)" > %{_builddir}/%{pcs_source_name}/.tarball-version +%endif + +%if "x%{?ui_branch_or_commit}" != "x" + echo "%{ui_version}+$(echo "%{ui_branch_or_commit}" | head -c 8)" > %{_builddir}/%{ui_src_name}/.tarball-version %endif # prepare dirs/files necessary for building python bundles @@ -288,47 +321,40 @@ cp -f %SOURCE41 rpm/ cp -f %SOURCE42 rpm/ + %build %define debug_package %{nil} ./autogen.sh %{configure} --enable-local-build --enable-use-local-cache-only \ - --enable-individual-bundling \ + --enable-individual-bundling --enable-webui \ --with-pcsd-default-cipherlist='PROFILE=SYSTEM' \ --with-pcs-lib-dir="%{_prefix}/lib" PYTHON=%{__python3} make all -# build pcs-web-ui -export BUILD_USE_CURRENT_NODE_MODULES=true +# Web UI installation +# Switch to web ui folder first +cd ../%{ui_src_name} +./autogen.sh +%{configure} \ + --with-pcsd-webui-dir=%{pcsd_webui_dir} \ + --with-cockpit-dir=%{cockpit_dir} \ + --with-metainfo-dir=%{metainfo_dir} +make all -## standalone -export BUILD_DIR=%{_builddir}/%{ui_src_name}/%{ui_build_dir_standalone} -make -C %{_builddir}/%{ui_src_name} build - -## cockpit -export BUILD_DIR=%{_builddir}/%{ui_src_name}/%{ui_build_dir_cockpit} -export BUILD_FOR_COCKPIT=true -make -C %{_builddir}/%{ui_src_name} build %install -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} pwd - +# Install cockpit pcs-web-ui +cd ../%{ui_src_name} %make_install -# install standalone pcs-web-ui -cp -r %{_builddir}/%{ui_src_name}/%{ui_build_dir_standalone} \ - ${RPM_BUILD_ROOT}%{_prefix}/lib/%{pcsd_public_dir}/ui -# install cockpit pcs-web-ui -mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/cockpit/%{ui_cockpit_dest} -mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/metainfo -cp -r %{_builddir}/%{ui_src_name}/%{ui_build_dir_cockpit}/* \ - ${RPM_BUILD_ROOT}%{_datadir}/cockpit/%{ui_cockpit_dest} - -cp -r %{_builddir}/%{ui_src_name}/packages/app/%{ui_appstream_metainfo} \ - ${RPM_BUILD_ROOT}%{_datadir}/metainfo/ +# Install pcs +cd ../%{pcs_source_name} +%make_install # prepare license files cp %{pcs_bundled_dir}/src/pyagentx-*/LICENSE.txt pyagentx_LICENSE.txt @@ -339,9 +365,10 @@ cp %{pcs_bundled_dir}/src/dacite-*/LICENSE dacite_LICENSE cp %{pcs_bundled_dir}/src/dacite-*/README.md dacite_README.md + %check # Run validation of cockpit metainfo -appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/metainfo/%{ui_appstream_metainfo} +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/%{ui_metainfo_name} # In the building environment LC_CTYPE is set to C which causes tests to fail # due to python prints a warning about it to stderr. The following environment @@ -366,7 +393,7 @@ run_all_tests(){ #run pcsd tests and remove them ruby \ - -I$RPM_BUILD_ROOT%{_prefix}/lib/pcsd \ + -I%{buildroot}%{_prefix}/lib/pcsd \ -Ipcsd/test \ pcsd/test/test_all_suite.rb test_result_ruby=$? @@ -379,6 +406,8 @@ run_all_tests(){ run_all_tests + + %posttrans # Make sure the new version of the daemon is running. # Also, make sure to start pcsd-ruby if it hasn't been started or even @@ -386,7 +415,6 @@ run_all_tests %{_bindir}/systemctl daemon-reload %{_bindir}/systemctl try-restart pcsd.service - %post %systemd_post pcsd.service %systemd_post pcsd-ruby.service @@ -408,6 +436,8 @@ run_all_tests %postun -n %{pkg_pcs_snmp} %systemd_postun_with_restart pcs_snmp_agent.service + + %files %doc CHANGELOG.md %doc README.md @@ -418,6 +448,7 @@ run_all_tests %{_sbindir}/pcs %{_sbindir}/pcsd %{_prefix}/lib/pcs/* +%{_prefix}/lib/pkgconfig/pcs.pc %{_prefix}/lib/pcsd/* %{_unitdir}/pcsd.service %{_unitdir}/pcsd-ruby.service @@ -438,8 +469,8 @@ run_all_tests %{_mandir}/man8/pcsd.* %exclude %{_prefix}/lib/pcs/pcs_snmp_agent %exclude %{_prefix}/lib/pcs/%{pcs_bundled_dir}/packages/pyagentx* -%exclude %{_datadir}/cockpit -%exclude %{_datadir}/metainfo/%{ui_appstream_metainfo} +%exclude %{cockpit_dir} +%exclude %{ui_metainfo} %files -n %{pkg_pcs_snmp} %{_prefix}/lib/pcs/pcs_snmp_agent @@ -455,11 +486,16 @@ run_all_tests %license pyagentx_LICENSE.txt %files -n %{pkg_cockpit_ha_cluster} -%{_datadir}/cockpit/%{ui_cockpit_dest} -%{_datadir}/metainfo/%{ui_appstream_metainfo} +%{cockpit_dir} +%{ui_metainfo} + %changelog +* Mon Feb 10 2025 Michal Pospíšil - 0.11.9-1 +- Rebased to the latest sources (see CHANGELOG.md) +- Updated pcs-web-ui to 0.1.22 + * Tue Aug 6 2024 Michal Pospíšil - 0.11.8-1 - Rebased to the latest sources (see CHANGELOG.md) - Updated pcs-web-ui to 0.1.20 diff --git a/prepare-tests.sh b/prepare-tests.sh index 5ecdf1c..0dc62e1 100755 --- a/prepare-tests.sh +++ b/prepare-tests.sh @@ -4,10 +4,10 @@ set -eo xtrace cd $TMT_SOURCE_DIR # Use stamp file to abort if this script already ran if [ -e tests-prepared-stamp ]; then exit 0; fi -# RPM 4.20 changed the builddir structure - unpacked sources go to *-build but -# tmt copies them back to pcs-*, so the pcs-*-build folder is empty -# Remove pcs-web-ui, pcs-*-build for "cd pcs-*" to have exactly one match -rm -rf pcs-web-ui-* pcs-*-build +# Remove *SPECPARTS folders generated by rpmbuild +rm -rfv *SPECPARTS +# Remove pcs-web-ui for "cd pcs-*" to have exactly one match +rm -rf pcs-web-ui-* cd pcs-*/ # Run autotools, use bundled dependencies from the system export PYTHONPATH=/usr/lib/pcs/pcs_bundled/packages/ @@ -16,7 +16,7 @@ export GEM_HOME=/usr/lib/pcsd/vendor/bundle/ # autogen and configure with expanded TMT_SOURCE_DIR will match that too ./autogen.sh ./configure --enable-local-build --enable-use-local-cache-only \ - --enable-individual-bundling --with-pcs-lib-dir=/usr/lib + --enable-individual-bundling --enable-webui --with-pcs-lib-dir=/usr/lib # Remove pcs sources to make sure tests are not using any of those files rm -rf pcs touch ../tests-prepared-stamp diff --git a/sources b/sources index 7582c05..2b5f606 100644 --- a/sources +++ b/sources @@ -1,5 +1,5 @@ SHA512 (pyagentx-0.4.pcs.2.tar.gz) = d4194fec9a3e5fefe3793d49b7fec1feafef294c7e613a06046c2993daeefc5cb39d7c5b2b402ff83e49b2d976953f862264288c758c0be09d997b5323cc558a -SHA512 (dacite-1.8.1.tar.gz) = 4b40c0bdcf5490bcc77de9e7f04b7267642bcfd41e4168607a5457f38abe3ad4b3041d8a23cb43af76de14eabee45f900ad5ddf7af8f70a2be4850bccc2d3af1 -SHA512 (pcs-0.11.8.tar.gz) = 2705b612c602e9052405e448dc189f632f0266bf0d8381981a1dca709f3e851e90745bc02c2f9dfaa9e84d9ab0f3f1287467388d7d584e7e9e5ec4a46b8c2076 -SHA512 (pcs-web-ui-0.1.20.tar.gz) = 83117eafbe694b133228dfd8d7de30a7cc58693b8844f7d1af9c12c02618a7af8dd10c374b56c3e722d84c5691488f25bfc3389f22954935a2e6dd42b16c7b2c -SHA512 (pcs-web-ui-node-modules-0.1.20.tar.xz) = 94cd6a306a6784c3decc351b1469efe98beadd43efbfa7848ccc6146be32f704281432669589e2c666b431a32bd6caf101fa08fb05deaab2b58a8cda8b40b85d +SHA512 (pcs-web-ui-0.1.22.tar.gz) = cb97ffba625326ab3857b9c22b4400907177a5ea88769ae611cc9315758c1ceca7e16a1b92d43fc594911fcde6003d3beadb388c6bdd5c1bcc67d699c49c9b2c +SHA512 (pcs-web-ui-node-modules-0.1.22.tar.xz) = b1db7d8c04e942baf8a99f115cbda31a84f562c7deeee5f1371e5ddf5fb5e73ce084ede1f0da7083b2d0114228f58006599f1b9a29dd3a5202b3119e41f74d69 +SHA512 (pcs-0.11.9.tar.gz) = 6666edfdd1850757e05eca2fd63df3262ef9870c94e1a0c5fd26358cac4f22dcb132bf1ee5c15d4fdc32cb067e2d142d3dd669ef40443cf60539e35ab662614e +SHA512 (dacite-1.9.2.tar.gz) = 69513bc1acd43e45a208ce4b4186072f92d9057a6a88c77d56f21405fbed7964d94fe4f6a37c99754a793caa2bd0584664dfab69169ef0d3564bb09d37769e59