Skip to content

Commit 34f5bc0

Browse files
gsanchiettiCopilot
andauthored
Update packages/ns-phonehome/files/send-phonehome
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9377dc4 commit 34f5bc0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/ns-phonehome/files/send-phonehome

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@ if [ "$ENABLED" = "0" ] || [ -z "$URL" ]; then
1515
exit 0
1616
fi
1717

18-
/usr/sbin/phonehome | curl -m 180 --retry 3 -L -s \
18+
TMPFILE=$(mktemp) || exit 1
19+
20+
/usr/sbin/phonehome > "$TMPFILE"
21+
22+
curl -m 180 --retry 3 -L -s \
1923
-H "Content-type: application/json" -H "Accept: application/json" \
20-
--data-binary @- "$URL" > /dev/null
24+
--data-binary @"$TMPFILE" "$URL" > /dev/null
2125

2226
# Temporary send data to new endpoint
2327
# To be removed when the migration to new my.nethesis.it will be completed
2428
if [ "$TYPE" == "enterprise" ]; then
2529
SYSTEM_ID=$(uci -q get ns-plug.config.system_id)
2630
SYSTEM_SECRET=$(uci -q get ns-plug.config.secret)
27-
/usr/sbin/phonehome | /usr/bin/curl -m 180 --retry 3 -L -s --user "$SYSTEM_ID:$SYSTEM_SECRET" \
31+
/usr/bin/curl -m 180 --retry 3 -L -s --user "$SYSTEM_ID:$SYSTEM_SECRET" \
2832
-H "Content-Type: application/json" \
29-
--data-binary @- https://my.nethesis.it/proxy/inventory >/dev/null
33+
--data-binary @"$TMPFILE" https://my.nethesis.it/proxy/inventory >/dev/null
34+
rm -f "$TMPFILE"
3035
exit 0
3136
fi
37+
38+
rm -f "$TMPFILE"

0 commit comments

Comments
 (0)