From 2ae36946ae9e4bcd851c819d9e35a6dac3998fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 5 Apr 2023 13:16:07 +0200 Subject: [PATCH] systemd-vaultd-update-secrets: fix case when user reload the service manually --- cmd/systemd-vaultd-update-secrets/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/systemd-vaultd-update-secrets/main.go b/cmd/systemd-vaultd-update-secrets/main.go index a5ae241..ef69fea 100644 --- a/cmd/systemd-vaultd-update-secrets/main.go +++ b/cmd/systemd-vaultd-update-secrets/main.go @@ -32,16 +32,16 @@ func updateSecrets(serviceName, target string) error { if err != nil { if os.IsNotExist(err) { // wait for the file to be created - fmt.Printf("waiting for %s to be created", jsonPath) + log.Printf("waiting for %s to be created", jsonPath) time.Sleep(1 * time.Second) continue } return fmt.Errorf("failed to stat vault json file %s: %w", serviceName, err) } - if jsonStat.ModTime().Before(stat.ModTime()) { + if jsonStat.ModTime().Before(stat.ModTime()) && i < 9 { // wait for the file to be updated - fmt.Printf("waiting for %s to be updated", jsonPath) + log.Printf("waiting for %s to be updated", jsonPath) time.Sleep(1 * time.Second) continue } @@ -50,7 +50,7 @@ func updateSecrets(serviceName, target string) error { if err != nil { if os.IsNotExist(err) { // wait for the file to be created - fmt.Printf("waiting for %s to be created", jsonPath) + log.Printf("waiting for %s to be created", jsonPath) time.Sleep(1 * time.Second) continue }