diff --git a/CHANGELOG.md b/CHANGELOG.md index ef64b7a..f3fa1c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## 4.0.0 (2015-11-30) +New package version "4.0.0" includes the following features: + +- New flag `is_hotpluggable` in `metadata.yaml` that allows to install and use + plugin on previously deployed environments. + ## 3.0.0 (2014-09-16) New package version "3.0.0" includes the following features: diff --git a/examples/fuel_plugin_example_v4/metadata.yaml b/examples/fuel_plugin_example_v4/metadata.yaml index 6169f59..0f4d199 100644 --- a/examples/fuel_plugin_example_v4/metadata.yaml +++ b/examples/fuel_plugin_example_v4/metadata.yaml @@ -17,6 +17,9 @@ homepage: 'https://github.com/openstack/fuel-plugins' # Specify a group which your plugin implements, possible options: # network, storage, storage::cinder, storage::glance, hypervisor groups: [] +# Change `false` to `true` if the plugin can be installed in the environment +# after the deployment. +is_hotpluggable: false # The plugin is compatible with releases in the list releases: diff --git a/fuel_plugin_builder/templates/v4/plugin_data/metadata.yaml.mako b/fuel_plugin_builder/templates/v4/plugin_data/metadata.yaml.mako index 0ca855d..d0a5385 100644 --- a/fuel_plugin_builder/templates/v4/plugin_data/metadata.yaml.mako +++ b/fuel_plugin_builder/templates/v4/plugin_data/metadata.yaml.mako @@ -17,6 +17,9 @@ homepage: 'https://github.com/openstack/fuel-plugins' # Specify a group which your plugin implements, possible options: # network, storage, storage::cinder, storage::glance, hypervisor groups: [] +# Change `false` to `true` if the plugin can be installed in the environment +# after the deployment. +is_hotpluggable: false # The plugin is compatible with releases in the list releases: diff --git a/fuel_plugin_builder/tests/test_validator_v4.py b/fuel_plugin_builder/tests/test_validator_v4.py index 5c044ac..b68c37d 100644 --- a/fuel_plugin_builder/tests/test_validator_v4.py +++ b/fuel_plugin_builder/tests/test_validator_v4.py @@ -16,53 +16,17 @@ import mock -from fuel_plugin_builder.tests.base import BaseValidator +from fuel_plugin_builder.tests.test_validator_v3 import TestValidatorV3 from fuel_plugin_builder.validators.schemas import SchemaV4 from fuel_plugin_builder.validators.validator_v4 import ValidatorV4 -class TestValidatorV4(BaseValidator): +class TestValidatorV4(TestValidatorV3): __test__ = True validator_class = ValidatorV4 schema_class = SchemaV4 - def test_validate(self): - mocked_methods = ['check_deployment_tasks'] - super(TestValidatorV4, self).test_validate( - additional_mocked_methods=mocked_methods) - - self.validator.check_deployment_tasks.assert_called_once_with() - - # copy-pasted from tests v3 to - # - override invalid base validator - # - make additional validator class integrity smoke-test - - def test_check_schemas(self): - mocked_methods = [ - 'check_env_config_attrs', - 'validate_file_by_schema', - 'check_deployment_tasks_schema', - 'check_network_roles_schema', - 'check_node_roles_schema', - 'check_volumes_schema' - ] - self.mock_methods(self.validator, mocked_methods) - self.validator.check_schemas() - - self.assertEqual( - [mock.call(self.schema_class().metadata_schema, - self.validator.meta_path), - mock.call(self.schema_class().tasks_schema, - self.validator.tasks_path, check_file_exists=False)], - self.validator.validate_file_by_schema.call_args_list) - - self.validator.check_env_config_attrs.assert_called_once_with() - self.validator.check_deployment_tasks_schema.assert_called_once_with() - self.validator.check_network_roles_schema.assert_called_once_with() - self.validator.check_node_roles_schema.assert_called_once_with() - self.validator.check_volumes_schema.assert_called_once_with() - @mock.patch('fuel_plugin_builder.validators.base.utils') def test_check_compatibility_failed(self, utils_mock): fuel_version_checks = ( @@ -91,3 +55,30 @@ class TestValidatorV4(BaseValidator): 'fuel_version': ['8.0'], 'package_version': '4.0.0'} self.validator.check_compatibility() + + @mock.patch('fuel_plugin_builder.validators.base.utils') + def test_is_hotpluggable_flag(self, utils_mock): + mock_data = { + 'name': 'plugin_name-12', + 'title': 'plugin_name-12', + 'version': '1.2.3', + 'package_version': '4.0.0', + 'description': 'Description', + 'fuel_version': ['8.0.0'], + 'licenses': ['Apache', 'BSD'], + 'authors': ['Author1', 'Author2'], + 'homepage': 'http://test.com', + 'releases': [ + { + "os": "ubuntu", + "version": "2015.1-8.0", + "mode": ['ha'], + "deployment_scripts_path": "deployment_scripts/", + "repository_path": "repositories/ubuntu" + } + ], + 'groups': ['network'], + 'is_hotpluggable': True + } + utils_mock.parse_yaml.return_value = mock_data + self.assertEqual(None, self.validator.check_metadata_schema()) diff --git a/fuel_plugin_builder/validators/schemas/v4.py b/fuel_plugin_builder/validators/schemas/v4.py index 630a159..59cc0a7 100644 --- a/fuel_plugin_builder/validators/schemas/v4.py +++ b/fuel_plugin_builder/validators/schemas/v4.py @@ -22,3 +22,10 @@ class SchemaV4(SchemaV3): @property def package_version(self): return {'enum': ['4.0.0']} + + @property + def metadata_schema(self): + schema = super(SchemaV4, self).metadata_schema + schema['required'].append('is_hotpluggable') + schema['properties']['is_hotpluggable'] = {'type': 'boolean'} + return schema diff --git a/fuel_plugin_builder/validators/validator_v4.py b/fuel_plugin_builder/validators/validator_v4.py index 988ca85..9ae0388 100644 --- a/fuel_plugin_builder/validators/validator_v4.py +++ b/fuel_plugin_builder/validators/validator_v4.py @@ -25,3 +25,9 @@ class ValidatorV4(ValidatorV3): @property def basic_version(self): return '8.0' + + def check_metadata_schema(self): + self.validate_file_by_schema( + self.schema.metadata_schema, + self.meta_path, + check_file_exists=False) diff --git a/test-requirements.txt b/test-requirements.txt index e40ab3c..ddb51b2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,4 +3,4 @@ hacking==0.7 mock==1.0 nose==1.1.2 nose2==0.4.1 -nose-timer==0.2.0 +nose-timer==0.2.0 \ No newline at end of file