Skip to content
Snippets Groups Projects
Commit 4b0b7931 authored by Jenkins's avatar Jenkins Committed by Gerrit Code Review
Browse files

Merge "Fix image plugin functionality for oslo.config"

parents 0251ac73 477fc18b
No related branches found
No related tags found
No related merge requests found
...@@ -604,7 +604,9 @@ class KollaWorker(object): ...@@ -604,7 +604,9 @@ class KollaWorker(object):
for plugin in [match.group(0) for match in for plugin in [match.group(0) for match in
(re.search('{}-plugin-.+'.format(image['name']), (re.search('{}-plugin-.+'.format(image['name']),
section) for section in section) for section in
self.conf._groups) if match]: self.conf.list_all_sections()) if match]:
self.conf.register_opts(common_config.get_source_opts(),
plugin)
image['plugins'].append( image['plugins'].append(
process_source_installation(image, plugin)) process_source_installation(image, plugin))
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
# limitations under the License. # limitations under the License.
import os import os
import fixtures
import mock
from oslo_config import cfg from oslo_config import cfg
from oslotest import base as oslotest_base from oslotest import base as oslotest_base
...@@ -30,6 +33,11 @@ class TestCase(oslotest_base.BaseTestCase): ...@@ -30,6 +33,11 @@ class TestCase(oslotest_base.BaseTestCase):
default_config_files = self.get_default_config_files() default_config_files = self.get_default_config_files()
common_config.parse(self.conf, [], common_config.parse(self.conf, [],
default_config_files=default_config_files) default_config_files=default_config_files)
# NOTE(jeffrey4l): mock the _get_image_dir method to return a fake
# docker images dir
self.useFixture(fixtures.MockPatch(
'kolla.cmd.build.KollaWorker._get_images_dir',
mock.Mock(return_value=os.path.join(TESTS_ROOT, 'docker'))))
def get_default_config_files(self): def get_default_config_files(self):
if self.config_file: if self.config_file:
......
FROM {{ base_distro }}:{{ base_distro_tag }}
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
[DEFAULT] [DEFAULT]
debug=True debug=True
[neutron-server-plugin-networking-arista]
reference = master
location = https://github.com/openstack/networking-arista
type = git
...@@ -107,6 +107,8 @@ class WorkerThreadTest(base.TestCase): ...@@ -107,6 +107,8 @@ class WorkerThreadTest(base.TestCase):
class KollaWorkerTest(base.TestCase): class KollaWorkerTest(base.TestCase):
config_file = 'default.conf'
def test_supported_base_type(self): def test_supported_base_type(self):
rh_base = ['fedora', 'centos', 'oraclelinux', 'rhel'] rh_base = ['fedora', 'centos', 'oraclelinux', 'rhel']
rh_type = ['source', 'binary', 'rdo', 'rhos'] rh_type = ['source', 'binary', 'rdo', 'rhos']
...@@ -128,3 +130,25 @@ class KollaWorkerTest(base.TestCase): ...@@ -128,3 +130,25 @@ class KollaWorkerTest(base.TestCase):
self.conf.set_override('install_type', install_type) self.conf.set_override('install_type', install_type)
self.assertRaises(build.KollaMismatchBaseTypeException, self.assertRaises(build.KollaMismatchBaseTypeException,
build.KollaWorker, self.conf) build.KollaWorker, self.conf)
def test_build_image_list_adds_plugins(self):
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf)
kolla.setup_working_dir()
kolla.find_dockerfiles()
kolla.create_dockerfiles()
kolla.build_image_list()
expected_plugin = {
'name': 'neutron-server-plugin-networking-arista',
'reference': 'master',
'source': 'https://github.com/openstack/networking-arista',
'type': 'git'
}
for image in kolla.images:
if image['name'] == 'neutron-server':
self.assertEqual(image['plugins'][0], expected_plugin)
break
else:
self.fail('Can not find the expected neutron arista plugin')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment