mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-09-21 05:31:25 +02:00
Bring in some more fixes and features from upstream master: * Work with doas (new default, but still supports sudo) * Allow configuring what operations that are not allowed * Add cluster reporting
82 lines
1.9 KiB
Diff
82 lines
1.9 KiB
Diff
From ba6cad17650da5037cba28a109ca9ca5cd967afc Mon Sep 17 00:00:00 2001
|
|
From: Henrik Riomar <henrik.riomar@gmail.com>
|
|
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
|
|
|