always update APT lists when install packages

Normally we update APT lists when 'base' image is built. But when some
time pass those lists get out-of-date and images can not be built.

CentOS based images handle that without issues because YUM updates
repository data whenever they are out-of-date.

Change-Id: I5ba5b2067566639b399329b878027d4513567f71
changes/67/462567/4
Marcin Juszkiewicz 6 years ago
parent 9751b32a7b
commit bfc72492e7
  1. 3
      docker/opendaylight/Dockerfile.j2
  2. 1
      kolla/template/methods.py
  3. 4
      kolla/tests/test_methods.py

@ -24,8 +24,7 @@ COPY {{ opendaylight_repo }} /etc/yum.repos.d/
{% set odl_release_deb_url = 'http://download.opensuse.org/repositories/home:/akshitajha/Debian_8.0/' %}
{% endif %}
{% endif %}
RUN sh -c "echo 'deb {{ odl_release_deb_url }} /' > /etc/apt/sources.list.d/opendaylight.list" \
&& apt-get update
RUN sh -c "echo 'deb {{ odl_release_deb_url }} /' > /etc/apt/sources.list.d/opendaylight.list"
{% endif %}
{{ macros.install_packages(opendaylight_packages | customizable("packages")) }}

@ -44,6 +44,7 @@ def debian_package_install(packages):
# handle the apt-get install
if reg_packages:
cmds.append('apt-get update')
cmds.append('apt-get -y install --no-install-recommends {}'.format(
' '.join(reg_packages)
))

@ -19,5 +19,5 @@ class MethodsTest(base.TestCase):
def test_debian_package_install(self):
packages = ['https://packages.debian.org/package1.deb', 'package2.deb']
result = methods.debian_package_install(packages)
expectCmd = 'apt-get -y install --no-install-recommends package2.deb '
self.assertEqual(expectCmd, result.split("&&")[0])
expectCmd = 'apt-get -y install --no-install-recommends package2.deb'
self.assertEqual(expectCmd, result.split("&&")[1].strip())

Loading…
Cancel
Save