@cryptotaxi247 / netdata-1 / commits / 8490795d6

Patch netdata-installer.sh to avoid unwanted errors during stock config cleanup (#5571)

* netdata/installer: minor fixes on config file lookup Adjust the find command so that: 1) Excludes hidden files, we do not have any configs hidden so its just noise in the results 2) Make sure we are looking at .conf files. All netdata configs are .conf * netdata/installer: Wrap up the fix for #5039 1) Fix find command, missed a dash. Also missed a double quote 2) Extend find further to include the rest of the potential files (TODO: To confirm whether these *installer_backup* files are from previous versions, so need to check them for removal) 3) Make sure you remove the orig part from the start of the remaining path name, so that we can find the respective signature * Adjust the colouring, keep filenames with the same color and mark read only the error message * Add missing python.d config file signatures * netdata/packaging/installer: add new go.d signatures for newly added configs * netdata/signatures: More configuration signatures add/updates * netdata/packaging/installer: Exclude orig folder, it only contains stock configurations that we always keep latest regardless of change * Revert "netdata/signatures: More configuration signatures add/updates" This reverts commit b790ea2ed567af82530b1d8201cfe0c46fc2a6f9. (Was agreed to remove the addtions, since we diverted to a different way and that was to ignore all files inside orig folder as we dont need to check them) * Revert "netdata/packaging/installer: add new go.d signatures for newly added configs" This reverts commit 561b3ca5f5b28124804ebd69dc7d7c09803e90bd. (Was agreed to remove the addtions, since we diverted to a different way and that was to ignore all files inside orig folder as we dont need to check them) * Revert "Add missing python.d config file signatures" This reverts commit 77d1ba3f98cdde894fa95d7f1ee8ebaec50ac718. (Was agreed to remove the addtions, since we diverted to a different way and that was to ignore all files inside orig folder as we dont need to check them)

Paul Katsoulakis committed Mar 19, 2019 at 13:12 UTC 8490795d63347e61c55a9fe5e2480ab7997c44b3
1 file changed +3 -2
netdata-installer.sh
+3 -2
@@ -525,7 +525,7 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
525 }
526
527 # clean up stock config files from the user configuration directory
528 - for x in $(find -L "${NETDATA_PREFIX}/etc/netdata" -type f); do
528 + for x in $(find -L "${NETDATA_PREFIX}/etc/netdata" -type f -not -path '*/\.*' -not -path "${NETDATA_PREFIX}/etc/netdata/orig/*" \( -name '*.conf.old' -o -name '*.conf' -o -name '*.conf.orig' -o -name '*.conf.installer_backup.*' \)); do
529 if [ -f "${x}" ]; then
530 # find it relative filename
531 f="${x/${NETDATA_PREFIX}\/etc\/netdata\//}"
@@ -534,6 +534,7 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
534 t="${f/.conf.installer_backup.*/.conf}"
535 t="${t/.conf.old/.conf}"
536 t="${t/.conf.orig/.conf}"
537 + t="${t/orig\//}"
538
539 if [ -z "${md5sum}" -o ! -x "${md5sum}" ]; then
540 # we don't have md5sum - keep it
@@ -549,7 +550,7 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
550 deleted_stock_configs=$((deleted_stock_configs + 1))
551 else
552 # edited by user - keep it
552 - echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RED} does not match stock of '${t}'${TPUT_RESET}. Keeping it."
553 + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RED} does not match stock of${TPUT_RESET} ${TPUT_CYAN}'${t}'${TPUT_RESET}. Keeping it."
554 fi
555 fi
556 fi