From 5eb9fa90f42d7ba081a83777e2fecc613db846c5 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 28 Mar 2019 16:23:16 -0700 Subject: [PATCH] Fix pull test on FreeBSD with Python 3.x. (#54565) --- test/integration/targets/pull/cleanup.yml | 16 ++++++++++++++++ test/integration/targets/pull/runme.sh | 4 ++++ test/integration/targets/pull/setup.yml | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 test/integration/targets/pull/cleanup.yml diff --git a/test/integration/targets/pull/cleanup.yml b/test/integration/targets/pull/cleanup.yml new file mode 100644 index 0000000000..5c0dc5117b --- /dev/null +++ b/test/integration/targets/pull/cleanup.yml @@ -0,0 +1,16 @@ +- hosts: localhost + vars: + git_install: '{{ lookup("file", lookup("env", "OUTPUT_DIR") + "/git_install.json") | from_json }}' + tasks: + - name: remove unwanted packages + package: + name: git + state: absent + when: git_install.changed + + - name: remove auto-installed packages from FreeBSD + pkgng: + name: git + state: absent + autoremove: yes + when: git_install.changed and ansible_distribution == "FreeBSD" diff --git a/test/integration/targets/pull/runme.sh b/test/integration/targets/pull/runme.sh index d3632aa794..c8b6e49f75 100755 --- a/test/integration/targets/pull/runme.sh +++ b/test/integration/targets/pull/runme.sh @@ -13,6 +13,10 @@ temp_log="${temp_dir}/pull.log" ansible-playbook setup.yml +cleanup="$(pwd)/cleanup.yml" + +trap 'ansible-playbook "${cleanup}"' EXIT + cp -av "pull-integration-test" "${repo_dir}" cd "${repo_dir}" ( diff --git a/test/integration/targets/pull/setup.yml b/test/integration/targets/pull/setup.yml index 581902474d..a82d02aed2 100644 --- a/test/integration/targets/pull/setup.yml +++ b/test/integration/targets/pull/setup.yml @@ -4,3 +4,8 @@ package: name: git when: ansible_distribution != "MacOSX" + register: git_install + - name: save install result + copy: + content: '{{ git_install }}' + dest: '{{ lookup("env", "OUTPUT_DIR") }}/git_install.json'