def test_stonith_reports(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_stonith(), { "required": "", "unknown": "value", }, self._NAME, self._fixture_resources({ "required": "A", }), ), [ fixture.error( reports.codes.INVALID_OPTIONS, force_code=reports.codes.FORCE, option_names=["unknown"], allowed=["action", "optional", "required"], option_type="stonith", allowed_patterns=[], ), fixture.error( reports.codes.REQUIRED_OPTIONS_ARE_MISSING, force_code=reports.codes.FORCE, option_type="stonith", option_names=["required"], ), ], )
def test_void_stonith_check_for_action(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_void(stonith=True), { "param1": "", "action": "reboot", "param2": "value2", }, self._NAME, self._fixture_resources({ "action": "reboot", "required": "value", }), ), [ fixture.error( reports.codes.DEPRECATED_OPTION, force_code=reports.codes.FORCE, option_type="stonith", option_name="action", replaced_by=["pcmk_off_action", "pcmk_reboot_action"], ), ], )
def test_dont_report_previously_missing_required(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "optional1_new": "A", }, self._NAME, self._fixture_resources({ "required1_new": "A", }), ), [], )
def test_stonith_action_not_updated(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_stonith(), { "optional": "value", }, self._NAME, self._fixture_resources({ "action": "reboot", "required": "value", }), ), [], )
def test_resource_action_not_deprecated(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "action": "reboot", }, self._NAME, self._fixture_resources({ "required1_new": "value", "required2_new": "value", }), ), [], )
def test_remove_optional(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "optional1_new": "", }, self._NAME, self._fixture_resources({ "required1_new": "A", "required2_old": "B", }), ), [], )
def test_deprecation_loop(self): # Meta-data are broken - there are obsoleting loops. The point of the # test is to make sure pcs does not crash or loop forever. Error # reports are not that important, since meta-data are broken. assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent_deprecated_loop(), { "loop3b": "value", }, self._NAME, self._fixture_resources({}), ), [ fixture.warn( reports.codes.DEPRECATED_OPTION, option_type="resource", option_name="loop3b", replaced_by=["loop3c"], ), ], )
def test_stonith_action_deprecated_forced(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_stonith(), { "action": "reboot", }, self._NAME, self._fixture_resources({ "action": "offon", "required": "value", }), force=True, ), [ fixture.warn( reports.codes.DEPRECATED_OPTION, option_type="stonith", option_name="action", replaced_by=["pcmk_off_action", "pcmk_reboot_action"], ), ], )
def test_remove_required_new_set_deprecated(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "required1_old": "A", "required1_new": "", }, self._NAME, self._fixture_resources({ "required1_new": "A", "required2_old": "B", }), ), [ fixture.warn( reports.codes.DEPRECATED_OPTION, option_type="resource", option_name="required1_old", replaced_by=["required1_new"], ), ], )
def test_remove_required_new(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "required1_new": "", }, self._NAME, self._fixture_resources({ "required1_new": "A", "required2_old": "B", }), ), [ fixture.error( reports.codes.REQUIRED_OPTION_OF_ALTERNATIVES_IS_MISSING, force_code=reports.codes.FORCE, option_type="resource", option_names=["required1_new", "required1_old"], deprecated_names=["required1_old"], ), ], )
def test_unknown_params_forced(self): assert_report_item_list_equal( primitive.validate_resource_instance_attributes_update( _fixture_agent(), { "unknown1": "", "unknown2": "D", }, self._NAME, self._fixture_resources({ "required1_new": "A", "required2_old": "B", "unknown1": "C", }), force=True, ), [ fixture.warn( reports.codes.INVALID_OPTIONS, option_names=["unknown2"], allowed=[ "action", "optional1_new", "optional1_old", "optional2_new", "optional2_old", "required1_new", "required1_old", "required2_new", "required2_old", ], option_type="resource", allowed_patterns=[], ), ], )