Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
5a59c390
Commit
5a59c390
authored
Jan 28, 2023
by
neilpang
Browse files
fix format
parent
a02dd18a
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/truenas.sh
View file @
5a59c390
...
@@ -184,22 +184,21 @@ truenas_deploy() {
...
@@ -184,22 +184,21 @@ truenas_deploy() {
_info
"S3 certificate is not configured or is not the same as TrueNAS web UI"
_info
"S3 certificate is not configured or is not the same as TrueNAS web UI"
fi
fi
_info
"Checking if any chart release Apps is using the same certificate as TrueNAS web UI. Tool 'jq' is required"
_info
"Checking if any chart release Apps is using the same certificate as TrueNAS web UI. Tool 'jq' is required"
if
_exists jq
;
then
if
_exists jq
;
then
_info
"Query all chart release"
_info
"Query all chart release"
_release_list
=
$(
_get
"
$_api_url
/chart/release"
)
_release_list
=
$(
_get
"
$_api_url
/chart/release"
)
_related_name_list
=
$(
printf
"%s"
$_release_list
| jq
-r
"[.[] | {name,certId: .config.ingress?.main.tls[]?.scaleCert} | select(.certId==
$_active_cert_id
) | .name ] | unique"
)
_related_name_list
=
$(
printf
"%s"
"
$_release_list
"
| jq
-r
"[.[] | {name,certId: .config.ingress?.main.tls[]?.scaleCert} | select(.certId==
$_active_cert_id
) | .name ] | unique"
)
_release_length
=
$(
printf
"%s"
$_related_name_list
| jq
-r
"length"
)
_release_length
=
$(
printf
"%s"
$_related_name_list
| jq
-r
"length"
)
_info
"Found
$_release_length
related chart release in list:
$_related_name_list
"
_info
"Found
$_release_length
related chart release in list:
$_related_name_list
"
for
i
in
$(
seq
0
$((
_release_length-1
))
)
;
for
i
in
$(
seq
0
$((
_release_length-1
))
)
;
do
do
_release_name
=
$(
echo
$_related_name_list
| jq
-r
".[
$i
]"
)
_release_name
=
$(
echo
"
$_related_name_list
"
| jq
-r
".[
$i
]"
)
_info
"Updating certificate from
$_active_cert_id
to
$_cert_id
for chart release:
$_release_name
"
_info
"Updating certificate from
$_active_cert_id
to
$_cert_id
for chart release:
$_release_name
"
#Read the chart release configuration
#Read the chart release configuration
_chart_config
=
$(
printf
"%s"
$_release_list
| jq
-r
".[] | select(.name==
\"
$_release_name
\"
)"
)
_chart_config
=
$(
printf
"%s"
"
$_release_list
"
| jq
-r
".[] | select(.name==
\"
$_release_name
\"
)"
)
#Replace the old certificate id with the new one in path .config.ingress.main.tls[].scaleCert. Then update .config.ingress
#Replace the old certificate id with the new one in path .config.ingress.main.tls[].scaleCert. Then update .config.ingress
_updated_chart_config
=
$(
printf
"%s"
$_chart_config
| jq
"(.config.ingress?.main.tls[]? | select(.scaleCert==
$_active_cert_id
) | .scaleCert ) |=
$_cert_id
| .config.ingress "
)
_updated_chart_config
=
$(
printf
"%s"
"
$_chart_config
"
| jq
"(.config.ingress?.main.tls[]? | select(.scaleCert==
$_active_cert_id
) | .scaleCert ) |=
$_cert_id
| .config.ingress "
)
_update_chart_result
=
"
$(
_post
"{
\"
values
\"
: {
\"
ingress
\"
:
$_updated_chart_config
} }"
"
$_api_url
/chart/release/id/
$_release_name
"
""
"PUT"
"application/json"
)
"
_update_chart_result
=
"
$(
_post
"{
\"
values
\"
: {
\"
ingress
\"
:
$_updated_chart_config
} }"
"
$_api_url
/chart/release/id/
$_release_name
"
""
"PUT"
"application/json"
)
"
_debug3 _update_chart_result
"
$_update_chart_result
"
_debug3 _update_chart_result
"
$_update_chart_result
"
done
done
...
@@ -207,7 +206,6 @@ truenas_deploy() {
...
@@ -207,7 +206,6 @@ truenas_deploy() {
_info
"Tool 'jq' does not exists, skip chart release checking"
_info
"Tool 'jq' does not exists, skip chart release checking"
fi
fi
_info
"Deleting old certificate"
_info
"Deleting old certificate"
_delete_result
=
"
$(
_post
""
"
$_api_url
/certificate/id/
$_active_cert_id
"
""
"DELETE"
"application/json"
)
"
_delete_result
=
"
$(
_post
""
"
$_api_url
/certificate/id/
$_active_cert_id
"
""
"DELETE"
"application/json"
)
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment