From: Andrei Pavel Date: Fri, 11 Dec 2020 14:49:18 +0000 (+0200) Subject: [#1574] shell scripts: remove_if_exists X-Git-Tag: Kea-1.9.3~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e929e210d2a0aff7f9e3f2704372abfc3879110;p=thirdparty%2Fkea.git [#1574] shell scripts: remove_if_exists --- 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.