From 16fc7a62c6873cd0c06a63bc7b37247534f0c72e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 31 Jan 2025 14:04:25 +0100 Subject: sbin/itzks-puppetserver-detect-broken-hosts: Add support for ignoring already repaired puppet clients. --- debian/itzks-systems-puppetserver.install | 1 + etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts | 6 ++++++ sbin/itzks-puppetserver-detect-broken-hosts | 9 +++++++++ 3 files changed, 16 insertions(+) create mode 100644 etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts diff --git a/debian/itzks-systems-puppetserver.install b/debian/itzks-systems-puppetserver.install index ba14913..06b07a8 100644 --- a/debian/itzks-systems-puppetserver.install +++ b/debian/itzks-systems-puppetserver.install @@ -1,4 +1,5 @@ etc/cron.d/itzks-systems-puppetserver +etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts sbin/itzks-puppetserver-autosign-new-host-certificates usr/sbin/ sbin/itzks-puppetserver-clean-hosts-from-ca usr/sbin/ sbin/itzks-puppetserver-detect-broken-hosts usr/sbin/ diff --git a/etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts b/etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts new file mode 100644 index 0000000..09b7ed1 --- /dev/null +++ b/etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts @@ -0,0 +1,6 @@ +# When diagnosing host sign-ups in puppetserver via the itzks-puppetserver-detect-broken-hosts script, +# put all already fixed systems into this file so they get ignored when re-scanning puppetserver logs +# with above named script. +# +# Example: +#pc-12.intern diff --git a/sbin/itzks-puppetserver-detect-broken-hosts b/sbin/itzks-puppetserver-detect-broken-hosts index ad13ea7..a632c52 100755 --- a/sbin/itzks-puppetserver-detect-broken-hosts +++ b/sbin/itzks-puppetserver-detect-broken-hosts @@ -26,6 +26,11 @@ usage() { exit 1 } +ignore_repaired_hosts="" +if [ -e /etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts ]; then + ignore_repaired_hosts=$(cat /etc/debian-edu/itzks-puppetserver-fixed-puppet-hosts | grep -v -E "^#.*") +fi + for arg in "$@"; do case "${arg}" in -t|--today) @@ -66,6 +71,10 @@ for ip in ${iplist_with_puppeterrors}; do continue fi + if [ -n "${fqdn}" ] && echo "${ignore_repaired_hosts}" | grep -q "${fqdn}"; then + continue + fi + if [[ -n "${INCLUDE}" ]] && ! echo "${ip} ${fqdn}" | grep -q -E "${INCLUDE}"; then continue fi -- cgit v1.2.3