From 348cc2774c8ce83040640ac347e9d436e17c5ddf Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Mon, 1 Feb 2016 14:21:19 +0300 Subject: [PATCH] Move load_packages_from from engine section to packages_opts section Related bp: murano-engine-package-cache Change-Id: I8fff2f8e67686b533bffe19c50e7d87752482ddb --- murano/cmd/test_runner.py | 7 ++++--- murano/common/config.py | 7 ++++--- murano/engine/package_loader.py | 2 +- murano/tests/unit/api/cmd/test_test_runner.py | 2 +- murano/tests/unit/engine/test_package_loader.py | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/murano/cmd/test_runner.py b/murano/cmd/test_runner.py index 41ea8d1a..511fad7a 100755 --- a/murano/cmd/test_runner.py +++ b/murano/cmd/test_runner.py @@ -72,14 +72,15 @@ class MuranoTestRunner(object): version_spec = helpers.parse_version_spec('*') package = pkg_loader.load_package(name, version_spec) except exceptions.NoPackageFound: - if not CONF.engine.load_packages_from: + if not CONF.packages_opts.load_packages_from: msg = _('Local package is not found since "load-packages-from"' ' engine parameter is not provided and specified ' 'packages is not loaded to murano-api') else: msg = _('Specified package is not found: {0} were scanned ' 'together with murano database' - ).format(','.join(CONF.engine.load_packages_from)) + ).format(','.join( + CONF.packages_opts.load_packages_from)) LOG.error(msg) self.error(msg, show_help=False) except exc.CommunicationError: @@ -211,7 +212,7 @@ class MuranoTestRunner(object): # Replace location of loading packages with provided from command line. if load_packages_from: - cfg.CONF.engine.load_packages_from = load_packages_from + cfg.CONF.packages_opts.load_packages_from = load_packages_from with package_loader.CombinedPackageLoader( murano_client_factory, client.tenant_id) as pkg_loader: engine.get_plugin_loader().register_in_loader(pkg_loader) diff --git a/murano/common/config.py b/murano/common/config.py index fd69ca93..2b71c07d 100644 --- a/murano/common/config.py +++ b/murano/common/config.py @@ -205,9 +205,6 @@ engine_opts = [ cfg.IntOpt('agent_timeout', default=3600, help=_('Time for waiting for a response from murano agent ' 'during the deployment')), - cfg.ListOpt('load_packages_from', default=[], - help=_('List of directories to load local packages from. ' - 'If not provided, packages will be loaded by API')) ] # TODO(sjmc7): move into engine opts? @@ -226,6 +223,10 @@ packages_opts = [ 'The packages would be re-used for consequent ' 'deployments.')), + cfg.ListOpt('load_packages_from', default=[], + help=_('List of directories to load local packages from. ' + 'If not provided, packages will be loaded only API')), + cfg.IntOpt('package_size_limit', default=5, help='Maximum application package size, Mb'), diff --git a/murano/engine/package_loader.py b/murano/engine/package_loader.py index df8cf02f..887339e7 100644 --- a/murano/engine/package_loader.py +++ b/murano/engine/package_loader.py @@ -427,7 +427,7 @@ class CombinedPackageLoader(package_loader.MuranoPackageLoader): murano_client_factory, tenant_id, root_loader) self.directory_loaders = [] - for folder in CONF.engine.load_packages_from: + for folder in CONF.packages_opts.load_packages_from: if os.path.exists(folder): self.directory_loaders.append(DirectoryPackageLoader( folder, root_loader)) diff --git a/murano/tests/unit/api/cmd/test_test_runner.py b/murano/tests/unit/api/cmd/test_test_runner.py index 7fe40aff..48dda4c9 100644 --- a/murano/tests/unit/api/cmd/test_test_runner.py +++ b/murano/tests/unit/api/cmd/test_test_runner.py @@ -49,7 +49,7 @@ class TestCaseShell(testtools.TestCase): dirs = [os.path.dirname(__file__), os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, 'meta')] - self.override_config('load_packages_from', dirs, 'engine') + self.override_config('load_packages_from', dirs, 'packages_opts') def tearDown(self): super(TestCaseShell, self).tearDown() diff --git a/murano/tests/unit/engine/test_package_loader.py b/murano/tests/unit/engine/test_package_loader.py index 8a82a7a8..35bc20ba 100644 --- a/murano/tests/unit/engine/test_package_loader.py +++ b/murano/tests/unit/engine/test_package_loader.py @@ -127,7 +127,7 @@ class TestCombinedPackageLoader(base.MuranoTestCase): super(TestCombinedPackageLoader, cls).setUpClass() location = os.path.dirname(__file__) - CONF.set_override('load_packages_from', [location], 'engine', + CONF.set_override('load_packages_from', [location], 'packages_opts', enforce_type=True) cls.murano_client_factory = mock.MagicMock() cls.loader = package_loader.CombinedPackageLoader(