diff --git a/bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch b/bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch new file mode 100644 index 0000000..1a8dc60 --- /dev/null +++ b/bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch @@ -0,0 +1,46 @@ +From f863c38497eb716141c9e585ddb418191e9fc2a4 Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Fri, 15 Jul 2022 15:55:57 +0200 +Subject: [PATCH 3/3] booth sync: check whether /etc/booth exists + +--- + pcsd/pcsd_file.rb | 6 +----- + pcsd/remote.rb | 4 ++++ + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/pcsd/pcsd_file.rb b/pcsd/pcsd_file.rb +index d82b55d2..394db59a 100644 +--- a/pcsd/pcsd_file.rb ++++ b/pcsd/pcsd_file.rb +@@ -112,12 +112,8 @@ module PcsdFile + end + end + +- def dir() +- return BOOTH_CONFIG_DIR +- end +- + def full_file_name() +- @full_file_name ||= File.join(self.dir, @file[:name]) ++ @full_file_name ||= File.join(BOOTH_CONFIG_DIR, @file[:name]) + end + end + +diff --git a/pcsd/remote.rb b/pcsd/remote.rb +index 854674eb..144d25f3 100644 +--- a/pcsd/remote.rb ++++ b/pcsd/remote.rb +@@ -2090,6 +2090,10 @@ def booth_set_config(params, request, auth_user) + check_permissions(auth_user, Permissions::WRITE) + data = check_request_data_for_json(params, auth_user) + ++ if not File.directory?(BOOTH_CONFIG_DIR) ++ raise "Configuration directory for booth '/etc/booth' is missing. Is booth installed?" ++ end ++ + PcsdExchangeFormat::validate_item_map_is_Hash('files', data) + PcsdExchangeFormat::validate_item_is_Hash('file', :config, data[:config]) + if data[:authfile] +-- +2.35.3 + diff --git a/bz2058243-01-code-formatting.patch b/bz2058243-01-code-formatting.patch new file mode 100644 index 0000000..7868ae8 --- /dev/null +++ b/bz2058243-01-code-formatting.patch @@ -0,0 +1,2491 @@ +From 8859f3450df675579d24e4bd3d5e12aeefbaef54 Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Thu, 14 Jul 2022 16:22:39 +0200 +Subject: [PATCH 1/3] code formatting + +--- + pcs_test/tier0/lib/commands/test_booth.py | 1684 +++++++++------------ + 1 file changed, 723 insertions(+), 961 deletions(-) + +diff --git a/pcs_test/tier0/lib/commands/test_booth.py b/pcs_test/tier0/lib/commands/test_booth.py +index 6dc0cf3e..2b20a199 100644 +--- a/pcs_test/tier0/lib/commands/test_booth.py ++++ b/pcs_test/tier0/lib/commands/test_booth.py +@@ -211,22 +211,23 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + ) + self.env_assist.assert_reports( +- [fixture.error(reports.codes.BOOTH_EVEN_PEERS_NUM, number=4)] ++ [ ++ fixture.error(reports.codes.BOOTH_EVEN_PEERS_NUM, number=4), ++ ] + ) + + def fixture_config_success(self, instance_name="booth"): +- ( +- self.config.raw_file.write( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(instance_name), +- RANDOM_KEY, +- name="raw_file.write.key", +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- self.fixture_cfg_content(self.fixture_key_path(instance_name)), +- name="raw_file.write.cfg", +- ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(instance_name), ++ RANDOM_KEY, ++ name="raw_file.write.key", ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ self.fixture_cfg_content(self.fixture_key_path(instance_name)), ++ name="raw_file.write.cfg", + ) + + def test_success_default_instance(self): +@@ -248,19 +249,18 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + + def test_files_exist_config(self): +- ( +- self.config.raw_file.write( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- RANDOM_KEY, +- name="raw_file.write.key", +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content(), +- already_exists=True, +- name="raw_file.write.cfg", +- ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ RANDOM_KEY, ++ name="raw_file.write.key", ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content(), ++ already_exists=True, ++ name="raw_file.write.cfg", + ) + + self.env_assist.assert_raise_library_error( +@@ -283,14 +283,12 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + + def test_files_exist_key(self): +- ( +- self.config.raw_file.write( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- RANDOM_KEY, +- already_exists=True, +- name="raw_file.write.key", +- ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ RANDOM_KEY, ++ already_exists=True, ++ name="raw_file.write.key", + ) + + self.env_assist.assert_raise_library_error( +@@ -313,20 +311,19 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + + def test_files_exist_forced(self): +- ( +- self.config.raw_file.write( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- RANDOM_KEY, +- can_overwrite=True, +- name="raw_file.write.key", +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content(), +- can_overwrite=True, +- name="raw_file.write.cfg", +- ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ RANDOM_KEY, ++ can_overwrite=True, ++ name="raw_file.write.key", ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content(), ++ can_overwrite=True, ++ name="raw_file.write.cfg", + ) + + commands.config_setup( +@@ -337,7 +334,6 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + + def _assert_write_config_error(self, error, booth_dir_exists): +- + self.config.raw_file.write( + file_type_codes.BOOTH_KEY, + self.fixture_key_path(), +@@ -444,11 +440,7 @@ class ConfigSetup(TestCase, FixtureMixin): + ) + env = self.env_assist.get_env() + +- commands.config_setup( +- env, +- self.sites, +- self.arbitrators, +- ) ++ commands.config_setup(env, self.sites, self.arbitrators) + + self.assertEqual( + env.get_booth_env(name="").export(), +@@ -491,38 +483,34 @@ class ConfigDestroy(TestCase, FixtureMixin): + self.env_assist, self.config = get_env_tools(self) + + def fixture_config_booth_not_used(self, instance_name="booth"): +- ( +- self.config.runner.cib.load() +- .services.is_running( +- "booth", instance=instance_name, return_value=False +- ) +- .services.is_enabled( +- "booth", instance=instance_name, return_value=False +- ) ++ self.config.runner.cib.load() ++ self.config.services.is_running( ++ "booth", instance=instance_name, return_value=False ++ ) ++ self.config.services.is_enabled( ++ "booth", instance=instance_name, return_value=False + ) + + def fixture_config_success(self, instance_name="booth"): + self.fixture_config_booth_not_used(instance_name) +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- content=self.fixture_cfg_content( +- self.fixture_key_path(instance_name) +- ), +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(instance_name), +- fail_if_file_not_found=False, +- name="raw_file.remove.key", +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ content=self.fixture_cfg_content( ++ self.fixture_key_path(instance_name) ++ ), ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(instance_name), ++ fail_if_file_not_found=False, ++ name="raw_file.remove.key", ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + + def test_invalid_instance(self): +@@ -540,9 +528,7 @@ class ConfigDestroy(TestCase, FixtureMixin): + + def test_success_default_instance(self): + self.fixture_config_success() +- commands.config_destroy( +- self.env_assist.get_env(), +- ) ++ commands.config_destroy(self.env_assist.get_env()) + + def test_success_custom_instance(self): + instance_name = "my_booth" +@@ -553,23 +539,20 @@ class ConfigDestroy(TestCase, FixtureMixin): + + def test_success_no_booth_key(self): + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=bytes(), +- ).raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=bytes(), + ) +- +- commands.config_destroy( +- self.env_assist.get_env(), ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + ++ commands.config_destroy(self.env_assist.get_env()) ++ + def test_not_live_booth(self): + self.config.env.set_booth( + { +@@ -603,9 +586,7 @@ class ConfigDestroy(TestCase, FixtureMixin): + [ + fixture.error( + reports.codes.LIVE_ENVIRONMENT_REQUIRED, +- forbidden_options=[ +- file_type_codes.CIB, +- ], ++ forbidden_options=[file_type_codes.CIB], + ), + ], + expected_in_processor=False, +@@ -640,20 +621,16 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_booth_config_in_use(self): + instance_name = "booth" + +- ( +- self.config.runner.cib.load(resources=self.fixture_cib_resources()) +- .services.is_running( +- "booth", instance=instance_name, return_value=True +- ) +- .services.is_enabled( +- "booth", instance=instance_name, return_value=True +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_resources()) ++ self.config.services.is_running( ++ "booth", instance=instance_name, return_value=True ++ ) ++ self.config.services.is_enabled( ++ "booth", instance=instance_name, return_value=True + ) + + self.env_assist.assert_raise_library_error( +- lambda: commands.config_destroy( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_destroy(self.env_assist.get_env()), + ) + + self.env_assist.assert_reports( +@@ -682,18 +659,14 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_cannot_read_config(self): + error = "an error" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, + ) + + self.env_assist.assert_raise_library_error( +- lambda: commands.config_destroy( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_destroy(self.env_assist.get_env()), + ) + self.env_assist.assert_reports( + [ +@@ -711,17 +684,16 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_cannot_read_config_forced(self): + error = "an error" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ).raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + + commands.config_destroy( +@@ -742,18 +714,14 @@ class ConfigDestroy(TestCase, FixtureMixin): + + def test_config_parse_error(self): + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content="invalid config".encode("utf-8"), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content="invalid config".encode("utf-8"), + ) + + self.env_assist.assert_raise_library_error( +- lambda: commands.config_destroy( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_destroy(self.env_assist.get_env()), + ) + self.env_assist.assert_reports( + [ +@@ -768,17 +736,16 @@ class ConfigDestroy(TestCase, FixtureMixin): + + def test_config_parse_error_forced(self): + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content="invalid config".encode("utf-8"), +- ).raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content="invalid config".encode("utf-8"), ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + + commands.config_destroy( +@@ -797,52 +764,45 @@ class ConfigDestroy(TestCase, FixtureMixin): + + def test_key_already_deleted(self): + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- fail_if_file_not_found=False, +- file_not_found_exception=True, +- name="raw_file.remove.key", +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), + ) +- +- commands.config_destroy( +- self.env_assist.get_env(), ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ fail_if_file_not_found=False, ++ file_not_found_exception=True, ++ name="raw_file.remove.key", ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + ++ commands.config_destroy(self.env_assist.get_env()) ++ + def test_cannot_delete_key(self): + error = "an error" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ).raw_file.remove( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- fail_if_file_not_found=False, +- exception_msg=error, +- name="raw_file.remove.key", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ fail_if_file_not_found=False, ++ exception_msg=error, ++ name="raw_file.remove.key", + ) + + self.env_assist.assert_raise_library_error( +- lambda: commands.config_destroy( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_destroy(self.env_assist.get_env()), + ) + self.env_assist.assert_reports( + [ +@@ -860,25 +820,23 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_cannot_delete_key_forced(self): + error = "an error" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- fail_if_file_not_found=False, +- exception_msg=error, +- name="raw_file.remove.key", +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ fail_if_file_not_found=False, ++ exception_msg=error, ++ name="raw_file.remove.key", ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) + + commands.config_destroy( +@@ -900,31 +858,27 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_cannot_delete_config_forced(self): + error = "an error" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- fail_if_file_not_found=False, +- name="raw_file.remove.key", +- ) +- .raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- exception_msg=error, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ fail_if_file_not_found=False, ++ name="raw_file.remove.key", ++ ) ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ exception_msg=error, ++ name="raw_file.remove.cfg", + ) + + self.env_assist.assert_raise_library_error( +- lambda: commands.config_destroy( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_destroy(self.env_assist.get_env()), + ) + self.env_assist.assert_reports( + [ +@@ -941,22 +895,19 @@ class ConfigDestroy(TestCase, FixtureMixin): + def test_keyfile_outside_of_booth_dir(self): + key_path = "/tmp/pcs_test/booth.key" + self.fixture_config_booth_not_used() +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=f"authfile = {key_path}".encode("utf-8"), +- ).raw_file.remove( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- fail_if_file_not_found=True, +- name="raw_file.remove.cfg", +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=f"authfile = {key_path}".encode("utf-8"), + ) +- +- commands.config_destroy( +- self.env_assist.get_env(), ++ self.config.raw_file.remove( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ fail_if_file_not_found=True, ++ name="raw_file.remove.cfg", + ) ++ ++ commands.config_destroy(self.env_assist.get_env()) + self.env_assist.assert_reports( + [ + fixture.warn( +@@ -987,29 +938,23 @@ class ConfigText(TestCase, FixtureMixin): + + def test_success_default_instance(self): + config_content = "my config content".encode("utf-8") +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=config_content, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=config_content, + ) + self.assertEqual( +- commands.config_text( +- self.env_assist.get_env(), +- ), ++ commands.config_text(self.env_assist.get_env()), + config_content, + ) + + def test_success_custom_instance(self): + instance_name = "my_booth" + config_content = "my config content".encode("utf-8") +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- content=config_content, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ content=config_content, + ) + self.assertEqual( + commands.config_text( +@@ -1029,9 +974,7 @@ class ConfigText(TestCase, FixtureMixin): + } + ) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_text( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_text(self.env_assist.get_env()), + [ + fixture.error( + reports.codes.LIVE_ENVIRONMENT_REQUIRED, +@@ -1046,17 +989,13 @@ class ConfigText(TestCase, FixtureMixin): + + def test_cannot_read_config(self): + error = "an error" +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_text( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_text(self.env_assist.get_env()), + ) + self.env_assist.assert_reports( + [ +@@ -1073,12 +1012,10 @@ class ConfigText(TestCase, FixtureMixin): + def test_remote_success(self): + instance_name = "my_booth" + config_content = "my config content" +- ( +- self.config.http.booth.get_config( +- instance_name, +- config_data=config_content, +- node_labels=["node1"], +- ) ++ self.config.http.booth.get_config( ++ instance_name, ++ config_data=config_content, ++ node_labels=["node1"], + ) + self.assertEqual( + commands.config_text( +@@ -1095,22 +1032,19 @@ class ConfigText(TestCase, FixtureMixin): + server_error = ( + "some error like 'config does not exist' or 'instance name invalid'" + ) +- ( +- self.config.http.booth.get_config( +- instance_name, +- communication_list=[ +- dict( +- label=node_name, +- response_code=400, +- output=server_error, +- ) +- ], +- ) ++ self.config.http.booth.get_config( ++ instance_name, ++ communication_list=[ ++ dict( ++ label=node_name, ++ response_code=400, ++ output=server_error, ++ ) ++ ], + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_text( +- self.env_assist.get_env(), +- node_name=node_name, ++ self.env_assist.get_env(), node_name=node_name + ), + ) + self.env_assist.assert_reports( +@@ -1127,21 +1061,18 @@ class ConfigText(TestCase, FixtureMixin): + def test_remote_bad_response(self): + instance_name = "booth" + node_name = "node1" +- ( +- self.config.http.booth.get_config( +- instance_name, +- communication_list=[ +- dict( +- label=node_name, +- output="not a json", +- ) +- ], +- ) ++ self.config.http.booth.get_config( ++ instance_name, ++ communication_list=[ ++ dict( ++ label=node_name, ++ output="not a json", ++ ) ++ ], + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_text( +- self.env_assist.get_env(), +- node_name=node_name, ++ self.env_assist.get_env(), node_name=node_name + ), + ) + self.env_assist.assert_reports( +@@ -1157,23 +1088,20 @@ class ConfigText(TestCase, FixtureMixin): + instance_name = "booth" + node_name = "node1" + error = "an error" +- ( +- self.config.http.booth.get_config( +- instance_name, +- communication_list=[ +- dict( +- label=node_name, +- was_connected=False, +- errno=1, +- error_msg=error, +- ) +- ], +- ) ++ self.config.http.booth.get_config( ++ instance_name, ++ communication_list=[ ++ dict( ++ label=node_name, ++ was_connected=False, ++ errno=1, ++ error_msg=error, ++ ) ++ ], + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_text( +- self.env_assist.get_env(), +- node_name=node_name, ++ self.env_assist.get_env(), node_name=node_name + ), + ) + self.env_assist.assert_reports( +@@ -1208,22 +1136,21 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def fixture_config_success(self, instance_name="booth"): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- content=self.fixture_cfg_content( +- self.fixture_key_path(instance_name) +- ), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- self.fixture_cfg_content( +- self.fixture_key_path(instance_name), +- ticket_list=[["ticketA", []]], +- ), +- can_overwrite=True, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ content=self.fixture_cfg_content( ++ self.fixture_key_path(instance_name) ++ ), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ self.fixture_cfg_content( ++ self.fixture_key_path(instance_name), ++ ticket_list=[["ticketA", []]], ++ ), ++ can_overwrite=True, + ) + + def test_success_default_instance(self): +@@ -1268,21 +1195,20 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def test_success_ticket_options(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketA", [("retries", "10"), ("timeout", "20")]] +- ] +- ), +- can_overwrite=True, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content( ++ ticket_list=[ ++ ["ticketA", [("retries", "10"), ("timeout", "20")]] ++ ] ++ ), ++ can_overwrite=True, + ) + commands.config_ticket_add( + self.env_assist.get_env(), +@@ -1291,12 +1217,10 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def test_ticket_already_exists(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(ticket_list=[["ticketA", []]]), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(ticket_list=[["ticketA", []]]), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_add( +@@ -1316,12 +1240,10 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def test_validator_errors(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_add( +@@ -1356,19 +1278,16 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def test_invalid_ticket_options_forced(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[["ticketA", [("a", "A")]]] +- ), +- can_overwrite=True, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content(ticket_list=[["ticketA", [("a", "A")]]]), ++ can_overwrite=True, + ) + commands.config_ticket_add( + self.env_assist.get_env(), +@@ -1399,12 +1318,10 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + ) + + def test_config_parse_error(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content="invalid config".encode("utf-8"), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content="invalid config".encode("utf-8"), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_add( +@@ -1425,12 +1342,10 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + + def test_cannot_read_config(self): + error = "an error" +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_add( +@@ -1480,18 +1395,17 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + + def test_cannot_write_config(self): + error = "an error" +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content(ticket_list=[["ticketA", []]]), +- can_overwrite=True, +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content(ticket_list=[["ticketA", []]]), ++ can_overwrite=True, ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_add( +@@ -1532,46 +1446,40 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + ) + + def fixture_config_success(self, instance_name="booth"): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- self.fixture_cfg_content( +- self.fixture_key_path(instance_name), +- ticket_list=[ +- ["ticketA", []], +- ["ticketB", []], +- ["ticketC", []], +- ], +- ), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- self.fixture_cfg_content( +- self.fixture_key_path(instance_name), +- ticket_list=[ +- ["ticketA", []], +- ["ticketC", []], +- ], +- ), +- can_overwrite=True, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ self.fixture_cfg_content( ++ self.fixture_key_path(instance_name), ++ ticket_list=[ ++ ["ticketA", []], ++ ["ticketB", []], ++ ["ticketC", []], ++ ], ++ ), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ self.fixture_cfg_content( ++ self.fixture_key_path(instance_name), ++ ticket_list=[ ++ ["ticketA", []], ++ ["ticketC", []], ++ ], ++ ), ++ can_overwrite=True, + ) + + def test_success_default_instance(self): + self.fixture_config_success() +- commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", +- ) ++ commands.config_ticket_remove(self.env_assist.get_env(), "ticketB") + + def test_success_custom_instance(self): + instance_name = "my_booth" + self.fixture_config_success(instance_name=instance_name) + commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", +- instance_name=instance_name, ++ self.env_assist.get_env(), "ticketB", instance_name=instance_name + ) + + def test_success_not_live(self): +@@ -1602,51 +1510,44 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + ) + + def test_success_ticket_options(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketA", [("a1", "A1"), ("a2", "A2")]], +- ["ticketB", [("b1", "B1"), ("b2", "B2")]], +- ["ticketC", [("c1", "C1"), ("c2", "C2")]], +- ] +- ), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketA", [("a1", "A1"), ("a2", "A2")]], +- ["ticketC", [("c1", "C1"), ("c2", "C2")]], +- ] +- ), +- can_overwrite=True, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content( ++ ticket_list=[ ++ ["ticketA", [("a1", "A1"), ("a2", "A2")]], ++ ["ticketB", [("b1", "B1"), ("b2", "B2")]], ++ ["ticketC", [("c1", "C1"), ("c2", "C2")]], ++ ] ++ ), + ) +- commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content( ++ ticket_list=[ ++ ["ticketA", [("a1", "A1"), ("a2", "A2")]], ++ ["ticketC", [("c1", "C1"), ("c2", "C2")]], ++ ] ++ ), ++ can_overwrite=True, + ) ++ commands.config_ticket_remove(self.env_assist.get_env(), "ticketB") + + def test_ticket_does_not_exist(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketA", []], +- ["ticketC", []], +- ] +- ), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content( ++ ticket_list=[ ++ ["ticketA", []], ++ ["ticketC", []], ++ ] ++ ), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.env_assist.get_env(), "ticketB" + ) + ) + self.env_assist.assert_reports( +@@ -1659,17 +1560,14 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + ) + + def test_config_parse_error(self): +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content="invalid config".encode("utf-8"), +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content="invalid config".encode("utf-8"), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.env_assist.get_env(), "ticketB" + ) + ) + self.env_assist.assert_reports( +@@ -1684,17 +1582,14 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + + def test_cannot_read_config(self): + error = "an error" +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.env_assist.get_env(), "ticketB" + ) + ) + self.env_assist.assert_reports( +@@ -1719,8 +1614,7 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.env_assist.get_env(), "ticketB" + ) + ) + self.env_assist.assert_reports( +@@ -1737,27 +1631,25 @@ class ConfigTicketRemove(TestCase, FixtureMixin): + + def test_cannot_write_config(self): + error = "an error" +- ( +- self.config.raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketB", []], +- ] +- ), +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- self.fixture_cfg_content(), +- can_overwrite=True, +- exception_msg=error, +- ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content( ++ ticket_list=[ ++ ["ticketB", []], ++ ] ++ ), ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ self.fixture_cfg_content(), ++ can_overwrite=True, ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_ticket_remove( +- self.env_assist.get_env(), +- "ticketB", ++ self.env_assist.get_env(), "ticketB" + ) + ) + self.env_assist.assert_reports( +@@ -1792,40 +1684,35 @@ class CreateInCluster(TestCase, FixtureMixin): + ) + + def fixture_config_success(self, instance_name="booth"): +- ( +- self.config.runner.cib.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- content=self.fixture_cfg_content( +- self.fixture_key_path(instance_name) +- ), +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:heartbeat:IPaddr2", +- name="runner.pcmk.load_agent.ipaddr2", +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:pacemaker:booth-site", +- name="runner.pcmk.load_agent.booth-site", +- ) +- .env.push_cib(resources=self.fixture_cib_booth_group(instance_name)) ++ self.config.runner.cib.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ content=self.fixture_cfg_content( ++ self.fixture_key_path(instance_name) ++ ), ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:heartbeat:IPaddr2", ++ name="runner.pcmk.load_agent.ipaddr2", ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:pacemaker:booth-site", ++ name="runner.pcmk.load_agent.booth-site", ++ ) ++ self.config.env.push_cib( ++ resources=self.fixture_cib_booth_group(instance_name) + ) + + def test_success_default_instance(self): + self.fixture_config_success() +- commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, +- ) ++ commands.create_in_cluster(self.env_assist.get_env(), self.site_ip) + + def test_success_custom_instance(self): + instance_name = "my_booth" + self.fixture_config_success(instance_name=instance_name) + commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, +- instance_name=instance_name, ++ self.env_assist.get_env(), self.site_ip, instance_name=instance_name + ) + + def test_success_not_live_cib(self): +@@ -1833,29 +1720,24 @@ class CreateInCluster(TestCase, FixtureMixin): + env = dict(CIB_file=tmp_file) + with open(rc("cib-empty.xml")) as cib_file: + self.config.env.set_cib_data(cib_file.read(), cib_tempfile=tmp_file) +- ( +- self.config.runner.cib.load(env=env) +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:heartbeat:IPaddr2", +- name="runner.pcmk.load_agent.ipaddr2", +- env=env, +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:pacemaker:booth-site", +- name="runner.pcmk.load_agent.booth-site", +- env=env, +- ) +- .env.push_cib(resources=self.fixture_cib_booth_group()) ++ self.config.runner.cib.load(env=env) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), + ) +- commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:heartbeat:IPaddr2", ++ name="runner.pcmk.load_agent.ipaddr2", ++ env=env, + ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:pacemaker:booth-site", ++ name="runner.pcmk.load_agent.booth-site", ++ env=env, ++ ) ++ self.config.env.push_cib(resources=self.fixture_cib_booth_group()) ++ commands.create_in_cluster(self.env_assist.get_env(), self.site_ip) + + def test_not_live_booth(self): + self.config.env.set_booth( +@@ -1867,8 +1749,7 @@ class CreateInCluster(TestCase, FixtureMixin): + ) + self.env_assist.assert_raise_library_error( + lambda: commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, ++ self.env_assist.get_env(), self.site_ip + ), + [ + fixture.error( +@@ -1883,19 +1764,15 @@ class CreateInCluster(TestCase, FixtureMixin): + ) + + def test_booth_resource_already_created(self): +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_booth_group() +- ).raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_booth_group()) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), + ) + self.env_assist.assert_raise_library_error( + lambda: commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, ++ self.env_assist.get_env(), self.site_ip + ) + ) + self.env_assist.assert_reports( +@@ -1904,17 +1781,14 @@ class CreateInCluster(TestCase, FixtureMixin): + + def test_booth_config_does_not_exist(self): + error = "an error" +- ( +- self.config.runner.cib.load().raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=error, +- ) ++ self.config.runner.cib.load().raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=error, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, ++ self.env_assist.get_env(), self.site_ip + ) + ) + self.env_assist.assert_reports( +@@ -1959,28 +1833,25 @@ class CreateInCluster(TestCase, FixtureMixin): + ) + + def test_booth_agent_missing(self): +- ( +- self.config.runner.cib.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:heartbeat:IPaddr2", +- name="runner.pcmk.load_agent.ipaddr2", +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:pacemaker:booth-site", +- agent_is_missing=True, +- name="runner.pcmk.load_agent.booth-site", +- stderr=REASON, +- ) ++ self.config.runner.cib.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:heartbeat:IPaddr2", ++ name="runner.pcmk.load_agent.ipaddr2", ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:pacemaker:booth-site", ++ agent_is_missing=True, ++ name="runner.pcmk.load_agent.booth-site", ++ stderr=REASON, + ) + self.env_assist.assert_raise_library_error( + lambda: commands.create_in_cluster( +- self.env_assist.get_env(), +- self.site_ip, ++ self.env_assist.get_env(), self.site_ip + ) + ) + self.env_assist.assert_reports( +@@ -1993,30 +1864,28 @@ class CreateInCluster(TestCase, FixtureMixin): + ), + ] + ) +- +- def test_agents_missing_forced(self): +- ( +- self.config.runner.cib.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:heartbeat:IPaddr2", +- agent_is_missing=True, +- name="runner.pcmk.load_agent.ipaddr2", +- stderr=REASON, +- ) +- .runner.pcmk.load_agent( +- agent_name="ocf:pacemaker:booth-site", +- agent_is_missing=True, +- name="runner.pcmk.load_agent.booth-site", +- stderr=REASON, +- ) +- .env.push_cib( +- resources=self.fixture_cib_booth_group(default_operations=True) +- ) ++ ++ def test_agents_missing_forced(self): ++ self.config.runner.cib.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:heartbeat:IPaddr2", ++ agent_is_missing=True, ++ name="runner.pcmk.load_agent.ipaddr2", ++ stderr=REASON, ++ ) ++ self.config.runner.pcmk.load_agent( ++ agent_name="ocf:pacemaker:booth-site", ++ agent_is_missing=True, ++ name="runner.pcmk.load_agent.booth-site", ++ stderr=REASON, ++ ) ++ self.config.env.push_cib( ++ resources=self.fixture_cib_booth_group(default_operations=True) + ) + commands.create_in_cluster( + self.env_assist.get_env(), +@@ -2061,10 +1930,9 @@ class RemoveFromCluster(TestCase, FixtureMixin): + self.resource_remove.assert_not_called() + + def test_success_default_instance(self): +- (self.config.runner.cib.load(resources=self.fixture_cib_booth_group())) ++ self.config.runner.cib.load(resources=self.fixture_cib_booth_group()) + commands.remove_from_cluster( +- self.env_assist.get_env(), +- self.resource_remove, ++ self.env_assist.get_env(), self.resource_remove + ) + self.resource_remove.assert_has_calls( + [ +@@ -2075,10 +1943,8 @@ class RemoveFromCluster(TestCase, FixtureMixin): + + def test_success_custom_instance(self): + instance_name = "my_booth" +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_booth_group(instance_name) +- ) ++ self.config.runner.cib.load( ++ resources=self.fixture_cib_booth_group(instance_name) + ) + commands.remove_from_cluster( + self.env_assist.get_env(), +@@ -2099,16 +1965,12 @@ class RemoveFromCluster(TestCase, FixtureMixin): + cib_xml_man.append_to_first_tag_name( + "resources", self.fixture_cib_booth_group(wrap_in_resources=False) + ) +- ( +- self.config +- # This makes env.is_cib_live return False +- .env.set_cib_data(str(cib_xml_man), cib_tempfile=tmp_file) +- # This instructs the runner to actually return our mocked cib +- .runner.cib.load_content(str(cib_xml_man), env=env) +- ) ++ # This makes env.is_cib_live return False ++ self.config.env.set_cib_data(str(cib_xml_man), cib_tempfile=tmp_file) ++ # This instructs the runner to actually return our mocked cib ++ self.config.runner.cib.load_content(str(cib_xml_man), env=env) + commands.remove_from_cluster( +- self.env_assist.get_env(), +- self.resource_remove, ++ self.env_assist.get_env(), self.resource_remove + ) + self.resource_remove.assert_has_calls( + [ +@@ -2127,8 +1989,7 @@ class RemoveFromCluster(TestCase, FixtureMixin): + ) + self.env_assist.assert_raise_library_error( + lambda: commands.remove_from_cluster( +- self.env_assist.get_env(), +- self.resource_remove, ++ self.env_assist.get_env(), self.resource_remove + ), + [ + fixture.error( +@@ -2147,8 +2008,7 @@ class RemoveFromCluster(TestCase, FixtureMixin): + (self.config.runner.cib.load()) + self.env_assist.assert_raise_library_error( + lambda: commands.remove_from_cluster( +- self.env_assist.get_env(), +- self.resource_remove, ++ self.env_assist.get_env(), self.resource_remove + ), + ) + self.env_assist.assert_reports( +@@ -2162,15 +2022,10 @@ class RemoveFromCluster(TestCase, FixtureMixin): + self.resource_remove.assert_not_called() + + def test_more_booth_resources(self): +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_more_resources() +- ) +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_more_resources()) + self.env_assist.assert_raise_library_error( + lambda: commands.remove_from_cluster( +- self.env_assist.get_env(), +- self.resource_remove, ++ self.env_assist.get_env(), self.resource_remove + ), + ) + self.env_assist.assert_reports( +@@ -2185,11 +2040,7 @@ class RemoveFromCluster(TestCase, FixtureMixin): + self.resource_remove.assert_not_called() + + def test_more_booth_resources_forced(self): +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_more_resources() +- ) +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_more_resources()) + commands.remove_from_cluster( + self.env_assist.get_env(), + self.resource_remove, +@@ -2234,11 +2085,8 @@ class Restart(TestCase, FixtureMixin): + self.resource_restart.assert_not_called() + + def test_success_default_instance(self): +- (self.config.runner.cib.load(resources=self.fixture_cib_booth_group())) +- commands.restart( +- self.env_assist.get_env(), +- self.resource_restart, +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_booth_group()) ++ commands.restart(self.env_assist.get_env(), self.resource_restart) + self.resource_restart.assert_has_calls( + [ + mock.call(["booth-booth-service"]), +@@ -2247,10 +2095,8 @@ class Restart(TestCase, FixtureMixin): + + def test_success_custom_instance(self): + instance_name = "my_booth" +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_booth_group(instance_name) +- ) ++ self.config.runner.cib.load( ++ resources=self.fixture_cib_booth_group(instance_name) + ) + commands.restart( + self.env_assist.get_env(), +@@ -2274,8 +2120,7 @@ class Restart(TestCase, FixtureMixin): + self.config.env.set_cib_data("") + self.env_assist.assert_raise_library_error( + lambda: commands.restart( +- self.env_assist.get_env(), +- self.resource_restart, ++ self.env_assist.get_env(), self.resource_restart + ), + [ + fixture.error( +@@ -2295,8 +2140,7 @@ class Restart(TestCase, FixtureMixin): + (self.config.runner.cib.load()) + self.env_assist.assert_raise_library_error( + lambda: commands.restart( +- self.env_assist.get_env(), +- self.resource_restart, ++ self.env_assist.get_env(), self.resource_restart + ), + ) + self.env_assist.assert_reports( +@@ -2310,15 +2154,10 @@ class Restart(TestCase, FixtureMixin): + self.resource_restart.assert_not_called() + + def test_more_booth_resources(self): +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_more_resources() +- ) +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_more_resources()) + self.env_assist.assert_raise_library_error( + lambda: commands.restart( +- self.env_assist.get_env(), +- self.resource_restart, ++ self.env_assist.get_env(), self.resource_restart + ), + ) + self.env_assist.assert_reports( +@@ -2333,11 +2172,7 @@ class Restart(TestCase, FixtureMixin): + self.resource_restart.assert_not_called() + + def test_more_booth_resources_forced(self): +- ( +- self.config.runner.cib.load( +- resources=self.fixture_cib_more_resources() +- ) +- ) ++ self.config.runner.cib.load(resources=self.fixture_cib_more_resources()) + commands.restart( + self.env_assist.get_env(), + self.resource_restart, +@@ -2390,10 +2225,7 @@ class TicketGrantRevokeMixin(FixtureMixin): + ) + self.config.env.set_cib_data("") + self.env_assist.assert_raise_library_error( +- lambda: self.command( +- self.env_assist.get_env(), +- self.ticket, +- ), ++ lambda: self.command(self.env_assist.get_env(), self.ticket), + [ + fixture.error( + reports.codes.LIVE_ENVIRONMENT_REQUIRED, +@@ -2410,26 +2242,18 @@ class TicketGrantRevokeMixin(FixtureMixin): + def test_success_site_ip_specified(self): + self.get_booth_call()(self.ticket, self.site_ip) + self.command( +- self.env_assist.get_env(), +- self.ticket, +- site_ip=self.site_ip, ++ self.env_assist.get_env(), self.ticket, site_ip=self.site_ip + ) + + def test_success_site_ip_not_specified(self): + self.config.runner.cib.load(resources=self.fixture_cib_booth_group()) + self.get_booth_call()(self.ticket, self.site_ip) +- self.command( +- self.env_assist.get_env(), +- self.ticket, +- ) ++ self.command(self.env_assist.get_env(), self.ticket) + + def test_cannot_find_site_ip(self): + self.config.runner.cib.load() + self.env_assist.assert_raise_library_error( +- lambda: self.command( +- self.env_assist.get_env(), +- self.ticket, +- ), ++ lambda: self.command(self.env_assist.get_env(), self.ticket), + [ + fixture.error( + reports.codes.BOOTH_CANNOT_DETERMINE_LOCAL_SITE_IP, +@@ -2448,9 +2272,7 @@ class TicketGrantRevokeMixin(FixtureMixin): + ) + self.env_assist.assert_raise_library_error( + lambda: self.command( +- self.env_assist.get_env(), +- self.ticket, +- site_ip=self.site_ip, ++ self.env_assist.get_env(), self.ticket, site_ip=self.site_ip + ), + [ + fixture.error( +@@ -2496,34 +2318,30 @@ class ConfigSyncTest(TestCase, FixtureMixin): + self.fixture_key_path(instance_name) + ) + self.fixture_config_read_success(instance_name=instance_name) +- ( +- self.config.http.booth.send_config( +- instance_name, +- config_content.decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path(instance_name)), +- authfile_data=RANDOM_KEY, +- node_labels=self.node_list, +- ) ++ self.config.http.booth.send_config( ++ instance_name, ++ config_content.decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path(instance_name)), ++ authfile_data=RANDOM_KEY, ++ node_labels=self.node_list, + ) + + def fixture_config_read_success(self, instance_name="booth"): + config_content = self.fixture_cfg_content( + self.fixture_key_path(instance_name) + ) +- ( +- self.config.corosync_conf.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(instance_name), +- content=config_content, +- name="raw_file.read.conf", +- ) +- .raw_file.read( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(instance_name), +- content=RANDOM_KEY, +- name="raw_file.read.key", +- ) ++ self.config.corosync_conf.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(instance_name), ++ content=config_content, ++ name="raw_file.read.conf", ++ ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(instance_name), ++ content=RANDOM_KEY, ++ name="raw_file.read.key", + ) + + def fixture_reports_success(self, instance_name="booth"): +@@ -2552,30 +2370,23 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_success_default_instance(self): + self.fixture_config_success() +- commands.config_sync( +- self.env_assist.get_env(), +- ) ++ commands.config_sync(self.env_assist.get_env()) + self.env_assist.assert_reports(self.fixture_reports_success()) + + def test_success_custom_instance(self): + instance_name = "my_booth" + self.fixture_config_success(instance_name=instance_name) + commands.config_sync( +- self.env_assist.get_env(), +- instance_name=instance_name, ++ self.env_assist.get_env(), instance_name=instance_name + ) + self.env_assist.assert_reports( +- self.fixture_reports_success( +- instance_name=instance_name, +- ) ++ self.fixture_reports_success(instance_name=instance_name) + ) + + def test_not_live_cib(self): + self.config.env.set_cib_data("") + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync( +- self.env_assist.get_env(), +- ), ++ lambda: commands.config_sync(self.env_assist.get_env()), + [ + fixture.error( + reports.codes.LIVE_ENVIRONMENT_REQUIRED, +@@ -2596,56 +2407,45 @@ class ConfigSyncTest(TestCase, FixtureMixin): + "key_path": "some key path", + } + ) +- ( +- self.config.corosync_conf.load( +- node_name_list=self.node_list +- ).http.booth.send_config( +- instance_name, +- config_data.decode("utf-8"), +- authfile=os.path.basename(key_path), +- authfile_data=key_data, +- node_labels=self.node_list, +- ) ++ self.config.corosync_conf.load(node_name_list=self.node_list) ++ self.config.http.booth.send_config( ++ instance_name, ++ config_data.decode("utf-8"), ++ authfile=os.path.basename(key_path), ++ authfile_data=key_data, ++ node_labels=self.node_list, + ) + + def test_not_live_booth_default_instance(self): + self.fixture_config_success_not_live() +- commands.config_sync( +- self.env_assist.get_env(), +- ) ++ commands.config_sync(self.env_assist.get_env()) + self.env_assist.assert_reports(self.fixture_reports_success()) + + def test_not_live_booth_custom_instance(self): + instance_name = "my_booth" + self.fixture_config_success_not_live(instance_name=instance_name) + commands.config_sync( +- self.env_assist.get_env(), +- instance_name=instance_name, ++ self.env_assist.get_env(), instance_name=instance_name + ) + self.env_assist.assert_reports( +- self.fixture_reports_success( +- instance_name=instance_name, +- ) ++ self.fixture_reports_success(instance_name=instance_name) + ) + + def test_some_node_names_missing(self): + nodes = ["rh7-2"] + self.fixture_config_read_success() +- ( +- self.config.corosync_conf.load( +- filename="corosync-some-node-names.conf", +- instead="corosync_conf.load", +- ).http.booth.send_config( +- "booth", +- self.fixture_cfg_content().decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path()), +- authfile_data=RANDOM_KEY, +- node_labels=nodes, +- ) ++ self.config.corosync_conf.load( ++ filename="corosync-some-node-names.conf", ++ instead="corosync_conf.load", + ) +- commands.config_sync( +- self.env_assist.get_env(), ++ self.config.http.booth.send_config( ++ "booth", ++ self.fixture_cfg_content().decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path()), ++ authfile_data=RANDOM_KEY, ++ node_labels=nodes, + ) ++ commands.config_sync(self.env_assist.get_env()) + self.env_assist.assert_reports( + [ + fixture.info(reports.codes.BOOTH_CONFIG_DISTRIBUTION_STARTED), +@@ -2666,11 +2466,9 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_all_node_names_missing(self): + self.fixture_config_read_success() +- ( +- self.config.corosync_conf.load( +- filename="corosync-no-node-names.conf", +- instead="corosync_conf.load", +- ) ++ self.config.corosync_conf.load( ++ filename="corosync-no-node-names.conf", ++ instead="corosync_conf.load", + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_sync(self.env_assist.get_env()) +@@ -2687,23 +2485,21 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_node_failure(self): + self.fixture_config_read_success() +- ( +- self.config.http.booth.send_config( +- "booth", +- self.fixture_cfg_content().decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path()), +- authfile_data=RANDOM_KEY, +- communication_list=[ +- dict( +- label=self.node_list[0], +- response_code=400, +- output=self.reason, +- ), +- dict( +- label=self.node_list[1], +- ), +- ], +- ) ++ self.config.http.booth.send_config( ++ "booth", ++ self.fixture_cfg_content().decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path()), ++ authfile_data=RANDOM_KEY, ++ communication_list=[ ++ dict( ++ label=self.node_list[0], ++ response_code=400, ++ output=self.reason, ++ ), ++ dict( ++ label=self.node_list[1], ++ ), ++ ], + ) + self.env_assist.assert_raise_library_error( + lambda: commands.config_sync(self.env_assist.get_env()), [] +@@ -2728,23 +2524,21 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_node_failure_skip_offline(self): + self.fixture_config_read_success() +- ( +- self.config.http.booth.send_config( +- "booth", +- self.fixture_cfg_content().decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path()), +- authfile_data=RANDOM_KEY, +- communication_list=[ +- dict( +- label=self.node_list[0], +- response_code=400, +- output=self.reason, +- ), +- dict( +- label=self.node_list[1], +- ), +- ], +- ) ++ self.config.http.booth.send_config( ++ "booth", ++ self.fixture_cfg_content().decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path()), ++ authfile_data=RANDOM_KEY, ++ communication_list=[ ++ dict( ++ label=self.node_list[0], ++ response_code=400, ++ output=self.reason, ++ ), ++ dict( ++ label=self.node_list[1], ++ ), ++ ], + ) + + commands.config_sync(self.env_assist.get_env(), skip_offline_nodes=True) +@@ -2767,24 +2561,22 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_node_offline(self): + self.fixture_config_read_success() +- ( +- self.config.http.booth.send_config( +- "booth", +- self.fixture_cfg_content().decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path()), +- authfile_data=RANDOM_KEY, +- communication_list=[ +- dict( +- label=self.node_list[0], +- errno=1, +- error_msg=self.reason, +- was_connected=False, +- ), +- dict( +- label=self.node_list[1], +- ), +- ], +- ) ++ self.config.http.booth.send_config( ++ "booth", ++ self.fixture_cfg_content().decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path()), ++ authfile_data=RANDOM_KEY, ++ communication_list=[ ++ dict( ++ label=self.node_list[0], ++ errno=1, ++ error_msg=self.reason, ++ was_connected=False, ++ ), ++ dict( ++ label=self.node_list[1], ++ ), ++ ], + ) + + self.env_assist.assert_raise_library_error( +@@ -2810,24 +2602,22 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_node_offline_skip_offline(self): + self.fixture_config_read_success() +- ( +- self.config.http.booth.send_config( +- "booth", +- self.fixture_cfg_content().decode("utf-8"), +- authfile=os.path.basename(self.fixture_key_path()), +- authfile_data=RANDOM_KEY, +- communication_list=[ +- dict( +- label=self.node_list[0], +- errno=1, +- error_msg=self.reason, +- was_connected=False, +- ), +- dict( +- label=self.node_list[1], +- ), +- ], +- ) ++ self.config.http.booth.send_config( ++ "booth", ++ self.fixture_cfg_content().decode("utf-8"), ++ authfile=os.path.basename(self.fixture_key_path()), ++ authfile_data=RANDOM_KEY, ++ communication_list=[ ++ dict( ++ label=self.node_list[0], ++ errno=1, ++ error_msg=self.reason, ++ was_connected=False, ++ ), ++ dict( ++ label=self.node_list[1], ++ ), ++ ], + ) + + commands.config_sync(self.env_assist.get_env(), skip_offline_nodes=True) +@@ -2849,15 +2639,13 @@ class ConfigSyncTest(TestCase, FixtureMixin): + ) + + def test_config_not_accessible(self): +- ( +- self.config.corosync_conf.load().raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- exception_msg=self.reason, +- ) ++ self.config.corosync_conf.load().raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ exception_msg=self.reason, + ) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2881,7 +2669,7 @@ class ConfigSyncTest(TestCase, FixtureMixin): + ) + (self.config.corosync_conf.load()) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2896,15 +2684,13 @@ class ConfigSyncTest(TestCase, FixtureMixin): + ) + + def test_config_parse_error(self): +- ( +- self.config.corosync_conf.load().raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content="invalid config".encode("utf-8"), +- ) ++ self.config.corosync_conf.load().raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content="invalid config".encode("utf-8"), + ) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2924,9 +2710,9 @@ class ConfigSyncTest(TestCase, FixtureMixin): + "key_path": "some key path", + } + ) +- (self.config.corosync_conf.load()) ++ self.config.corosync_conf.load() + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2939,23 +2725,21 @@ class ConfigSyncTest(TestCase, FixtureMixin): + ) + + def test_authfile_not_accessible(self): +- ( +- self.config.corosync_conf.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=self.fixture_cfg_content(), +- name="raw_file.read.conf", +- ) +- .raw_file.read( +- file_type_codes.BOOTH_KEY, +- self.fixture_key_path(), +- exception_msg=self.reason, +- name="raw_file.read.key", +- ) ++ self.config.corosync_conf.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=self.fixture_cfg_content(), ++ name="raw_file.read.conf", ++ ) ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_KEY, ++ self.fixture_key_path(), ++ exception_msg=self.reason, ++ name="raw_file.read.key", + ) + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2977,9 +2761,9 @@ class ConfigSyncTest(TestCase, FixtureMixin): + "key_path": "some key path", + } + ) +- (self.config.corosync_conf.load()) ++ self.config.corosync_conf.load() + self.env_assist.assert_raise_library_error( +- lambda: commands.config_sync(self.env_assist.get_env()), ++ lambda: commands.config_sync(self.env_assist.get_env()) + ) + self.env_assist.assert_reports( + [ +@@ -2994,22 +2778,22 @@ class ConfigSyncTest(TestCase, FixtureMixin): + ) + + def test_no_authfile(self): +- ( +- self.config.corosync_conf.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=bytes(), +- ) +- .http.booth.send_config( +- "booth", +- bytes().decode("utf-8"), +- node_labels=self.node_list, +- ) ++ self.config.corosync_conf.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=bytes(), ++ ) ++ self.config.http.booth.send_config( ++ "booth", ++ bytes().decode("utf-8"), ++ node_labels=self.node_list, + ) + commands.config_sync(self.env_assist.get_env()) + self.env_assist.assert_reports( +- [fixture.info(reports.codes.BOOTH_CONFIG_DISTRIBUTION_STARTED)] ++ [ ++ fixture.info(reports.codes.BOOTH_CONFIG_DISTRIBUTION_STARTED), ++ ] + + [ + fixture.info( + reports.codes.BOOTH_CONFIG_ACCEPTED_BY_NODE, +@@ -3022,18 +2806,14 @@ class ConfigSyncTest(TestCase, FixtureMixin): + + def test_authfile_not_in_booth_dir(self): + config_content = "authfile=/etc/my_booth.key" +- ( +- self.config.corosync_conf.load() +- .raw_file.read( +- file_type_codes.BOOTH_CONFIG, +- self.fixture_cfg_path(), +- content=config_content.encode("utf-8"), +- ) +- .http.booth.send_config( +- "booth", +- config_content, +- node_labels=self.node_list, +- ) ++ self.config.corosync_conf.load() ++ self.config.raw_file.read( ++ file_type_codes.BOOTH_CONFIG, ++ self.fixture_cfg_path(), ++ content=config_content.encode("utf-8"), ++ ) ++ self.config.http.booth.send_config( ++ "booth", config_content, node_labels=self.node_list + ) + commands.config_sync(self.env_assist.get_env()) + self.env_assist.assert_reports( +@@ -3096,9 +2876,7 @@ class EnableDisableStartStopMixin(FixtureMixin): + ) + self.config.env.set_cib_data("") + self.env_assist.assert_raise_library_error( +- lambda: self.command( +- self.env_assist.get_env(), +- ), ++ lambda: self.command(self.env_assist.get_env()), + [ + fixture.error( + reports.codes.LIVE_ENVIRONMENT_REQUIRED, +@@ -3114,9 +2892,7 @@ class EnableDisableStartStopMixin(FixtureMixin): + + def test_success_default_instance(self): + self.get_external_call()("booth", instance="booth") +- self.command( +- self.env_assist.get_env(), +- ) ++ self.command(self.env_assist.get_env()) + self.env_assist.assert_reports( + [ + fixture.info( +@@ -3149,9 +2925,7 @@ class EnableDisableStartStopMixin(FixtureMixin): + err_msg = "some stderr\nsome stdout" + self.get_external_call()("booth", instance="booth", failure_msg=err_msg) + self.env_assist.assert_raise_library_error( +- lambda: self.command( +- self.env_assist.get_env(), +- ), ++ lambda: self.command(self.env_assist.get_env()), + [ + fixture.error( + reports.codes.SERVICE_ACTION_FAILED, +@@ -3226,17 +3000,16 @@ class PullConfigBase(TestCase, FixtureMixin): + class PullConfigSuccess(PullConfigBase): + def setUp(self): + super().setUp() +- ( +- self.config.http.booth.get_config( +- self.name, +- self.config_data.decode("utf-8"), +- node_labels=[self.node_name], +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.config_path, +- self.config_data, +- can_overwrite=True, +- ) ++ self.config.http.booth.get_config( ++ self.name, ++ self.config_data.decode("utf-8"), ++ node_labels=[self.node_name], ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.config_path, ++ self.config_data, ++ can_overwrite=True, + ) + + def test_success(self): +@@ -3265,17 +3038,16 @@ class PullConfigSuccessCustomInstance(TestCase, FixtureMixin): + ] + + def test_success(self): +- ( +- self.config.http.booth.get_config( +- self.name, +- self.config_data.decode("utf-8"), +- node_labels=[self.node_name], +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.config_path, +- self.config_data, +- can_overwrite=True, +- ) ++ self.config.http.booth.get_config( ++ self.name, ++ self.config_data.decode("utf-8"), ++ node_labels=[self.node_name], ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.config_path, ++ self.config_data, ++ can_overwrite=True, + ) + commands.pull_config( + self.env_assist.get_env(), +@@ -3514,34 +3286,31 @@ class PullConfigWithAuthfile(PullConfigBase): + self.authfile = os.path.basename(self.authfile_path) + self.authfile_data = b"auth" + +- ( +- self.config.http.booth.get_config( +- self.name, +- self.config_data.decode("utf-8"), +- authfile=self.authfile, +- authfile_data=self.authfile_data, +- node_labels=[self.node_name], +- ) ++ self.config.http.booth.get_config( ++ self.name, ++ self.config_data.decode("utf-8"), ++ authfile=self.authfile, ++ authfile_data=self.authfile_data, ++ node_labels=[self.node_name], + ) + + + class PullConfigWithAuthfileSuccess(PullConfigWithAuthfile): + def setUp(self): + super().setUp() +- ( +- self.config.raw_file.write( +- file_type_codes.BOOTH_KEY, +- self.authfile_path, +- self.authfile_data, +- can_overwrite=True, +- name="raw_file.write.key", +- ).raw_file.write( +- file_type_codes.BOOTH_CONFIG, +- self.config_path, +- self.config_data, +- can_overwrite=True, +- name="raw_file.write.cfg", +- ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_KEY, ++ self.authfile_path, ++ self.authfile_data, ++ can_overwrite=True, ++ name="raw_file.write.key", ++ ) ++ self.config.raw_file.write( ++ file_type_codes.BOOTH_CONFIG, ++ self.config_path, ++ self.config_data, ++ can_overwrite=True, ++ name="raw_file.write.cfg", + ) + + def test_success(self): +@@ -3642,13 +3411,13 @@ class GetStatus(TestCase): + + def assert_success(self, instance_name=None): + inner_name = instance_name or "booth" +- ( +- self.config.runner.booth.status_daemon( +- inner_name, stdout="daemon status" +- ) +- .runner.booth.status_tickets(inner_name, stdout="tickets status") +- .runner.booth.status_peers(inner_name, stdout="peers status") ++ self.config.runner.booth.status_daemon( ++ inner_name, stdout="daemon status" + ) ++ self.config.runner.booth.status_tickets( ++ inner_name, stdout="tickets status" ++ ) ++ self.config.runner.booth.status_peers(inner_name, stdout="peers status") + self.assertEqual( + commands.get_status( + self.env_assist.get_env(), instance_name=instance_name +@@ -3667,10 +3436,8 @@ class GetStatus(TestCase): + self.assert_success(instance_name="my_booth") + + def test_daemon_status_failure(self): +- ( +- self.config.runner.booth.status_daemon( +- "booth", stdout="some output", stderr="some error", returncode=1 +- ) ++ self.config.runner.booth.status_daemon( ++ "booth", stdout="some output", stderr="some error", returncode=1 + ) + self.env_assist.assert_raise_library_error( + lambda: commands.get_status(self.env_assist.get_env()), +@@ -3684,12 +3451,9 @@ class GetStatus(TestCase): + ) + + def test_ticket_status_failure(self): +- ( +- self.config.runner.booth.status_daemon( +- "booth", stdout="daemon status" +- ).runner.booth.status_tickets( +- "booth", stdout="some output", stderr="some error", returncode=1 +- ) ++ self.config.runner.booth.status_daemon("booth", stdout="daemon status") ++ self.config.runner.booth.status_tickets( ++ "booth", stdout="some output", stderr="some error", returncode=1 + ) + self.env_assist.assert_raise_library_error( + lambda: commands.get_status(self.env_assist.get_env()), +@@ -3703,14 +3467,12 @@ class GetStatus(TestCase): + ) + + def test_peers_status_failure(self): +- ( +- self.config.runner.booth.status_daemon( +- "booth", stdout="daemon status" +- ) +- .runner.booth.status_tickets("booth", stdout="tickets status") +- .runner.booth.status_peers( +- "booth", stdout="some output", stderr="some error", returncode=1 +- ) ++ self.config.runner.booth.status_daemon("booth", stdout="daemon status") ++ self.config.runner.booth.status_tickets( ++ "booth", stdout="tickets status" ++ ) ++ self.config.runner.booth.status_peers( ++ "booth", stdout="some output", stderr="some error", returncode=1 + ) + self.env_assist.assert_raise_library_error( + lambda: commands.get_status(self.env_assist.get_env()), +-- +2.35.3 + diff --git a/bz2058243-02-make-booth-ticket-mode-value-case-insensitive.patch b/bz2058243-02-make-booth-ticket-mode-value-case-insensitive.patch new file mode 100644 index 0000000..212472d --- /dev/null +++ b/bz2058243-02-make-booth-ticket-mode-value-case-insensitive.patch @@ -0,0 +1,126 @@ +From de4845ea2d22c7dd9f4539360b44a900b1cea193 Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Thu, 14 Jul 2022 16:46:33 +0200 +Subject: [PATCH 2/3] make booth ticket mode value case insensitive + +--- + pcs/lib/booth/config_validators.py | 10 ++++++++ + pcs/lib/commands/booth.py | 14 +++++++++--- + pcs_test/tier0/lib/commands/test_booth.py | 28 ++++++++++++++++------- + 3 files changed, 41 insertions(+), 11 deletions(-) + +diff --git a/pcs/lib/booth/config_validators.py b/pcs/lib/booth/config_validators.py +index 99badc46..6c4a4ddc 100644 +--- a/pcs/lib/booth/config_validators.py ++++ b/pcs/lib/booth/config_validators.py +@@ -100,6 +100,16 @@ def remove_ticket(conf_facade, ticket_name): + return [] + + ++def ticket_options_normalization() -> validate.TypeNormalizeFunc: ++ return validate.option_value_normalization( ++ { ++ "mode": ( ++ lambda value: value.lower() if isinstance(value, str) else value ++ ) ++ } ++ ) ++ ++ + def validate_ticket_name(ticket_name: str) -> reports.ReportItemList: + if not __TICKET_NAME_RE.search(ticket_name): + return [ +diff --git a/pcs/lib/commands/booth.py b/pcs/lib/commands/booth.py +index e7891fbe..fc1454ce 100644 +--- a/pcs/lib/commands/booth.py ++++ b/pcs/lib/commands/booth.py +@@ -23,7 +23,10 @@ from pcs.common.reports.item import ( + ) + from pcs.common.services.errors import ManageServiceError + from pcs.common.str_tools import join_multilines +-from pcs.lib import tools ++from pcs.lib import ( ++ tools, ++ validate, ++) + from pcs.lib.booth import ( + config_files, + config_validators, +@@ -329,17 +332,22 @@ def config_ticket_add( + booth_env = env.get_booth_env(instance_name) + try: + booth_conf = booth_env.config.read_to_facade() ++ options_pairs = validate.values_to_pairs( ++ options, config_validators.ticket_options_normalization() ++ ) + report_processor.report_list( + config_validators.add_ticket( + booth_conf, + ticket_name, +- options, ++ options_pairs, + allow_unknown_options=allow_unknown_options, + ) + ) + if report_processor.has_errors: + raise LibraryError() +- booth_conf.add_ticket(ticket_name, options) ++ booth_conf.add_ticket( ++ ticket_name, validate.pairs_to_values(options_pairs) ++ ) + booth_env.config.write_facade(booth_conf, can_overwrite=True) + except RawFileError as e: + report_processor.report(raw_file_error_report(e)) +diff --git a/pcs_test/tier0/lib/commands/test_booth.py b/pcs_test/tier0/lib/commands/test_booth.py +index 2b20a199..12b169c2 100644 +--- a/pcs_test/tier0/lib/commands/test_booth.py ++++ b/pcs_test/tier0/lib/commands/test_booth.py +@@ -1194,7 +1194,7 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + }, + ) + +- def test_success_ticket_options(self): ++ def assert_success_ticket_options(self, options_command, options_config): + self.config.raw_file.read( + file_type_codes.BOOTH_CONFIG, + self.fixture_cfg_path(), +@@ -1203,17 +1203,29 @@ class ConfigTicketAdd(TestCase, FixtureMixin): + self.config.raw_file.write( + file_type_codes.BOOTH_CONFIG, + self.fixture_cfg_path(), +- self.fixture_cfg_content( +- ticket_list=[ +- ["ticketA", [("retries", "10"), ("timeout", "20")]] +- ] +- ), ++ self.fixture_cfg_content(ticket_list=[["ticketA", options_config]]), + can_overwrite=True, + ) + commands.config_ticket_add( +- self.env_assist.get_env(), +- "ticketA", ++ self.env_assist.get_env(), "ticketA", options_command ++ ) ++ ++ def test_success_ticket_options(self): ++ self.assert_success_ticket_options( + {"timeout": "20", "retries": "10"}, ++ [("retries", "10"), ("timeout", "20")], ++ ) ++ ++ def test_success_ticket_options_mode(self): ++ self.assert_success_ticket_options( ++ {"timeout": "20", "retries": "10", "mode": "manual"}, ++ [("mode", "manual"), ("retries", "10"), ("timeout", "20")], ++ ) ++ ++ def test_success_ticket_options_mode_case_insensitive(self): ++ self.assert_success_ticket_options( ++ {"timeout": "20", "retries": "10", "mode": "MaNuAl"}, ++ [("mode", "manual"), ("retries", "10"), ("timeout", "20")], + ) + + def test_ticket_already_exists(self): +-- +2.35.3 + diff --git a/pcs.spec b/pcs.spec index e2eff40..39bd67e 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.3 -Release: 2%{?dist} +Release: 3%{?dist} # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPLv2: pcs @@ -111,6 +111,9 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm # pcs patches: <= 200 Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch Patch2: bz2102663-01-fix-pcs-resource-restart-traceback.patch +Patch3: bz2058243-01-code-formatting.patch +Patch4: bz2058243-02-make-booth-ticket-mode-value-case-insensitive.patch +Patch5: bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch # ui patches: >200 # Patch201: bzNUMBER-01-name.patch @@ -296,6 +299,9 @@ update_times_patch(){ %autopatch -p1 -M 200 update_times_patch %{PATCH1} update_times_patch %{PATCH2} +update_times_patch %{PATCH3} +update_times_patch %{PATCH4} +update_times_patch %{PATCH5} # prepare dirs/files necessary for building all bundles # ----------------------------------------------------- @@ -533,6 +539,11 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Thu Jul 28 2022 Miroslav Lisik - 0.11.3-3 +- Fixed booth ticket mode value case insensitive +- Fixed booth sync check whether /etc/booth exists +- Resolves: rhbz#2026725 rhbz#2058243 + * Tue Jul 12 2022 Miroslav Lisik - 0.11.3-2 - Fixed 'pcs resource restart' traceback - Resolves: rhbz#2102663