Skip to content

Commit 722dd76

Browse files
committed
updates from code review
Signed-off-by: Ganga Ram <Ganga.Ram@tii.ae>
1 parent bbbbc0f commit 722dd76

File tree

2 files changed

+10
-127
lines changed

2 files changed

+10
-127
lines changed

modules/common/security/spire/server.nix

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ let
108108
echo "Agent ${vm} already registered, skipping token generation"
109109
else
110110
echo "Generating new token for ${vm}"
111-
token="$(spire-server token generate \
112-
-socketPath ${socketPath} \
113-
-spiffeID spiffe://${cfg.trustDomain}/${vm} \
114-
| awk '/^Token:/ {print $2}')"
111+
output=$(spire-server token generate -socketPath "${socketPath}" -spiffeID "spiffe://${cfg.trustDomain}/${vm}")
112+
113+
# Check if the command actually worked
114+
if [ $? -ne 0 ]; then
115+
echo "Error: SPIRE token generation failed!" >&2
116+
exit 1
117+
fi
118+
119+
# Extract the token from the successful output
120+
token=$(echo "$output" | awk '/^Token:/ {print $2}')
115121
116122
printf '%s\n' "$token" > "$tokenFile"
117123
chmod 0644 "$tokenFile"

modules/common/services/yubikey.nix.orig

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)