Skip to content

Commit a3fe023

Browse files
committed
Add sed for multiline baseurl in yum repos
1 parent 7fc90f2 commit a3fe023

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

etc/kayobe/kolla.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,19 @@ kolla_build_blocks:
251251
mkdir -p /etc/yum.repos.d.backup && \
252252
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
253253
{% endif %}
254+
echo "===== Before sed modifications I =====" && \
255+
cat /etc/yum.repos.d/*.repo && \
254256
{% for repo in stackhpc_yum_repos %}
255257
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
258+
-e '/\[baseos\]/,/^\[/ { N; s/^\(baseurl=.*\)\n[ \t]*\(https.*\)/#\1\n#\2/ }' \
256259
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
257260
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
258261
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} && \
259262
{% endif %}
260263
{% endfor %}
264+
RUN \
265+
echo "===== After sed modifications I =====" && \
266+
cat /etc/yum.repos.d/*.repo && \
261267
{% else %}
262268
RUN \
263269
rm /etc/apt/sources.list && \
@@ -274,15 +280,18 @@ kolla_build_blocks:
274280
{# fixme #}
275281
{% if kolla_base_distro == 'rocky' %}
276282
&& \
283+
echo "===== Before sed modifications II =====" && \
284+
cat /etc/yum.repos.d/*.repo && \
277285
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
278286
tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
279287
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
280288
{% endif %}
281289
{% for repo in base_centos_repo_overrides_post_yum_list %}
282290
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
291+
-e '/\[{{ repo.tag }}\]/,/^\[/ { N; s/^\(baseurl=.*\)\n[ \t]*\(https.*\)/#\1\n#\2/ }' \
283292
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
284293
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
285-
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
294+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %}{% endif %} && \
286295
{% endfor %}
287296
{% endif %}
288297
# With the UCA keyring installed we can now add all repos.

0 commit comments

Comments
 (0)