diff options
author | Andrei Pavel <andrei@isc.org> | 2020-12-11 15:49:18 +0100 |
---|---|---|
committer | Andrei Pavel <andrei@isc.org> | 2020-12-14 11:08:11 +0100 |
commit | 5e929e210d2a0aff7f9e3f2704372abfc3879110 (patch) | |
tree | dcf111855956102e80fbc0771bca48a49e156966 | |
parent | [#1574] ${var+x}, ${var-x} changes (diff) | |
download | kea-5e929e210d2a0aff7f9e3f2704372abfc3879110.tar.xz kea-5e929e210d2a0aff7f9e3f2704372abfc3879110.zip |
[#1574] shell scripts: remove_if_exists
-rw-r--r-- | src/lib/testutils/dhcp_test_lib.sh.in | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/lib/testutils/dhcp_test_lib.sh.in b/src/lib/testutils/dhcp_test_lib.sh.in index 161bfa4d8a..6cdb484afd 100644 --- a/src/lib/testutils/dhcp_test_lib.sh.in +++ b/src/lib/testutils/dhcp_test_lib.sh.in @@ -539,6 +539,15 @@ cleanup() { kill_processes_by_name "kea-lfc" # Remove temporary files. + remove_if_exists \ + "${CA_CFG_FILE-}" \ + "${CFG_FILE-}" \ + "${D2_CFG_FILE-}" \ + "${DHCP4_CFG_FILE-}" \ + "${DHCP6_CFG_FILE-}" \ + "${KEACTRL_CFG_FILE-}" \ + "${NC_CFG_FILE-}" + # Use ${var+x} to test if ${var} is defined. if test -n "${LOG_FILE+x}" && test -n "${LOG_FILE}"; then rm -rf "${LOG_FILE}" @@ -550,27 +559,6 @@ cleanup() { if test -n "${LEASE_FILE+x}" && test -n "${LEASE_FILE}"; then rm -rf "${LEASE_FILE}"* fi - if test -n "${CFG_FILE+x}" && test -n "${CFG_FILE}"; then - rm -rf "${CFG_FILE}" - fi - if test -n "${DHCP4_CFG_FILE+x}" && test -n "${DHCP4_CFG_FILE}"; then - rm -rf "${DHCP4_CFG_FILE}" - fi - if test -n "${DHCP6_CFG_FILE+x}" && test -n "${DHCP6_CFG_FILE}"; then - rm -rf "${DHCP6_CFG_FILE}" - fi - if test -n "${D2_CFG_FILE+x}" && test -n "${D2_CFG_FILE}"; then - rm -rf "${D2_CFG_FILE}" - fi - if test -n "${CA_CFG_FILE+x}" && test -n "${CA_CFG_FILE}"; then - rm -rf "${CA_CFG_FILE}" - fi - if test -n "${NC_CFG_FILE+x}" && test -n "${NC_CFG_FILE}"; then - rm -rf "${NC_CFG_FILE}" - fi - if test -n "${KEACTRL_CFG_FILE+x}" && test -n "${KEACTRL_CFG_FILE}"; then - rm -rf "${KEACTRL_CFG_FILE}" - fi } # Exists the test in the clean way. |