aboutsummaryrefslogtreecommitdiff
path: root/docker/macros.j2
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2026-07-06 15:26:00 +0200
committerMichal Nasiadka <mnasiadka@gmail.com>2026-07-06 19:59:40 +0000
commitdb35ac8d793506bc43b62e7e39d27a75de1043ed (patch)
treefeec28d13a43490f5fd4260374144a1abfc20331 /docker/macros.j2
parent1ae1850557e3b99902f73b32c9005618537a1f2d (diff)
downloadkolla-db35ac8d793506bc43b62e7e39d27a75de1043ed.tar.gz
kolla-db35ac8d793506bc43b62e7e39d27a75de1043ed.zip
Migrate to pyproject.toml
[tool.setuptools.data-files] does not support recursive directory installation. The old setup.cfg [files] worked because PBR's FilesConfig.expand_globs() used os.walk() to expand docker/*, but this hook is not triggered by the pbr.build PEP-517 backend. Move docker/ into kolla/ and use [tool.setuptools.package-data] instead. Update kolla_worker._get_images_dir() to check the kolla package directory first so both editable and regular installs work. Change-Id: I4fc452c03740ef22ebbb4e8d0d86c4f4783e2d09 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'docker/macros.j2')
-rw-r--r--docker/macros.j297
1 files changed, 0 insertions, 97 deletions
diff --git a/docker/macros.j2 b/docker/macros.j2
deleted file mode 100644
index 34d67335c..000000000
--- a/docker/macros.j2
+++ /dev/null
@@ -1,97 +0,0 @@
-{% macro install_packages(packages, chain=False, clean=clean_package_cache) -%}
-{% if packages is defined and packages|length > 0 -%}
- {% 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
- -#}
- {{ debian_package_install(packages, clean) }}
- {%- endif %}
-{%- 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 distro-sync --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 %}
-{% else %}
- RUN echo "file and expressions must be set to use the sed macro"; /bin/false
-{% endif %}
-{%- endmacro %}
-
-{% macro install_pip(packages, constraints=true, python_version='3') %}
-{%- if packages is sequence and packages|length > 0 -%}
- python{{ python_version }} -m pip --no-cache-dir install --upgrade{{ ' ' }}
- {%- if constraints %}-c /requirements/upper-constraints.txt {% endif -%}
- {{ packages | join(' ') }}
-{%- else -%}
- true
-{%- endif -%}
-{% endmacro %}
-
-{% macro configure_user(name, groups=None, shell=None, homedir=None) %}
-{%- if name not in users %}
-{{ raise_error("Failed to find configuration for '" + name + "' user. Try specifying '" + name + "-user' config section.") }}
-{%- endif %}
-{% set user=users[name] %}
-{%- if not homedir %}
-{% set homedir='/var/lib/' + name %}
-{%- endif %}
-RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \
- {%- if groups %}
- && usermod --append --groups {{ groups }} {{ name }} \
- {%- endif %}
- {%- if shell %}
- && chsh --shell {{ shell }} {{ name }} \
- {%- endif %}
- && mkdir -p {{ homedir }} \
- && chown -R {{ user.uid }}:{{ user.gid }} {{ homedir }}
-{% endmacro %}
-
-{% macro install_fluent_plugins(plugins, chain=False) -%}
-{% if plugins is defined and plugins|length > 0 -%}
- {% if not chain -%} RUN {% endif -%}
- ulimit -n 1024 && fluent-gem install {{ plugins | join(' ') }}
-{%- endif %}
-{%- endmacro %}
-
-{% macro enable_extra_repos(repos) %}
-
-{{ handle_repos(repos, 'enable') }}
-
-{% endmacro %}
-
-{% macro disable_extra_repos(repos) %}
-
-{{ handle_repos(repos, 'disable') }}
-
-{% endmacro %}
-
-{% macro upper_constraints_remove(package_name) -%}
-sed -e "/^{{ package_name }}===/d" -i requirements/upper-constraints.txt
-{%- endmacro %}
-
-{# NOTE(hrw): we change to "==" to allow for "21.*" syntax #}
-{% macro upper_constraints_version_change(package_name, from, to) -%}
-sed -e "s/^{{package_name}}==={{ from }}/{{package_name}}=={{ to }}/g" -i requirements/upper-constraints.txt
-{%- endmacro %}
-
-{% macro kolla_patch_sources() -%}
-{% if patches_path %}
- COPY patches /patches
- RUN kolla_patch
-{% endif %}
-{%- endmacro %}