fix: parse d601 v03 cloud api db secret status (#981)
Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
@@ -1381,6 +1381,30 @@ export function cloudApiDbSecretScript(options: NodeSecretOptions, spec: Runtime
|
||||
"secret_b64_key() { kubectl -n \"$namespace\" get secret \"$1\" -o \"go-template={{ index .data \\\"$2\\\" }}\" 2>/dev/null || true; }",
|
||||
"decoded_value() { if [ -n \"$1\" ]; then printf '%s' \"$1\" | base64 -d 2>/dev/null || true; fi; }",
|
||||
"decoded_length() { if [ -n \"$1\" ]; then printf '%s' \"$1\" | base64 -d 2>/dev/null | wc -c | tr -d ' '; else printf '0'; fi; }",
|
||||
"parse_database_url() {",
|
||||
" uri=$1",
|
||||
" uri_host= uri_user= uri_database= uri_sslmode= uri_password_present=no",
|
||||
" if [ -n \"$uri\" ]; then",
|
||||
" rest=${uri#*://}",
|
||||
" rest_no_query=${rest%%\\?*}",
|
||||
" auth=${rest_no_query%@*}",
|
||||
" host_path=${rest_no_query#*@}",
|
||||
" if [ \"$host_path\" != \"$rest_no_query\" ]; then",
|
||||
" uri_user=${auth%%:*}",
|
||||
" if [ \"$auth\" != \"$uri_user\" ]; then uri_password_present=yes; fi",
|
||||
" else",
|
||||
" host_path=$rest_no_query",
|
||||
" fi",
|
||||
" host_port=${host_path%%/*}",
|
||||
" uri_host=${host_port%%:*}",
|
||||
" uri_database=${host_path#*/}",
|
||||
" if [ \"$uri_database\" = \"$host_path\" ]; then uri_database=; fi",
|
||||
" uri_database=${uri_database%%\\?*}",
|
||||
" case \"$uri\" in",
|
||||
" *sslmode=*) uri_sslmode=${uri#*sslmode=}; uri_sslmode=${uri_sslmode%%\\&*} ;;",
|
||||
" esac",
|
||||
" fi",
|
||||
"}",
|
||||
"psql_scalar() { kubectl -n \"$namespace\" exec \"statefulset/$postgres_statefulset\" -c postgres -- env PGPASSWORD=\"$postgres_admin_password\" psql -U \"$postgres_admin_user\" -d postgres -tAc \"$1\" 2>/dev/null | tr -d '[:space:]'; }",
|
||||
"probe_db() {",
|
||||
" role_result=unknown",
|
||||
|
||||
Reference in New Issue
Block a user