diff options
| author | Jon Schlueter <jschluet@redhat.com> | 2019-03-15 15:47:30 -0400 |
|---|---|---|
| committer | Jon Schlueter <jschluet@redhat.com> | 2019-03-21 13:20:48 -0400 |
| commit | 95f38fb0f6056ef201d96e141732b32e97338e97 (patch) | |
| tree | 25a7e75776535fe1ea1babf2876477cfd5c6678a /docker/macros.j2 | |
| parent | 91c5453cc21491df42cc738583b646ca7afec08e (diff) | |
| download | kolla-95f38fb0f6056ef201d96e141732b32e97338e97.tar.gz kolla-95f38fb0f6056ef201d96e141732b32e97338e97.zip | |
cleanup in base for yum install entries
- introduce install_packages(..., chain=True) to allow chaining on
onto existing RUN commands
- introduce install_packages(..., clean) which defaults correctly
but allows you to override if you want to avoid doing extra
package manager cleanup
- refactored several calls in base to make use of these new features
In general this allows for macros.install_packages to be chained
after other calls
for example
RUN foo && {{ macros.install_packages(..., chain=True) }}
Change-Id: I4b2fe8e13ee3c0fffe77a1179a7af5b534496996
Diffstat (limited to 'docker/macros.j2')
| -rw-r--r-- | docker/macros.j2 | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docker/macros.j2 b/docker/macros.j2 index d27b7b238..533a14aa5 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -1,16 +1,17 @@ -{% macro install_packages(packages) -%} +{% macro install_packages(packages, chain=False, clean=clean_package_cache) -%} {% if packages is defined and packages|length > 0 -%} - {% if base_package_type == 'rpm' -%} - RUN {{ distro_package_manager }} -y install {{ packages | join(' ') }} - {%- if clean_package_cache %} \ - && {{ distro_package_manager }} clean all && rm -rf /var/cache/{{ distro_package_manager }}{% endif %} + {% if not chain -%} RUN {% endif -%} + {%- if base_package_type == 'rpm' -%} + {{ distro_package_manager }} -y install {{ packages | join(' ') }} + {%- if clean %} \ + && {{ distro_package_manager }} clean all && rm -rf /var/cache/{{ distro_package_manager }}{% endif -%} {%- elif base_package_type == 'deb' -%} {#- debian_package_install is a utility method to build up an appropriate set of commands to install packages in a debian-based environment that may include URL links to a .deb package -#} - RUN {{ debian_package_install(packages, clean_package_cache) }} + {{ debian_package_install(packages, clean) }} {%- endif %} {%- endif %} {%- endmacro %} |
