@@ -39,13 +39,13 @@ _ws_call() {
3939 _debug " _ws_call arg2" " $2 "
4040 _debug " _ws_call arg3" " $3 "
4141 if [ $# -eq 3 ]; then
42- _ws_response=$( midclt -K " $DEPLOY_TRUENAS_APIKEY " call " $1 " " $2 " " $3 " )
42+ _ws_response=$( midclt --uri $_ws_uri - K " $DEPLOY_TRUENAS_APIKEY " call " $1 " " $2 " " $3 " )
4343 fi
4444 if [ $# -eq 2 ]; then
45- _ws_response=$( midclt -K " $DEPLOY_TRUENAS_APIKEY " call " $1 " " $2 " )
45+ _ws_response=$( midclt --uri $_ws_uri - K " $DEPLOY_TRUENAS_APIKEY " call " $1 " " $2 " )
4646 fi
4747 if [ $# -eq 1 ]; then
48- _ws_response=$( midclt -K " $DEPLOY_TRUENAS_APIKEY " call " $1 " )
48+ _ws_response=$( midclt --uri $_ws_uri - K " $DEPLOY_TRUENAS_APIKEY " call " $1 " )
4949 fi
5050 _debug " _ws_response" " $_ws_response "
5151 printf " %s" " $_ws_response "
@@ -60,7 +60,7 @@ _ws_upload_cert() {
6060import sys
6161
6262from truenas_api_client import Client
63- with Client() as c:
63+ with Client(uri=" $_ws_uri " ) as c:
6464
6565 ### Login with API key
6666 print("I:Trying to upload new certificate...")
@@ -175,6 +175,16 @@ truenas_ws_deploy() {
175175 _debug _file_ca " $_file_ca "
176176 _debug _file_fullchain " $_file_fullchain "
177177
178+ # ######### Default values for hostname and protocol
179+ [ -n " ${DEPLOY_TRUENAS_HOSTNAME} " ] || DEPLOY_TRUENAS_HOSTNAME=" localhost"
180+ [ -n " ${DEPLOY_TRUENAS_PROTOCOL} " ] || DEPLOY_TRUENAS_PROTOCOL=" ws"
181+
182+ _debug2 DEPLOY_TRUENAS_HOSTNAME " $DEPLOY_TRUENAS_HOSTNAME "
183+ _debug2 DEPLOY_TRUENAS_PROTOCOL " $DEPLOY_TRUENAS_PROTOCOL "
184+
185+ _ws_uri=" $DEPLOY_TRUENAS_PROTOCOL ://$DEPLOY_TRUENAS_HOSTNAME /websocket"
186+ _debug _ws_uri " $_ws_uri "
187+
178188 # ######### Environment check
179189
180190 _info " Checking environment variables..."
@@ -304,7 +314,7 @@ truenas_ws_deploy() {
304314 _info " Restarting WebUI..."
305315 _ws_response=$( _ws_call " system.general.ui_restart" )
306316 _info " Waiting for UI restart..."
307- sleep 6
317+ sleep 15
308318
309319 # ######### Certificates
310320
0 commit comments