Skip to content

Commit 9240363

Browse files
committed
feat: send data to new enterprise portal proxy
The new my.nethesis.it portal should start receiving data for enterprise subscription: this a temporary change that will help the migration to th new platform Add also new info to phonehome to mimic inventory of NethServer 8
1 parent b5539af commit 9240363

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

packages/ns-phonehome/files/send-phonehome

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ fi
1616

1717
/usr/sbin/phonehome | curl -m 180 --retry 3 -L -s \
1818
-H "Content-type: application/json" -H "Accept: application/json" \
19-
--data-binary @- "$URL" > /dev/null
19+
--data-binary @- "$URL" > /dev/null

packages/ns-plug/files/send-heartbeat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
SYSTEM_ID=$(uci -q get ns-plug.config.system_id)
1111
SYSTEM_SECRET=$(uci -q get ns-plug.config.secret)
1212
URL=$(uci -q get ns-plug.config.alerts_url)"heartbeats/store"
13+
TYPE=$(uci -q get ns-plug.config.type)
1314

1415
if [ -z "$SYSTEM_ID" ] || [ -z "$SYSTEM_SECRET" ]; then
1516
# System ID or system secret not found, configure ns-plug
@@ -19,3 +20,11 @@ fi
1920
/usr/bin/curl -m 180 --retry 3 -L -s \
2021
--header "Authorization: token $SYSTEM_SECRET" --header "Content-Type: application/json" --header "Accept: application/json" \
2122
--data-raw '{"lk": "'$SYSTEM_ID'"}' "$URL" >/dev/null
23+
24+
# Temporary send data to new endpoint
25+
# To be removed when the migration to new my.nethesis.it will be completed
26+
if [ "$TYPE" = "enterprise" ]; then
27+
/usr/bin/curl -m 180 --retry 3 -L -s -X POST \
28+
--user "$SYSTEM_ID:$SYSTEM_SECRET" https://my.nethesis.it/proxy/heartbeat >/dev/null
29+
exit 0
30+
fi

packages/ns-plug/files/send-inventory

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ if [ "$TYPE" = "enterprise" ]; then
3535
/usr/bin/curl -m 180 --retry 5 -L -s \
3636
--header "Content-Type: application/json" --header "Accept: application/json" \
3737
-d '{"secret":"'$SYSTEM_SECRET'"}' https://my.nethesis.it/api/systems/info >/dev/null
38+
39+
# Temporary send data to new endpoint
40+
# To be removed when the migration to new my.nethesis.it will be completed
41+
/usr/sbin/phonehome | /usr/bin/curl -m 180 --retry 3 -L -s --user "$SYSTEM_ID:$SYSTEM_SECRET" \
42+
-H "Content-Type: application/json" \
43+
--data-binary @"$TMPFILE" https://my.nethesis.it/proxy/inventory >/dev/null || exit 0
3844
fi

0 commit comments

Comments
 (0)