Move load_packages_from from engine section to packages_opts section

Related bp: murano-engine-package-cache

Change-Id: I8fff2f8e67686b533bffe19c50e7d87752482ddb
This commit is contained in:
Kirill Zaitsev 2016-02-01 14:21:19 +03:00
parent f0f758ee93
commit 348cc2774c
5 changed files with 11 additions and 9 deletions

View File

@ -72,14 +72,15 @@ class MuranoTestRunner(object):
version_spec = helpers.parse_version_spec('*') version_spec = helpers.parse_version_spec('*')
package = pkg_loader.load_package(name, version_spec) package = pkg_loader.load_package(name, version_spec)
except exceptions.NoPackageFound: 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"' msg = _('Local package is not found since "load-packages-from"'
' engine parameter is not provided and specified ' ' engine parameter is not provided and specified '
'packages is not loaded to murano-api') 'packages is not loaded to murano-api')
else: else:
msg = _('Specified package is not found: {0} were scanned ' msg = _('Specified package is not found: {0} were scanned '
'together with murano database' 'together with murano database'
).format(','.join(CONF.engine.load_packages_from)) ).format(','.join(
CONF.packages_opts.load_packages_from))
LOG.error(msg) LOG.error(msg)
self.error(msg, show_help=False) self.error(msg, show_help=False)
except exc.CommunicationError: except exc.CommunicationError:
@ -211,7 +212,7 @@ class MuranoTestRunner(object):
# Replace location of loading packages with provided from command line. # Replace location of loading packages with provided from command line.
if load_packages_from: 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( with package_loader.CombinedPackageLoader(
murano_client_factory, client.tenant_id) as pkg_loader: murano_client_factory, client.tenant_id) as pkg_loader:
engine.get_plugin_loader().register_in_loader(pkg_loader) engine.get_plugin_loader().register_in_loader(pkg_loader)

View File

@ -205,9 +205,6 @@ engine_opts = [
cfg.IntOpt('agent_timeout', default=3600, cfg.IntOpt('agent_timeout', default=3600,
help=_('Time for waiting for a response from murano agent ' help=_('Time for waiting for a response from murano agent '
'during the deployment')), '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? # TODO(sjmc7): move into engine opts?
@ -226,6 +223,10 @@ packages_opts = [
'The packages would be re-used for consequent ' 'The packages would be re-used for consequent '
'deployments.')), '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, cfg.IntOpt('package_size_limit', default=5,
help='Maximum application package size, Mb'), help='Maximum application package size, Mb'),

View File

@ -427,7 +427,7 @@ class CombinedPackageLoader(package_loader.MuranoPackageLoader):
murano_client_factory, tenant_id, root_loader) murano_client_factory, tenant_id, root_loader)
self.directory_loaders = [] 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): if os.path.exists(folder):
self.directory_loaders.append(DirectoryPackageLoader( self.directory_loaders.append(DirectoryPackageLoader(
folder, root_loader)) folder, root_loader))

View File

@ -49,7 +49,7 @@ class TestCaseShell(testtools.TestCase):
dirs = [os.path.dirname(__file__), dirs = [os.path.dirname(__file__),
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, 'meta')] 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): def tearDown(self):
super(TestCaseShell, self).tearDown() super(TestCaseShell, self).tearDown()

View File

@ -127,7 +127,7 @@ class TestCombinedPackageLoader(base.MuranoTestCase):
super(TestCombinedPackageLoader, cls).setUpClass() super(TestCombinedPackageLoader, cls).setUpClass()
location = os.path.dirname(__file__) 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) enforce_type=True)
cls.murano_client_factory = mock.MagicMock() cls.murano_client_factory = mock.MagicMock()
cls.loader = package_loader.CombinedPackageLoader( cls.loader = package_loader.CombinedPackageLoader(