Skip to content

Commit 7e2d4bc

Browse files
committed
feat(ns-plug): handle missing HTTP code and add down script for ns-plug
1 parent 0fcd6f7 commit 7e2d4bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/ns-plug/files/ns-plug

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ response=""
7171
until [ "${valid}" -eq 1 ] || [ "${watchdog}" -ge "${max_attempts}" ]
7272
do
7373
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}'"}')
74-
http_code=$(echo ${response} | jq -r .code)
74+
http_code=$(echo ${response} | jq -r '.code // empty')
7575
if [ "${http_code}" == "409" ]; then
7676
# Duplicate entry, cleanup uci config
7777
uci delete rpcd.controller
@@ -112,6 +112,7 @@ dev tun-nsplug
112112
tls-client
113113
script-security 2
114114
route-up /usr/sbin/ns-controller-push-info
115+
down "/usr/sbin/restart-ns-plug"
115116
<ca>
116117
${ca}
117118
</ca>

0 commit comments

Comments
 (0)