Skip to content

Commit

Permalink
feat(ns-plug): handle missing HTTP code and add down script for ns-plug
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Dec 17, 2024
1 parent 0fcd6f7 commit 7e2d4bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ns-plug/files/ns-plug
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ response=""
until [ "${valid}" -eq 1 ] || [ "${watchdog}" -ge "${max_attempts}" ]
do
response=$(curl ${curl_opts} -H "Content-Type: application/json" -H "RegistrationToken: ${token}" ${server}/api/units/register -X POST --data '{"unit_id": "'${unit_id}'", "username": "'${user}'", "password": "'${secret}'", "unit_name": "'${unit_name}'", "version": "'${VERSION_ID}'", "subscription_type": "'${subscription_type}'", "system_id": "'${system_id}'"}')
http_code=$(echo ${response} | jq -r .code)
http_code=$(echo ${response} | jq -r '.code // empty')
if [ "${http_code}" == "409" ]; then
# Duplicate entry, cleanup uci config
uci delete rpcd.controller
Expand Down Expand Up @@ -112,6 +112,7 @@ dev tun-nsplug
tls-client
script-security 2
route-up /usr/sbin/ns-controller-push-info
down "/usr/sbin/restart-ns-plug"
<ca>
${ca}
</ca>
Expand Down

0 comments on commit 7e2d4bc

Please sign in to comment.