mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Merge pull request #8379 from rhatdan/remote2
Remove build \!remote flags from test phase 2
This commit is contained in:
@ -289,25 +289,44 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
|
func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
config, err := runtime.GetConfig()
|
ic := abi.ContainerEngine{Libpod: runtime}
|
||||||
if err != nil {
|
|
||||||
utils.InternalServerError(w, err)
|
query := struct {
|
||||||
|
Force bool `schema:"force"`
|
||||||
|
}{
|
||||||
|
// This is where you can override the golang default value for one of fields
|
||||||
|
}
|
||||||
|
|
||||||
|
decoder := r.Context().Value("decoder").(*schema.Decoder)
|
||||||
|
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||||
|
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options := entities.NetworkRmOptions{
|
||||||
|
Force: query.Force,
|
||||||
|
}
|
||||||
|
|
||||||
name := utils.GetName(r)
|
name := utils.GetName(r)
|
||||||
exists, err := network.Exists(config, name)
|
reports, err := ic.NetworkRm(r.Context(), []string{name}, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.InternalServerError(w, err)
|
utils.Error(w, "remove Network failed", http.StatusInternalServerError, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !exists {
|
if len(reports) == 0 {
|
||||||
|
utils.Error(w, "remove Network failed", http.StatusInternalServerError, errors.Errorf("internal error"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
report := reports[0]
|
||||||
|
if report.Err != nil {
|
||||||
|
if errors.Cause(report.Err) == define.ErrNoSuchNetwork {
|
||||||
utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
|
utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := network.RemoveNetwork(config, name); err != nil {
|
utils.InternalServerError(w, report.Err)
|
||||||
utils.InternalServerError(w, err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.WriteResponse(w, http.StatusNoContent, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o
|
|||||||
if err := ic.Libpod.RemovePod(ctx, pod, true, true); err != nil {
|
if err := ic.Libpod.RemovePod(ctx, pod, true, true); err != nil {
|
||||||
return reports, err
|
return reports, err
|
||||||
}
|
}
|
||||||
} else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil {
|
} else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
|
||||||
return reports, err
|
return reports, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !remote
|
|
||||||
|
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -18,6 +16,7 @@ var _ = Describe("Podman mount", func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
|
SkipIfRemote("Podman mount not supported for remote connections")
|
||||||
SkipIfRootless("Podman mount requires podman unshare first to work")
|
SkipIfRootless("Podman mount requires podman unshare first to work")
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
tempdir, err = CreateTempDirInTempDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !remote
|
|
||||||
|
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -39,6 +37,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to containers/storage", func() {
|
It("podman push to containers/storage", func() {
|
||||||
|
SkipIfRemote("Remote push does not support containers-storage transport")
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"})
|
session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
@ -49,6 +48,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to dir", func() {
|
It("podman push to dir", func() {
|
||||||
|
SkipIfRemote("Remote push does not support dir transport")
|
||||||
bbdir := filepath.Join(podmanTest.TempDir, "busybox")
|
bbdir := filepath.Join(podmanTest.TempDir, "busybox")
|
||||||
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
|
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
|
||||||
fmt.Sprintf("dir:%s", bbdir)})
|
fmt.Sprintf("dir:%s", bbdir)})
|
||||||
@ -57,6 +57,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to local registry", func() {
|
It("podman push to local registry", func() {
|
||||||
|
SkipIfRemote("FIXME: This should work")
|
||||||
if podmanTest.Host.Arch == "ppc64le" {
|
if podmanTest.Host.Arch == "ppc64le" {
|
||||||
Skip("No registry image for ppc64le")
|
Skip("No registry image for ppc64le")
|
||||||
}
|
}
|
||||||
@ -87,6 +88,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to local registry with authorization", func() {
|
It("podman push to local registry with authorization", func() {
|
||||||
|
SkipIfRemote("FIXME: This does not seem to be returning an error")
|
||||||
SkipIfRootless("FIXME: Creating content in certs.d we use directories in homedir")
|
SkipIfRootless("FIXME: Creating content in certs.d we use directories in homedir")
|
||||||
if podmanTest.Host.Arch == "ppc64le" {
|
if podmanTest.Host.Arch == "ppc64le" {
|
||||||
Skip("No registry image for ppc64le")
|
Skip("No registry image for ppc64le")
|
||||||
@ -163,6 +165,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker-archive", func() {
|
It("podman push to docker-archive", func() {
|
||||||
|
SkipIfRemote("Remote push does not support docker-archive transport")
|
||||||
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE,
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
|
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
|
||||||
@ -171,6 +174,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker daemon", func() {
|
It("podman push to docker daemon", func() {
|
||||||
|
SkipIfRemote("Remote push does not support docker-daemon transport")
|
||||||
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
|
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
|
||||||
|
|
||||||
if setup.LineInOutputContains("Active: inactive") {
|
if setup.LineInOutputContains("Active: inactive") {
|
||||||
@ -196,6 +200,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to oci-archive", func() {
|
It("podman push to oci-archive", func() {
|
||||||
|
SkipIfRemote("Remote push does not support oci-archive transport")
|
||||||
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE,
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
|
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
|
||||||
@ -204,6 +209,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker-archive no reference", func() {
|
It("podman push to docker-archive no reference", func() {
|
||||||
|
SkipIfRemote("Remote push does not support docker-archive transport")
|
||||||
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE,
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
fmt.Sprintf("docker-archive:%s", tarfn)})
|
fmt.Sprintf("docker-archive:%s", tarfn)})
|
||||||
@ -212,6 +218,7 @@ var _ = Describe("Podman push", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to oci-archive no reference", func() {
|
It("podman push to oci-archive no reference", func() {
|
||||||
|
SkipIfRemote("Remote push does not support oci-archive transport")
|
||||||
ociarc := filepath.Join(podmanTest.TempDir, "alp-oci")
|
ociarc := filepath.Join(podmanTest.TempDir, "alp-oci")
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE,
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
fmt.Sprintf("oci-archive:%s", ociarc)})
|
fmt.Sprintf("oci-archive:%s", ociarc)})
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !remote
|
|
||||||
|
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !remote
|
|
||||||
|
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -46,6 +44,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Specify("signals are forwarded to container using sig-proxy", func() {
|
Specify("signals are forwarded to container using sig-proxy", func() {
|
||||||
|
SkipIfRemote("FIXME: This looks like it is supposed to work in remote")
|
||||||
if podmanTest.Host.Arch == "ppc64le" {
|
if podmanTest.Host.Arch == "ppc64le" {
|
||||||
Skip("Doesn't work on ppc64le")
|
Skip("Doesn't work on ppc64le")
|
||||||
}
|
}
|
||||||
@ -111,6 +110,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Specify("signals are not forwarded to container with sig-proxy false", func() {
|
Specify("signals are not forwarded to container with sig-proxy false", func() {
|
||||||
|
SkipIfRemote("FIXME: This looks like it is supposed to work in remote")
|
||||||
signal := syscall.SIGFPE
|
signal := syscall.SIGFPE
|
||||||
if rootless.IsRootless() {
|
if rootless.IsRootless() {
|
||||||
podmanTest.RestoreArtifact(fedoraMinimal)
|
podmanTest.RestoreArtifact(fedoraMinimal)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !remote
|
|
||||||
|
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -21,6 +19,7 @@ var _ = Describe("Podman trust", func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
|
SkipIfRemote("podman-remote does not support image trust")
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
tempdir, err = CreateTempDirInTempDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Reference in New Issue
Block a user