refactor(postgres-dump): 简化 Docker 执行逻辑并移除冗余代码
This commit is contained in:
@@ -59,9 +59,10 @@ docker_exec_create() {
|
||||
AttachStdout: true,
|
||||
AttachStderr: true,
|
||||
Tty: true,
|
||||
Cmd: ["bash", "-lc", $cmd]
|
||||
Cmd: ["sh", "-c", $cmd]
|
||||
}')
|
||||
|
||||
DOCKER_LAST_RESPONSE=""
|
||||
DOCKER_LAST_RESPONSE=$(curl --fail --silent --show-error --unix-socket "$DOCKER_SOCKET" \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -83,6 +84,7 @@ docker_exec_start() {
|
||||
docker_exec_start_id=$1
|
||||
docker_exec_start_desc=$2
|
||||
docker_exec_start_endpoint="${docker_api_base}/exec/${docker_exec_start_id}/start"
|
||||
DOCKER_LAST_RESPONSE=""
|
||||
DOCKER_LAST_RESPONSE=$(curl --fail --show-error --silent --unix-socket "$DOCKER_SOCKET" \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -97,6 +99,7 @@ docker_exec_start() {
|
||||
docker_exec_exit_code() {
|
||||
docker_exec_exit_id=$1
|
||||
docker_exec_inspect_endpoint="${docker_api_base}/exec/${docker_exec_exit_id}/json"
|
||||
DOCKER_LAST_RESPONSE=""
|
||||
DOCKER_LAST_RESPONSE=$(curl --fail --silent --show-error --unix-socket "$DOCKER_SOCKET" "$docker_exec_inspect_endpoint")
|
||||
docker_exec_exit_code_value=$(printf '%s' "$DOCKER_LAST_RESPONSE" | jq -r '.ExitCode // empty')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user