Example #1
0
 def test_can_skip_new_offline(self):
     # Instance of 'Config' has no 'local' member
     # pylint: disable=no-member
     pcmk_authkey_content = b"password"
     (
         self.config.local.load_cluster_configs(
             cluster_node_list=[NODE_1, NODE_2]
         )
         .http.host.check_auth(
             communication_list=[
                 dict(
                     label=NODE_NAME,
                     dest_list=NODE_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 )
             ],
         )
         .local.authkey_exists(return_value=True)
         .local.open_authkey(pcmk_authkey_content)
         .env.push_cib(resources=FIXTURE_RESOURCES)
     )
     node_add_remote(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME, omitting=True)
     )
Example #2
0
 def test_can_skip_all_offline(self, generate_binary_key):
     generate_binary_key.return_value = b"password"
     (
         self.config.local.load_cib()
         .corosync_conf.load(node_name_list=[NODE_1, NODE_2])
         .http.host.check_auth(
             communication_list=[
                 dict(
                     label=NODE_NAME,
                     dest_list=NODE_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 )
             ],
         )
         .local.authkey_exists(return_value=False)
         .local.distribute_authkey(
             communication_list=[
                 dict(
                     label=NODE_1,
                     dest_list=NODE_1_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 ),
                 dict(
                     label=NODE_2,
                     dest_list=NODE_2_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 ),
             ],
             pcmk_authkey_content=generate_binary_key.return_value,
         )
         .local.push_cib()
     )
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME, omitting=True)
         + [
             fixture.info(
                 reports.codes.FILES_DISTRIBUTION_STARTED,
                 file_list=["pacemaker authkey"],
                 node_list=[NODE_1, NODE_2],
             ),
             fixture.warn(
                 reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT,
                 node=NODE_1,
                 command="remote/put_file",
                 reason="Could not resolve host",
             ),
             fixture.warn(
                 reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT,
                 node=NODE_2,
                 command="remote/put_file",
                 reason="Could not resolve host",
             ),
         ]
     )
Example #3
0
 def test_can_skip_all_offline(self, generate_binary_key):
     generate_binary_key.return_value = b"password"
     (self.config
         .local.load_cib()
         .corosync_conf.load(node_name_list=[NODE_1, NODE_2])
         .http.host.check_auth(
             communication_list=[
                 dict(
                     label=NODE_NAME,
                     dest_list=NODE_DEST_LIST,
                     **FAIL_HTTP_KWARGS
                 )
             ],
         )
         .local.authkey_exists(return_value=False)
         .local.distribute_authkey(
             communication_list=[
                 dict(
                     label=NODE_1,
                     dest_list=NODE_1_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 ),
                 dict(
                     label=NODE_2,
                     dest_list=NODE_2_DEST_LIST,
                     **FAIL_HTTP_KWARGS,
                 ),
             ],
             pcmk_authkey_content=generate_binary_key.return_value,
         )
         .local.push_cib()
     )
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME, omitting=True)
         + [
         fixture.info(
             report_codes.FILES_DISTRIBUTION_STARTED,
             file_list=["pacemaker authkey"],
             node_list=[NODE_1, NODE_2],
         ),
         fixture.warn(
             report_codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT,
             node=NODE_1,
             command="remote/put_file",
             reason="Could not resolve host",
         ),
         fixture.warn(
             report_codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT,
             node=NODE_2,
             command="remote/put_file",
             reason="Could not resolve host",
         ),
     ])
Example #4
0
 def test_unknown_host_skip_offline(self):
     pcmk_authkey_content = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config.local.load_cib().corosync_conf.load(
         node_name_list=[NODE_1, NODE_2]).local.authkey_exists(
             return_value=True).local.open_authkey(
                 pcmk_authkey_content).local.push_cib())
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME))
Example #5
0
 def test_unknown_host_skip_offline(self):
     pcmk_authkey_content = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config.local.load_cluster_configs(
         cluster_node_list=[NODE_1, NODE_2]).local.authkey_exists(
             return_value=True).local.open_authkey(pcmk_authkey_content).
      env.push_cib(resources=FIXTURE_RESOURCES))
     node_add_remote(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME))
 def test_can_skip_new_offline(self):
     pcmk_authkey_content = b"password"
     (self.config.local.load_cib().corosync_conf.load(
         node_name_list=[NODE_1, NODE_2]).http.host.check_auth(
             communication_list=[
                 dict(label=NODE_NAME,
                      dest_list=NODE_DEST_LIST,
                      **FAIL_HTTP_KWARGS)
             ], ).local.authkey_exists(return_value=True).local.
      open_authkey(pcmk_authkey_content).local.push_cib())
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME, omitting=True))
Example #7
0
 def test_unknown_host_skip_offline_authkey_distribution(
     self, generate_binary_key
 ):
     # Instance of 'Config' has no 'local' member
     # pylint: disable=no-member
     generate_binary_key.return_value = b"password"
     self.config.env.set_known_hosts_dests(
         {
             NODE_1: NODE_1_DEST_LIST,
             NODE_2: NODE_2_DEST_LIST,
         }
     )
     (
         self.config.local.load_cluster_configs(
             cluster_node_list=[NODE_1, NODE_2]
         )
         .local.authkey_exists(return_value=False)
         .local.distribute_authkey(
             communication_list=[
                 dict(label=NODE_1, dest_list=NODE_1_DEST_LIST),
                 dict(label=NODE_2, dest_list=NODE_2_DEST_LIST),
             ],
             pcmk_authkey_content=generate_binary_key.return_value,
         )
         .env.push_cib(resources=FIXTURE_RESOURCES)
     )
     node_add_remote(self.env_assist.get_env(), skip_offline_nodes=True)
     generate_binary_key.assert_called_once_with(random_bytes_count=256)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME)
         + [
             fixture.info(
                 reports.codes.FILES_DISTRIBUTION_STARTED,
                 file_list=["pacemaker authkey"],
                 node_list=[NODE_1, NODE_2],
             ),
             fixture.info(
                 reports.codes.FILE_DISTRIBUTION_SUCCESS,
                 file_description="pacemaker authkey",
                 node=NODE_1,
             ),
             fixture.info(
                 reports.codes.FILE_DISTRIBUTION_SUCCESS,
                 file_description="pacemaker authkey",
                 node=NODE_2,
             ),
         ]
     )
