From efa628d015fe0efcf7c692af7d593eac0ff87ef6 Mon Sep 17 00:00:00 2001 From: Surya Prakash Singh Date: Mon, 26 Dec 2016 09:59:56 +0530 Subject: [PATCH] Py3 and py2 implementation for kolla/image module This commit addresses the changes in kolla/image directory for better openstack python coding style. unittest also added for corresponding changes. Reference:- https://wiki.openstack.org/wiki/Python3 Change-Id: I8be60ebd214ac8ab400cc633f8e6005fb8760c24 Partially-Implements: blueprint support-python-35 --- kolla/image/build.py | 3 ++- kolla/tests/test_build.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kolla/image/build.py b/kolla/image/build.py index fde63e6a01..eb9637c693 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -497,7 +497,8 @@ class KollaWorker(object): self.install_type = conf.install_type self.tag = conf.tag self.images = list() - rpm_setup_config = filter(None, conf.rpm_setup_config) + rpm_setup_config = ([repo_file for repo_file in + conf.rpm_setup_config if repo_file is not None]) self.rpm_setup = self.build_rpm_setup(rpm_setup_config) rh_base = ['centos', 'oraclelinux', 'rhel'] diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index fccf7f41b7..95b5fd2f15 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -230,6 +230,11 @@ class KollaWorkerTest(base.TestCase): self.assertEqual(2, len(self._get_matched_images(kolla.images))) + def test_build_rpm_setup(self): + """checking the length of list of docker commands""" + kolla = build.KollaWorker(self.conf) + self.assertEqual(2, len(kolla.rpm_setup)) + def test_pre_defined_exist_profile(self): # default profile include the fake image: image-base self.conf.set_override('profile', ['default'])