| 1 |
From: Colin Watson <[email protected]> |
| 2 |
Date: Tue, 21 Oct 2025 19:44:20 +0100 |
| 3 |
Subject: Move apt sources lists aside more comprehensively |
| 4 |
|
| 5 |
Forwarded: https://github.com/ansible/ansible/pull/86050 |
| 6 |
Last-Update: 2026-05-22 |
| 7 |
--- |
| 8 |
test/integration/targets/apt/tasks/downgrade.yml | 12 ++++++++++-- |
| 9 |
test/integration/targets/apt/tasks/repo.yml | 24 ++++++++++++++++++++---- |
| 10 |
test/integration/targets/apt/tasks/upgrade.yml | 12 ++++++++++-- |
| 11 |
3 files changed, 40 insertions(+), 8 deletions(-) |
| 12 |
|
| 13 |
--- a/test/integration/targets/apt/tasks/downgrade.yml |
| 14 |
+++ b/test/integration/targets/apt/tasks/downgrade.yml |
| 15 |
@@ -1,6 +1,11 @@ |
| 16 |
- block: |
| 17 |
- name: Disable ubuntu repos so system packages are not upgraded and do not change testing env |
| 18 |
- command: mv /etc/apt/sources.list /etc/apt/sources.list.backup |
| 19 |
+ shell: | |
| 20 |
+ find /etc/apt/sources.list* \ |
| 21 |
+ \( -name \*.list -or -name \*.sources \) \ |
| 22 |
+ -and -not -name file_tmp_repo.list \ |
| 23 |
+ -and -not -name 'local_repo_*.sources' \ |
| 24 |
+ | xargs -I{} mv {} {}.backup |
| 25 |
|
| 26 |
- name: install latest foo |
| 27 |
apt: |
| 28 |
@@ -74,4 +79,7 @@ |
| 29 |
autoclean: yes |
| 30 |
|
| 31 |
- name: Restore ubuntu repos |
| 32 |
- command: mv /etc/apt/sources.list.backup /etc/apt/sources.list |
| 33 |
+ shell: | |
| 34 |
+ find /etc/apt/sources.list* -name \*.backup \ |
| 35 |
+ | sed 's/\.backup$//' \ |
| 36 |
+ | xargs -I{} mv {}.backup {} |
| 37 |
--- a/test/integration/targets/apt/tasks/repo.yml |
| 38 |
+++ b/test/integration/targets/apt/tasks/repo.yml |
| 39 |
@@ -195,7 +195,12 @@ |
| 40 |
# https://github.com/ansible/ansible/issues/35900 |
| 41 |
- block: |
| 42 |
- name: Disable ubuntu repos so system packages are not upgraded and do not change testing env |
| 43 |
- command: mv /etc/apt/sources.list /etc/apt/sources.list.backup |
| 44 |
+ shell: | |
| 45 |
+ find /etc/apt/sources.list* \ |
| 46 |
+ \( -name \*.list -or -name \*.sources \) \ |
| 47 |
+ -and -not -name file_tmp_repo.list \ |
| 48 |
+ -and -not -name 'local_repo_*.sources' \ |
| 49 |
+ | xargs -I{} mv {} {}.backup |
| 50 |
|
| 51 |
- name: Install foobar, installs foo as a dependency |
| 52 |
apt: |
| 53 |
@@ -262,13 +267,21 @@ |
| 54 |
autoclean: yes |
| 55 |
|
| 56 |
- name: Restore ubuntu repos |
| 57 |
- command: mv /etc/apt/sources.list.backup /etc/apt/sources.list |
| 58 |
+ shell: | |
| 59 |
+ find /etc/apt/sources.list* -name \*.backup \ |
| 60 |
+ | sed 's/\.backup$//' \ |
| 61 |
+ | xargs -I{} mv {}.backup {} |
| 62 |
|
| 63 |
|
| 64 |
# https://github.com/ansible/ansible/issues/26298 |
| 65 |
- block: |
| 66 |
- name: Disable ubuntu repos so system packages are not upgraded and do not change testing env |
| 67 |
- command: mv /etc/apt/sources.list /etc/apt/sources.list.backup |
| 68 |
+ shell: | |
| 69 |
+ find /etc/apt/sources.list* \ |
| 70 |
+ \( -name \*.list -or -name \*.sources \) \ |
| 71 |
+ -and -not -name file_tmp_repo.list \ |
| 72 |
+ -and -not -name 'local_repo_*.sources' \ |
| 73 |
+ | xargs -I{} mv {} {}.backup |
| 74 |
|
| 75 |
- name: Install foobar, installs foo as a dependency |
| 76 |
apt: |
| 77 |
@@ -349,7 +362,10 @@ |
| 78 |
autoclean: yes |
| 79 |
|
| 80 |
- name: Restore ubuntu repos |
| 81 |
- command: mv /etc/apt/sources.list.backup /etc/apt/sources.list |
| 82 |
+ shell: | |
| 83 |
+ find /etc/apt/sources.list* -name \*.backup \ |
| 84 |
+ | sed 's/\.backup$//' \ |
| 85 |
+ | xargs -I{} mv {}.backup {} |
| 86 |
|
| 87 |
- name: Downgrades |
| 88 |
import_tasks: "downgrade.yml" |
| 89 |
--- a/test/integration/targets/apt/tasks/upgrade.yml |
| 90 |
+++ b/test/integration/targets/apt/tasks/upgrade.yml |
| 91 |
@@ -1,6 +1,11 @@ |
| 92 |
- block: |
| 93 |
- name: Disable ubuntu repos so system packages are not upgraded and do not change testing env |
| 94 |
- command: mv /etc/apt/sources.list /etc/apt/sources.list.backup |
| 95 |
+ shell: | |
| 96 |
+ find /etc/apt/sources.list* \ |
| 97 |
+ \( -name \*.list -or -name \*.sources \) \ |
| 98 |
+ -and -not -name file_tmp_repo.list \ |
| 99 |
+ -and -not -name 'local_repo_*.sources' \ |
| 100 |
+ | xargs -I{} mv {} {}.backup |
| 101 |
|
| 102 |
- name: install foo-1.0.0 |
| 103 |
apt: |
| 104 |
@@ -61,4 +66,7 @@ |
| 105 |
autoclean: yes |
| 106 |
|
| 107 |
- name: Restore ubuntu repos |
| 108 |
- command: mv /etc/apt/sources.list.backup /etc/apt/sources.list |
| 109 |
+ shell: | |
| 110 |
+ find /etc/apt/sources.list* -name \*.backup \ |
| 111 |
+ | sed 's/\.backup$//' \ |
| 112 |
+ | xargs -I{} mv {}.backup {} |