From ab100f8ee58f02c47f229e780873bb500452e5a7 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Sat, 26 Sep 2020 03:41:03 -0500 Subject: [PATCH] [tests] Make setup_docker clean up better (#71949) (#71959) Change: - pip packages should get removed after, not try to add them again - Try removing containerd.io package too Test Plan: - CI Signed-off-by: Rick Elrod (cherry picked from commit 6a7e637c5f5c715b148e9879fd3936d2598b77f8) --- .../playbooks/swarm_cleanup.yml | 1 + .../targets/incidental_setup_docker/defaults/main.yml | 2 ++ .../targets/incidental_setup_docker/handlers/main.yml | 6 +++--- .../targets/incidental_setup_docker/vars/RedHat-7.yml | 6 ++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/integration/targets/incidental_inventory_docker_swarm/playbooks/swarm_cleanup.yml b/test/integration/targets/incidental_inventory_docker_swarm/playbooks/swarm_cleanup.yml index 9cf87159c6f..fc4455ec7c5 100644 --- a/test/integration/targets/incidental_inventory_docker_swarm/playbooks/swarm_cleanup.yml +++ b/test/integration/targets/incidental_inventory_docker_swarm/playbooks/swarm_cleanup.yml @@ -15,4 +15,5 @@ - docker - docker-ce - docker-ce-cli + - containerd.io state: absent diff --git a/test/integration/targets/incidental_setup_docker/defaults/main.yml b/test/integration/targets/incidental_setup_docker/defaults/main.yml index f7be73dc0e0..48959cc3ec7 100644 --- a/test/integration/targets/incidental_setup_docker/defaults/main.yml +++ b/test/integration/targets/incidental_setup_docker/defaults/main.yml @@ -7,6 +7,7 @@ docker_packages: - docker-ce docker_pip_extra_packages: [] +docker_pip_never_remove: [] docker_pip_packages: - docker @@ -14,3 +15,4 @@ docker_cleanup_packages: - docker - docker-ce - docker-ce-cli + - containerd.io diff --git a/test/integration/targets/incidental_setup_docker/handlers/main.yml b/test/integration/targets/incidental_setup_docker/handlers/main.yml index 93d9657cbb7..9e3f928f481 100644 --- a/test/integration/targets/incidental_setup_docker/handlers/main.yml +++ b/test/integration/targets/incidental_setup_docker/handlers/main.yml @@ -1,11 +1,11 @@ - name: remove pip packages pip: - state: present - name: "{{ docker_pip_packages | union(docker_pip_extra_packages) }}" + state: absent + name: "{{ docker_pip_packages | union(docker_pip_extra_packages) | difference(docker_pip_never_remove) }}" listen: cleanup docker when: not docker_skip_cleanup | bool -- name: remove docker pagkages +- name: remove docker packages action: "{{ ansible_facts.pkg_mgr }}" args: name: "{{ docker_cleanup_packages }}" diff --git a/test/integration/targets/incidental_setup_docker/vars/RedHat-7.yml b/test/integration/targets/incidental_setup_docker/vars/RedHat-7.yml index bc1c7820906..84ba0920880 100644 --- a/test/integration/targets/incidental_setup_docker/vars/RedHat-7.yml +++ b/test/integration/targets/incidental_setup_docker/vars/RedHat-7.yml @@ -10,3 +10,9 @@ docker_packages: docker_pip_extra_packages: - requests==2.6.0 + +# We need to pin the above so pip finds the right system-installed package +# but we never want to try to remove it, so we substract this from the set of +# packages we remove on cleanup +docker_pip_never_remove: + - requests==2.6.0