aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--cmd/podman/system/service_abi.go2
-rw-r--r--pkg/domain/infra/abi/pods.go2
-rw-r--r--pkg/specgen/generate/kube/volume.go6
-rw-r--r--test/e2e/play_kube_test.go30
-rw-r--r--test/system/251-system-service.bats8
6 files changed, 43 insertions, 7 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d0f4ceb02..48650f43e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -42,7 +42,7 @@ the “In Progress” label be set and a member will do so for you.
## Contributing to Podman
-This section describes how to start a contribution to Podman.
+This section describes how to start a contribution to Podman. These instructions are geared towards using a Linux development machine, or doing development on the podman backend. For instructions on working on MacOS, read the [docs for building on osx](./build_osx.md).
### Prepare your environment
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 68ac8902b..82419ff1a 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -89,7 +89,7 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
return fmt.Errorf("unable to create socket %v: %w", host, err)
}
default:
- logrus.Debugf("Attempting API Service endpoint scheme %q", uri.Scheme)
+ return fmt.Errorf("API Service endpoint scheme %q is not supported. Try tcp://%s or unix:/%s", uri.Scheme, opts.URI, opts.URI)
}
libpodRuntime.SetRemoteURI(uri.String())
}
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 45a47b46e..4b269d925 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -195,7 +195,7 @@ func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opt
}
for _, p := range pods {
report := entities.PodStopReport{Id: p.ID()}
- errs, err := p.StopWithTimeout(ctx, false, options.Timeout)
+ errs, err := p.StopWithTimeout(ctx, true, options.Timeout)
if err != nil && !errors.Is(err, define.ErrPodPartialFail) {
report.Errs = []error{err}
reports = append(reports, &report)
diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go
index 2d8085020..beb460d68 100644
--- a/pkg/specgen/generate/kube/volume.go
+++ b/pkg/specgen/generate/kube/volume.go
@@ -56,10 +56,8 @@ func VolumeFromHostPath(hostPath *v1.HostPathVolumeSource) (*KubeVolume, error)
if hostPath.Type != nil {
switch *hostPath.Type {
case v1.HostPathDirectoryOrCreate:
- if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) {
- if err := os.Mkdir(hostPath.Path, kubeDirectoryPermission); err != nil {
- return nil, err
- }
+ if err := os.MkdirAll(hostPath.Path, kubeDirectoryPermission); err != nil {
+ return nil, err
}
// Label a newly created volume
if err := libpod.LabelVolumePath(hostPath.Path); err != nil {
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 8b9e43f65..97823e232 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2604,6 +2604,36 @@ spec:
Expect(st.Mode().IsDir()).To(Equal(true))
})
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and non-existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // the full path should have been created
+ st, err := os.Stat(hostPathLocation)
+ Expect(err).To(BeNil())
+ Expect(st.Mode().IsDir()).To(Equal(true))
+ })
+
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+ Expect(os.MkdirAll(hostPathLocation, os.ModePerm)).To(BeNil())
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+ })
+
It("podman play kube test with Socket HostPath type volume should fail if not socket", func() {
hostPathLocation := filepath.Join(tempdir, "file")
f, err := os.Create(hostPathLocation)
diff --git a/test/system/251-system-service.bats b/test/system/251-system-service.bats
index 197d1cb18..3af42b455 100644
--- a/test/system/251-system-service.bats
+++ b/test/system/251-system-service.bats
@@ -14,6 +14,14 @@ function teardown() {
basic_teardown
}
+@test "podman systerm service <bad_scheme_uri> returns error" {
+ skip_if_remote "podman system service unavailable over remote"
+ run_podman 125 system service localhost:9292
+ is "$output" "Error: API Service endpoint scheme \"localhost\" is not supported. Try tcp://localhost:9292 or unix:/localhost:9292"
+
+ run_podman 125 system service myunix.sock
+ is "$output" "Error: API Service endpoint scheme \"\" is not supported. Try tcp://myunix.sock or unix:/myunix.sock"
+}
@test "podman-system-service containers survive service stop" {
skip_if_remote "podman system service unavailable over remote"