
This reverts the following commits: df987c9d3fca40e0a7529e48a3626dfdd58e2168 d866c63a32a494b8643b166c3b1e36e463a7502f 6b40b655f124d0a95f1b7d89ce04236606a02010 These are no longer necessary as we are using stable/train branch for source images until CentOS 8 / python 3 support is available and working. Change-Id: I5aedf1141862d51c5bb676a7393fc131c452c914 Related: blueprint centos-rhel-python-3
100 lines
3.6 KiB
Django/Jinja
100 lines
3.6 KiB
Django/Jinja
{% 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 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 %}
|
|
{% else %}
|
|
RUN echo "file and expressions must be set to use the sed macro"; /bin/false
|
|
{% endif %}
|
|
{%- endmacro %}
|
|
|
|
{% macro get_pip() %}
|
|
{% if distro_python_version == '2.7' %}
|
|
{% set python='python' %}
|
|
{% else %}
|
|
{% set python='python3' %}
|
|
{% endif %}
|
|
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
|
|
&& {{python}} get-pip.py \
|
|
&& rm get-pip.py
|
|
{% endmacro %}
|
|
|
|
{% macro install_pip(packages, constraints = true, pip_version = pip) %}
|
|
{%- if packages is sequence and packages|length > 0 -%}
|
|
{%- if not pip_version -%}
|
|
{%- set pip_version = 'pip' -%}
|
|
{%- endif -%}
|
|
{{ pip_version }} --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) %}
|
|
{% 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(binary, plugins, chain=False) -%}
|
|
{% if plugins is defined and plugins|length > 0 -%}
|
|
{% if not chain -%} RUN {% endif -%}
|
|
{%- if binary == 'td-agent' -%}
|
|
ulimit -n 65536 && td-agent-gem install {{ plugins | join(' ') }}
|
|
{%- else -%}
|
|
ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{% macro install_rabbitmq_plugins(plugins, version) -%}
|
|
ENV PLUGINS_DIR /usr/lib/rabbitmq/plugins
|
|
{% if plugins is defined and plugins|length > 0 -%}
|
|
{% for item in plugins %}
|
|
RUN curl -L -o ${PLUGINS_DIR}/{{ item }} https://github.com/deadtrickster/prometheus_rabbitmq_exporter/releases/download/{{ version }}/{{ item }}
|
|
{% endfor %}
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{% macro enable_extra_repos(repos) %}
|
|
|
|
{{ enable_repos(repos) }}
|
|
|
|
{% endmacro %}
|