From 8a1616223e687e4de191c8ff740b1a9e0dcd24c9 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Tue, 5 Mar 2024 09:53:12 -0700 Subject: [PATCH] fix(statefile): Ensure valid statefile (#14937) --- scripts/deb/post-install.sh | 1 + scripts/rpm/post-install.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/deb/post-install.sh b/scripts/deb/post-install.sh index d7d23883e21b9..bdd79f79182f1 100644 --- a/scripts/deb/post-install.sh +++ b/scripts/deb/post-install.sh @@ -57,6 +57,7 @@ test -d "$STATE_DIR" || { STATE_FILE="$STATE_DIR/statefile" test -f "$STATE_FILE" || { touch "$STATE_FILE" + echo {} > "$STATE_FILE" chown root:telegraf "$STATE_FILE" chmod 660 "$STATE_FILE" } diff --git a/scripts/rpm/post-install.sh b/scripts/rpm/post-install.sh index a6f05754a883c..bd88343b5b192 100644 --- a/scripts/rpm/post-install.sh +++ b/scripts/rpm/post-install.sh @@ -36,6 +36,7 @@ test -d "$STATE_DIR" || { STATE_FILE="$STATE_DIR/statefile" test -f "$STATE_FILE" || { touch "$STATE_FILE" + echo {} > "$STATE_FILE" chown root:telegraf "$STATE_FILE" chmod 660 "$STATE_FILE" }