Skip to content

Commit f4f27c5

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

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

etc/kayobe/kolla.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,11 @@ 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 %} && \
@@ -274,15 +277,18 @@ kolla_build_blocks:
274277
{# fixme #}
275278
{% if kolla_base_distro == 'rocky' %}
276279
&& \
280+
echo "===== Before sed modifications II =====" && \
281+
cat /etc/yum.repos.d/*.repo && \
277282
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
278283
tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
279284
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
280285
{% endif %}
281286
{% for repo in base_centos_repo_overrides_post_yum_list %}
282287
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
288+
-e '/\[{{ repo.tag }}\]/,/^\[/ { N; s/^\(baseurl=.*\)\n[ \t]*\(https.*\)/#\1\n#\2/ }' \
283289
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
284290
-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 %} \
291+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %}{% endif %} && \
286292
{% endfor %}
287293
{% endif %}
288294
# With the UCA keyring installed we can now add all repos.

0 commit comments

Comments
 (0)