Example #8
0
 def test_unknown_host_skip_offline(self):
     pcmk_authkey_content = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config
         .local.load_cluster_configs(cluster_node_list=[NODE_1, NODE_2])
         .local.authkey_exists(return_value=True)
         .local.open_authkey(pcmk_authkey_content)
         .env.push_cib(resources=FIXTURE_RESOURCES)
     )
     node_add_remote(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME)
     )
Example #9
0
 def test_unknown_host_skip_offline(self):
     pcmk_authkey_content = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config
         .local.load_cib()
         .corosync_conf.load(node_name_list=[NODE_1, NODE_2])
         .local.authkey_exists(return_value=True)
         .local.open_authkey(pcmk_authkey_content)
         .local.push_cib()
     )
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME)
     )
Example #10
0
 def test_unknown_host_skip_offline_authkey_distribution(
     self, generate_binary_key
 ):
     generate_binary_key.return_value = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config
         .local.load_cib()
         .corosync_conf.load(node_name_list=[NODE_1, NODE_2])
         .local.authkey_exists(return_value=False)
         .local.distribute_authkey(
             communication_list=[
                 dict(label=NODE_1, dest_list=NODE_1_DEST_LIST),
                 dict(label=NODE_2, dest_list=NODE_2_DEST_LIST),
             ],
             pcmk_authkey_content=generate_binary_key.return_value,
         )
         .local.push_cib()
     )
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     generate_binary_key.assert_called_once_with(random_bytes_count=256)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME)
         + [
         fixture.info(
             report_codes.FILES_DISTRIBUTION_STARTED,
             file_list=["pacemaker authkey"],
             node_list=[NODE_1, NODE_2],
         ),
         fixture.info(
             report_codes.FILE_DISTRIBUTION_SUCCESS,
             file_description="pacemaker authkey",
             node=NODE_1,
         ),
         fixture.info(
             report_codes.FILE_DISTRIBUTION_SUCCESS,
             file_description="pacemaker authkey",
             node=NODE_2,
         ),
     ])
Example #11
0
 def test_unknown_host_skip_offline_authkey_distribution(
     self, generate_binary_key
 ):
     generate_binary_key.return_value = b"password"
     self.config.env.set_known_hosts_dests({
         NODE_1: NODE_1_DEST_LIST,
         NODE_2: NODE_2_DEST_LIST,
     })
     (self.config
         .local.load_cib()
         .corosync_conf.load(node_name_list=[NODE_1, NODE_2])
         .local.authkey_exists(return_value=False)
         .local.distribute_authkey(
             communication_list=[
                 dict(label=NODE_1, dest_list=NODE_1_DEST_LIST),
                 dict(label=NODE_2, dest_list=NODE_2_DEST_LIST),
             ],
             pcmk_authkey_content=generate_binary_key.return_value,
         )
         .local.push_cib()
     )
     node_add_guest(self.env_assist.get_env(), skip_offline_nodes=True)
     generate_binary_key.assert_called_once_with(random_bytes_count=384)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME)
         + [
         fixture.info(
             report_codes.FILES_DISTRIBUTION_STARTED,
             file_list=["pacemaker authkey"],
             node_list=[NODE_1, NODE_2],
         ),
         fixture.info(
             report_codes.FILE_DISTRIBUTION_SUCCESS,
             file_description="pacemaker authkey",
             node=NODE_1,
         ),
         fixture.info(
             report_codes.FILE_DISTRIBUTION_SUCCESS,
             file_description="pacemaker authkey",
             node=NODE_2,
         ),
     ])
Example #12
0
 def test_can_skip_new_offline(self):
     pcmk_authkey_content = b"password"
     (self.config
         .local.load_cluster_configs(cluster_node_list=[NODE_1, NODE_2])
         .http.host.check_auth(
             communication_list=[
                 dict(
                     label=NODE_NAME,
                     dest_list=NODE_DEST_LIST,
                     **FAIL_HTTP_KWARGS
                 )
             ],
         )
         .local.authkey_exists(return_value=True)
         .local.open_authkey(pcmk_authkey_content)
         .env.push_cib(resources=FIXTURE_RESOURCES)
     )
     node_add_remote(self.env_assist.get_env(), skip_offline_nodes=True)
     self.env_assist.assert_reports(
         fixture_reports_new_node_unreachable(NODE_NAME, omitting=True)
     )