From de99cda766115eb9b41ef231a6921b419ab4a073 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Thu, 16 Nov 2023 15:51:17 -0500 Subject: [PATCH] improve timing of responses --- salt/soc/files/bin/salt-relay.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/salt/soc/files/bin/salt-relay.sh b/salt/soc/files/bin/salt-relay.sh index fea81728d..783018b3a 100755 --- a/salt/soc/files/bin/salt-relay.sh +++ b/salt/soc/files/bin/salt-relay.sh @@ -37,12 +37,14 @@ function poll() { function respond() { file="$QUEUE_DIR/$1.response" + tmpfile=${file}.tmp response=$2 - touch "$file" - chmod 660 "$file" - chown "$QUEUE_OWNER:$QUEUE_GROUP" "$file" - echo "$response" > "$file" + touch "$tmpfile" + chmod 660 "$tmpfile" + chown "$QUEUE_OWNER:$QUEUE_GROUP" "$tmpfile" + echo "$response" > "$tmpfile" + mv $tmpfile $file } function list_minions() {