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