コード例 #1
0
    def test_remove_ip_when_booth_resource_add_failed(self):
        mock_resource_create = mock.Mock(side_effect=[None, SystemExit(1)])
        mock_resource_remove = mock.Mock()
        mock_create_id = mock.Mock(side_effect=["ip_id","booth_id","group_id"])
        ip = "1.2.3.4"
        booth_config_file_path = rc("/path/to/booth.conf")

        booth_resource.get_creator(mock_resource_create, mock_resource_remove)(
            ip,
            booth_config_file_path,
            mock_create_id
        )
        self.assertEqual(mock_resource_create.mock_calls, [
            mock.call(
                clone_opts=[],
                group=u'group_id',
                meta_values=[],
                op_values=[],
                ra_id=u'ip_id',
                ra_type=u'ocf:heartbeat:IPaddr2',
                ra_values=[u'ip=1.2.3.4'],
            ),
            mock.call(
                clone_opts=[],
                group='group_id',
                meta_values=[],
                op_values=[],
                ra_id='booth_id',
                ra_type='ocf:pacemaker:booth-site',
                ra_values=['config=/path/to/booth.conf'],
            )
        ])
        mock_resource_remove.assert_called_once_with("ip_id")
コード例 #2
0
def create_in_cluster(env, name, ip, resource_create, resource_remove):
    #TODO resource_create is provisional hack until resources are not moved to
    #lib
    resources_section = get_resources(env.get_cib())

    booth_config_file_path = get_config_file_name(name)
    if resource.find_for_config(resources_section, booth_config_file_path):
        raise LibraryError(booth_reports.booth_already_in_cib(name))

    resource.get_creator(resource_create, resource_remove)(
        ip,
        booth_config_file_path,
        create_id=partial(resource.create_resource_id, resources_section,
                          name))
コード例 #3
0
ファイル: booth.py プロジェクト: wyatt88/pcs
def create_in_cluster(env, name, ip, resource_create):
    #TODO resource_create is provisional hack until resources are not moved to
    #lib
    resources_section = get_resources(env.get_cib())

    booth_config_file_path = get_config_file_name(name)
    if resource.find_for_config(resources_section, booth_config_file_path):
        raise LibraryError(booth_reports.booth_already_in_cib(name))

    resource.get_creator(resource_create)(
        ip,
        booth_config_file_path,
        create_id = partial(
            resource.create_resource_id,
            resources_section,
            name
        )
    )