Truenas 26 deploy fixes (#7205)

* Works with TrueNAS 26.0.0-BETA3 now

* Updated to work with new and old versions of TrueNAS

* shfmt fix for my changes

---------

Co-authored-by: Bill Weiss <github@e.billweiss.net>
This commit is contained in:
Bill WeissandBill Weiss authored and GitHub committed 2026-09-11 11:55:38 +08:00
1 parent 9249c89221
commit 98276668fd
1 file changed
+12 -12
+12 -12
View File
@@ -43,15 +43,15 @@ _ws_call() {
_debug "_ws_call arg1" "$1" _debug "_ws_call arg1" "$1"
_debug "_ws_call arg2" "$2" _debug "_ws_call arg2" "$2"
_debug "_ws_call arg3" "$3" _debug "_ws_call arg3" "$3"
if [ $# -eq 3 ]; then
_ws_response=$(midclt --uri "$_ws_uri" -K "$DEPLOY_TRUENAS_APIKEY" call "$1" "$2" "$3") # TrueNAS 26.0.0-BETA3 and later need a --plain option for midclt call, detect if it is available
fi _midclt_plain=""
if [ $# -eq 2 ]; then case "$(midclt --help 2>/dev/null)" in
_ws_response=$(midclt --uri "$_ws_uri" -K "$DEPLOY_TRUENAS_APIKEY" call "$1" "$2") *--plain*) _midclt_plain="--plain" ;;
fi esac
if [ $# -eq 1 ]; then
_ws_response=$(midclt --uri "$_ws_uri" -K "$DEPLOY_TRUENAS_APIKEY" call "$1") _ws_response=$(midclt --uri "$_ws_uri" -K "$DEPLOY_TRUENAS_APIKEY" $_midclt_plain call "$@")
fi
_debug "_ws_response" "$_ws_response" _debug "_ws_response" "$_ws_response"
printf "%s" "$_ws_response" printf "%s" "$_ws_response"
return 0 return 0
@@ -256,8 +256,8 @@ truenas_ws_deploy() {
_info "Gather current WebUI certificate..." _info "Gather current WebUI certificate..."
_ws_response="$(_ws_call "system.general.config")" _ws_response="$(_ws_call "system.general.config")"
_ui_certificate_id=$(printf "%s" "$_ws_response" | jq -r '."ui_certificate"."id"') _ui_certificate_id=$(printf "%s" "$_ws_response" | jq -r '.ui_certificate | if type == "object" then .id else . end')
_ui_certificate_name=$(printf "%s" "$_ws_response" | jq -r '."ui_certificate"."name"') _ui_certificate_name=$(printf "%s" "$_ws_response" | jq -r 'if (.ui_certificate | type) == "object" then .ui_certificate.name else .ui_certificate_name end')
_info "Current WebUI certificate ID: $_ui_certificate_id" _info "Current WebUI certificate ID: $_ui_certificate_id"
_info "Current WebUI certificate name: $_ui_certificate_name" _info "Current WebUI certificate name: $_ui_certificate_name"
@@ -332,7 +332,7 @@ truenas_ws_deploy() {
_info "Replace WebUI certificate..." _info "Replace WebUI certificate..."
_ws_response=$(_ws_call "system.general.update" "{\"ui_certificate\": $_new_certid}") _ws_response=$(_ws_call "system.general.update" "{\"ui_certificate\": $_new_certid}")
_changed_certid=$(printf "%s" "$_ws_response" | jq -r '."ui_certificate"."id"') _changed_certid=$(printf "%s" "$_ws_response" | jq -r '.ui_certificate | if type == "object" then .id else . end')
if [ "$_changed_certid" != "$_new_certid" ]; then if [ "$_changed_certid" != "$_new_certid" ]; then
_err "WebUI certificate change error.." _err "WebUI certificate change error.."
return 5 return 5
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.