aboutsummaryrefslogtreecommitdiff
path: root/kolla/docker/macros.j2
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2026-11-26 15:19:53 +0000
committerGerrit Code Review <review@openstack.org>2026-11-26 15:19:53 +0000
commitac79ac2555406f0be2c9ce2d8fa3cedfadac9244 (patch)
tree40a5273239facca8f18bc9ed80d08c673ccdf8dd /kolla/docker/macros.j2
parent9543b297b7dd3425d0050e96e49d16c9e3f664bf (diff)
parent542febbb12c619ee25cbb94b31fff6f916bcff33 (diff)
downloadkolla-ac79ac2555406f0be2c9ce2d8fa3cedfadac9244.tar.gz
kolla-ac79ac2555406f0be2c9ce2d8fa3cedfadac9244.zip
Merge "base: Install full systemd on Debian and Ubuntu"
Diffstat (limited to 'kolla/docker/macros.j2')
-rw-r--r--kolla/docker/macros.j218
1 files changed, 18 insertions, 0 deletions
diff --git a/kolla/docker/macros.j2 b/kolla/docker/macros.j2
index 6d43b4ccf..f44cad572 100644
--- a/kolla/docker/macros.j2
+++ b/kolla/docker/macros.j2
@@ -68,6 +68,24 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \
{%- endif %}
{%- endmacro %}
+{# NOTE(mnasiadka): Some Debian/Ubuntu packages call systemctl or
+ systemd-tmpfiles from their maintainer scripts without checking that
+ systemd is running, which fails during an image build. Replace them with
+ /bin/true while installing such packages, and restore them afterwards. #}
+{% macro disable_systemd_commands() -%}
+{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%}
+ dpkg-divert --local --rename --add {{ cmd }} && ln -s /bin/true {{ cmd }}
+ {%- if not loop.last %} && {% endif %}
+{%- endfor %}
+{%- endmacro %}
+
+{% macro restore_systemd_commands() -%}
+{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%}
+ rm -f {{ cmd }} && dpkg-divert --local --rename --remove {{ cmd }}
+ {%- if not loop.last %} && {% endif %}
+{%- endfor %}
+{%- endmacro %}
+
{% macro enable_extra_repos(repos) %}
{{ handle_repos(repos, 'enable') }}