mirror of https://github.com/containers/podman.git
do not set the CreateCommand for API users
This should be set only by podman as it is used for the podman generate systemd --new command. For the api it was set to the system service command which is simply pointless. It must be empty in these cases. Fixes #25026 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
234c41c80e
commit
5522def65a
|
@ -161,6 +161,9 @@ func create(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
s.RawImageName = rawImageName
|
s.RawImageName = rawImageName
|
||||||
|
|
||||||
|
// Include the command used to create the container.
|
||||||
|
s.ContainerCreateCommand = os.Args
|
||||||
|
|
||||||
if err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
|
if err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,10 @@ func run(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.RawImageName = rawImageName
|
s.RawImageName = rawImageName
|
||||||
|
|
||||||
|
// Include the command used to create the container.
|
||||||
|
s.ContainerCreateCommand = os.Args
|
||||||
|
|
||||||
s.ImageOS = cliVals.OS
|
s.ImageOS = cliVals.OS
|
||||||
s.ImageArch = cliVals.Arch
|
s.ImageArch = cliVals.Arch
|
||||||
s.ImageVariant = cliVals.Variant
|
s.ImageVariant = cliVals.Variant
|
||||||
|
|
|
@ -73,7 +73,6 @@ func PodCreate(w http.ResponseWriter, r *http.Request) {
|
||||||
// a few extra that do not have the same json tags
|
// a few extra that do not have the same json tags
|
||||||
psg.InfraContainerSpec.Name = psg.InfraName
|
psg.InfraContainerSpec.Name = psg.InfraName
|
||||||
psg.InfraContainerSpec.ConmonPidFile = psg.InfraConmonPidFile
|
psg.InfraContainerSpec.ConmonPidFile = psg.InfraConmonPidFile
|
||||||
psg.InfraContainerSpec.ContainerCreateCommand = psg.InfraCommand
|
|
||||||
psg.InfraContainerSpec.Image = psg.InfraImage
|
psg.InfraContainerSpec.Image = psg.InfraImage
|
||||||
psg.InfraContainerSpec.RawImageName = psg.InfraImage
|
psg.InfraContainerSpec.RawImageName = psg.InfraImage
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,12 +550,6 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
|
||||||
s.Entrypoint = entrypoint
|
s.Entrypoint = entrypoint
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include the command used to create the container.
|
|
||||||
|
|
||||||
if len(s.ContainerCreateCommand) == 0 {
|
|
||||||
s.ContainerCreateCommand = os.Args
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(inputCommand) > 0 {
|
if len(inputCommand) > 0 {
|
||||||
s.Command = inputCommand
|
s.Command = inputCommand
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,12 +191,15 @@ cid=$(jq -r '.Id' <<<"$output")
|
||||||
t POST libpod/containers/${cid}/start 204
|
t POST libpod/containers/${cid}/start 204
|
||||||
# Container should exit almost immediately. Wait for it, confirm successful run
|
# Container should exit almost immediately. Wait for it, confirm successful run
|
||||||
t POST "libpod/containers/${cid}/wait?condition=stopped&condition=exited" 200 '0'
|
t POST "libpod/containers/${cid}/wait?condition=stopped&condition=exited" 200 '0'
|
||||||
|
|
||||||
|
# Regression check for #15036 (Umask) and #25026 (CreateCommand)
|
||||||
t GET libpod/containers/${cid}/json 200 \
|
t GET libpod/containers/${cid}/json 200 \
|
||||||
.Id=$cid \
|
.Id=$cid \
|
||||||
.State.Status~\\\(exited\\\|stopped\\\) \
|
.State.Status~\\\(exited\\\|stopped\\\) \
|
||||||
.State.Running=false \
|
.State.Running=false \
|
||||||
.State.ExitCode=0 \
|
.State.ExitCode=0 \
|
||||||
.Config.Umask=0022 # regression check for #15036
|
.Config.Umask=0022 \
|
||||||
|
.Config.CreateCommand=null
|
||||||
t DELETE libpod/containers/$cid 200 .[0].Id=$cid
|
t DELETE libpod/containers/$cid 200 .[0].Id=$cid
|
||||||
|
|
||||||
CNAME=myfoo
|
CNAME=myfoo
|
||||||
|
@ -309,6 +312,11 @@ t GET containers/$cid/json 200 \
|
||||||
.Path="echo" \
|
.Path="echo" \
|
||||||
.Args[0]="param1" \
|
.Args[0]="param1" \
|
||||||
.Args[1]="param2"
|
.Args[1]="param2"
|
||||||
|
# Regression check for #25026 (CreateCommand)
|
||||||
|
t GET libpod/containers/${cid}/json 200 \
|
||||||
|
.Id=$cid \
|
||||||
|
.Config.CreateCommand=null
|
||||||
|
|
||||||
t DELETE containers/$cid 204
|
t DELETE containers/$cid 204
|
||||||
|
|
||||||
# test only set the entrypoint, Cmd should be []
|
# test only set the entrypoint, Cmd should be []
|
||||||
|
|
Loading…
Reference in New Issue