Merge "Move load_packages_from from engine section to packages_opts section"

This commit is contained in:
Jenkins 2016-02-03 10:35:04 +00:00 committed by Gerrit Code Review
commit 55df1a0783
5 changed files with 11 additions and 9 deletions

View File

@ -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)

View File

@ -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'),

View File

@ -452,7 +452,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))

View File

@ -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()

View File

@ -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(