From 5ae8b5b3a67a5221d2d5f05dfb6bd7c732cd3776 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 1 Aug 2024 13:31:47 -0700 Subject: [PATCH] Remove EXTERNALLY-MANAGED marker in apt test (#83706) The marker is removed in ansible-test managed environments, but the apt test restores it by installing/upgrading packages. To avoid breaking later tests, the marker needs to be removed again. ci_complete --- test/integration/targets/apt/tasks/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/integration/targets/apt/tasks/main.yml b/test/integration/targets/apt/tasks/main.yml index 13d3e4f41fa..e872274ceb5 100644 --- a/test/integration/targets/apt/tasks/main.yml +++ b/test/integration/targets/apt/tasks/main.yml @@ -38,3 +38,16 @@ when: - ansible_distribution in ('Ubuntu', 'Debian') + + always: + - name: Check if the target is managed by ansible-test + stat: + path: /etc/ansible-test.bootstrap + register: marker + + - name: Ensure the EXTERNALLY-MANAGED marker is not present on the target + command: | + {{ ansible_python_interpreter | quote }} + -c + 'import sysconfig; import pathlib; (pathlib.Path(sysconfig.get_path("stdlib")) / "EXTERNALLY-MANAGED").unlink(missing_ok=True);' + when: marker.stat.exists