mirror of https://github.com/containers/podman.git
Merge pull request #26230 from jankaluza/26078
Handle "Entrypoint":[] in compat containers/create API.
This commit is contained in:
commit
39692c5648
|
@ -209,6 +209,12 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C
|
||||||
jsonString := string(b)
|
jsonString := string(b)
|
||||||
entrypoint = &jsonString
|
entrypoint = &jsonString
|
||||||
}
|
}
|
||||||
|
} else if cc.Config.Entrypoint != nil {
|
||||||
|
// Entrypoint in HTTP request is set, but it is an empty slice.
|
||||||
|
// Set the entrypoint to empty string slice, because keeping it set to nil
|
||||||
|
// would later fallback to default entrypoint.
|
||||||
|
emptySlice := "[]"
|
||||||
|
entrypoint = &emptySlice
|
||||||
}
|
}
|
||||||
|
|
||||||
// expose ports
|
// expose ports
|
||||||
|
|
|
@ -811,6 +811,26 @@ if root && test -e /dev/nullb0; then
|
||||||
podman rm -f updateCtr
|
podman rm -f updateCtr
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# test apiv2 create container with empty entrypoint
|
||||||
|
# --data '{"Image":"quay.io/libpod/some:thing","Entrypoint": []}'
|
||||||
|
# Fixes #26078
|
||||||
|
podman image build -t test1:latest -<<EOF
|
||||||
|
from alpine
|
||||||
|
ENTRYPOINT ["echo", "test"]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
t POST containers/create \
|
||||||
|
Image=test1:latest \
|
||||||
|
Entrypoint=[] \
|
||||||
|
201 \
|
||||||
|
.Id~[0-9a-f]\\{64\\}
|
||||||
|
cid=$(jq -r '.Id' <<<"$output")
|
||||||
|
t GET containers/$cid/json 200 \
|
||||||
|
.Config.Entrypoint[0]=null
|
||||||
|
|
||||||
|
t DELETE containers/$cid 204
|
||||||
|
podman rmi test1
|
||||||
|
|
||||||
|
|
||||||
# test if API support -1 for ulimits https://github.com/containers/podman/issues/24886
|
# test if API support -1 for ulimits https://github.com/containers/podman/issues/24886
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ function jsonify() {
|
||||||
local rhs
|
local rhs
|
||||||
IFS='=' read lhs rhs <<<"$i"
|
IFS='=' read lhs rhs <<<"$i"
|
||||||
|
|
||||||
if [[ $rhs =~ \" || $rhs == true || $rhs == false || $rhs =~ ^-?[0-9]+$ ]]; then
|
if [[ $rhs =~ \" || $rhs == true || $rhs == false || $rhs == "[]" || $rhs =~ ^-?[0-9]+$ ]]; then
|
||||||
# rhs has been pre-formatted for JSON or a non-string, do not change it
|
# rhs has been pre-formatted for JSON or a non-string, do not change it
|
||||||
:
|
:
|
||||||
elif [[ $rhs == False ]]; then
|
elif [[ $rhs == False ]]; then
|
||||||
|
|
Loading…
Reference in New Issue