Skip to content

Commit

Permalink
Add sed for multiline baseurl in yum repos
Browse files Browse the repository at this point in the history
  • Loading branch information
bbezak committed Sep 23, 2024
1 parent 7fc90f2 commit 5c54bed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion etc/kayobe/ansible/roles/pulp_auth_proxy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: Ensure pulp_proxy container is running
community.docker.docker_container:
name: pulp_proxy
image: nginx:stable-alpine
image: quay.io/nginx/nginx-unprivileged:stable-alpine
network_mode: "{{ pulp_auth_proxy_network_mode }}"
ports:
- "{{ pulp_auth_proxy_listen_ip }}:{{ pulp_auth_proxy_listen_port }}:80"
Expand Down
10 changes: 10 additions & 0 deletions etc/kayobe/kolla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,18 @@ kolla_build_blocks:
mkdir -p /etc/yum.repos.d.backup && \
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
{% endif %}
echo "===== Before sed modifications I =====" \
cat /etc/yum.repos.d/*.repo \
{% for repo in stackhpc_yum_repos %}
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
-e '/\[baseos\]/,/^\[/ { N; s/^\(baseurl=.*\)\n[ \t]*\(https.*\)/#\1\n#\2/ }' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} && \
{% endif %}
{% endfor %}
echo "===== After sed modifications I =====" \
cat /etc/yum.repos.d/*.repo \
{% else %}
RUN \
rm /etc/apt/sources.list && \
Expand All @@ -274,16 +279,21 @@ kolla_build_blocks:
{# fixme #}
{% if kolla_base_distro == 'rocky' %}
&& \
echo "===== Before sed modifications II =====" \
cat /etc/yum.repos.d/*.repo \
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
{% endif %}
{% for repo in base_centos_repo_overrides_post_yum_list %}
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
-e '/\[{{ repo.tag }}\]/,/^\[/ { N; s/^\(baseurl=.*\)\n[ \t]*\(https.*\)/#\1\n#\2/ }' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
{% endfor %}
echo "===== After sed modifications II =====" \
cat /etc/yum.repos.d/*.repo \
{% endif %}
# With the UCA keyring installed we can now add all repos.
base_ubuntu_package_sources_list: |
Expand Down

0 comments on commit 5c54bed

Please sign in to comment.