From d01411c3c4af6c724a3800c621804ea979818d6d Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Thu, 10 Oct 2019 15:31:28 +0000 Subject: Cleanup via Ansible + Remove dependency on topo_ scripts that depends on custom SSH() that depends on framework itself. This way the cleanup is independent of failure in our SSH libs. + Simple ansible command can do cleanup of a machine: ansible-playbook --inventory inventories/lf_inventory/hosts site.yaml \ --limit '10.32.8.18' --tags 'cleanup' + Add vpp_device reset and cleanup. + Remove historical scripts. - Still in testing beta phase. - Need to add SRIOV cleanup. Signed-off-by: Peter Mikus Change-Id: I68e23304c7ad01041f51263c328c6e8d9b555cb7 --- resources/libraries/bash/function/ansible.sh | 3 +-- resources/libraries/bash/function/common.sh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'resources/libraries/bash/function') diff --git a/resources/libraries/bash/function/ansible.sh b/resources/libraries/bash/function/ansible.sh index 5bf122e4b0..431acc7c5d 100644 --- a/resources/libraries/bash/function/ansible.sh +++ b/resources/libraries/bash/function/ansible.sh @@ -28,8 +28,7 @@ function ansible_hosts () { set -exuo pipefail if ! installed sshpass; then - sudo apt-get update -y || die "apt-get update failed!" - sudo apt-get install -y sshpass || die "Install sshpass failed!" + die "Please install sshpass!" fi if ! installed ansible-playbook; then diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index f9c9e2ea91..f5e1111a17 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -604,7 +604,7 @@ function reserve_and_cleanup_testbed () { } # Cleanup check. set +e - cleanup_topo + ansible_hosts "cleanup" result="$?" set -e if [[ "${result}" == "0" ]]; then @@ -1040,7 +1040,7 @@ function untrap_and_unreserve_testbed () { set -eu warn "Testbed looks unreserved already. Trap removal failed before?" else - cleanup_topo || true + ansible_hosts "cleanup" || true python "${PYTHON_SCRIPTS_DIR}/topo_reservation.py" -c -t "${wt}" || { die "${1:-FAILED TO UNRESERVE, FIX MANUALLY.}" 2 } -- cgit 1.2.3-korg