diff --git a/tripleo_common/image/builder/buildah.py b/tripleo_common/image/builder/buildah.py index a1e0519e5..0570a290f 100644 --- a/tripleo_common/image/builder/buildah.py +++ b/tripleo_common/image/builder/buildah.py @@ -114,6 +114,9 @@ class BuildahBuilder(base.BaseBuilder): :params container_name: Name of the container. """ + if container_name in self.excludes: + return + self.build(container_name, self._find_container_dir(container_name)) if self.push_containers: self.push(self._get_destination(container_name)) @@ -126,9 +129,6 @@ class BuildahBuilder(base.BaseBuilder): Containerfile and other files are located to build the image. """ - if container_name in self.excludes: - return - # 'buildah bud' is the command we want because Kolla uses Dockefile to # build images. # TODO(emilien): Stop ignoring TLS. The deployer should either secure diff --git a/tripleo_common/tests/image/builder/test_buildah.py b/tripleo_common/tests/image/builder/test_buildah.py index 24bbc0ed2..667697f80 100644 --- a/tripleo_common/tests/image/builder/test_buildah.py +++ b/tripleo_common/tests/image/builder/test_buildah.py @@ -141,11 +141,8 @@ class TestBuildahBuilder(base.TestCase): @mock.patch.object(process, 'execute', autospec=True) def test_build_with_excludes(self, mock_process): - container_build_path = WORK_DIR + '/' + 'fedora-base' - bb(WORK_DIR, DEPS, excludes=['fedora-base']).build( - 'fedora-base', - container_build_path - ) + bb(WORK_DIR, DEPS, excludes=['fedora-base'])._generate_container( + 'fedora-base') assert not mock_process.called @mock.patch.object(process, 'execute', autospec=True)