summaryrefslogtreecommitdiff
path: root/docker/macros.j2
diff options
context:
space:
mode:
authorJon Schlueter <jschluet@redhat.com>2019-03-21 11:32:18 -0400
committerJon Schlueter <jschluet@redhat.com>2019-03-21 12:48:53 -0400
commitcd307fb1ab261e5a24d3290a523dd573cb3d7e4c (patch)
tree8bee5b88c99deb663a55db946f9e6f1b74c67541 /docker/macros.j2
parentbebfa70ad143aa0caf41104fe20f7d037dbc249d (diff)
downloadkolla-cd307fb1ab261e5a24d3290a523dd573cb3d7e4c.tar.gz
kolla-cd307fb1ab261e5a24d3290a523dd573cb3d7e4c.zip
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
Diffstat (limited to 'docker/macros.j2')
-rw-r--r--docker/macros.j28
1 files changed, 8 insertions, 0 deletions
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 %}