From ba6cad17650da5037cba28a109ca9ca5cd967afc Mon Sep 17 00:00:00 2001 From: Henrik Riomar Date: Wed, 3 Nov 2021 16:51:27 +0100 Subject: [PATCH] apk: add CLUSTERS: support --- apk/apt-dater-host | 10 ++++++++++ apk/apt-dater-host.conf | 6 ++++++ apk/test-apt-dater-host | 14 ++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/apk/apt-dater-host b/apk/apt-dater-host index c60ffd6..42a9f6b 100755 --- a/apk/apt-dater-host +++ b/apk/apt-dater-host @@ -145,6 +145,15 @@ get_kern() } +# CLUSTER: ${Cluster-A} +# CLUSTER: ${Cluster-B} +get_clusters() +{ + if [ -n "$CLUSTERS" ]; then + printf 'CLUSTER: %s\n' $CLUSTERS + fi +} + # FORBID: ${Operations} check_forbid() { @@ -168,6 +177,7 @@ do_status() get_virt get_uname check_forbid + get_clusters get_pkg_stat get_kern } diff --git a/apk/apt-dater-host.conf b/apk/apt-dater-host.conf index 6ac7e14..1bb7e44 100644 --- a/apk/apt-dater-host.conf +++ b/apk/apt-dater-host.conf @@ -6,6 +6,12 @@ # Supported: doas and sudo #ROOT_CMD="doas" +# If this host is part of (multiple) cluster(s), you might set a +# symbolic name. Hosts with the same cluster name won't be upgraded +# simultaneously by apt-dater (requires apt-dater 0.9 or above). +# (space separated list) +#CLUSTERS="cluster-1 cluster-2" + ## ## If this host is a mission critical system and ## needs scheduled downtimes for upgrades, enable diff --git a/apk/test-apt-dater-host b/apk/test-apt-dater-host index f0a47fe..aefaf54 100755 --- a/apk/test-apt-dater-host +++ b/apk/test-apt-dater-host @@ -79,3 +79,17 @@ test_get_virt() result="$(check_forbid)" [[ "$result" == "FORBID: 7" ]] } + +@test "get_clusters()" { + unset CLUSTERS + result="$(get_clusters)" + [[ "$result" == "" ]] + + CLUSTERS="cluster-1" + result="$(get_clusters)" + check_tag CLUSTER $result + [[ "$result" == "CLUSTER: cluster-1" ]] + + CLUSTERS="cluster-1 cluster-2" + [ $(get_clusters | wc -l) -eq 2 ] +} -- 2.33.1