From cd307fb1ab261e5a24d3290a523dd573cb3d7e4c Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Thu, 21 Mar 2019 11:32:18 -0400 Subject: refactor to pull out rpm_security_update macro - pulled out the repeated code from 3 paths in base and moved it into docker/macros - created macros.rpm_security_update - made sure the new macro could be customized for cleanup caches - update macro to use distro_package_manager Change-Id: Ic79ff42d913e1cbb68be66743e4f79f0bcff47f5 --- docker/macros.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docker/macros.j2') diff --git a/docker/macros.j2 b/docker/macros.j2 index dcc9bb0bb..d27b7b238 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -15,6 +15,14 @@ {%- endif %} {%- endmacro %} +{# Be Extra vigilant about introducing any extra whitespace at the + end of the macro for chaining purposes -#} +{% macro rpm_security_update(cleanup) -%} + {{ distro_package_manager }} -y update --security --sec-severity=Important --sec-severity=Critical + {%- if cleanup %} \ + && {{ distro_package_manager }} clean all && rm -rf /var/cache/{{ distro_package_manager }}{% endif -%} +{%- endmacro %} + {% macro sed(file='', expressions=[]) -%} {% if file != '' and expressions|length >0 %} RUN {% for expression in expressions %} sed -i "{{ file }}" -e "{{ expression }}" {% if not loop.last %} && {% endif %} {% endfor %} -- cgit v1.2.3