Use pod netns with --pod-id-file
When `--pod-id-file` is used do not parse the default network namespace
and let specgen handle it instead.
This regression was introduced in commit 7ef3981abe.
Fixes #11303
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									2de56a5f41
								
							
						
					
					
						commit
						feff0d3c4b
					
				|  | @ -96,7 +96,7 @@ func create(cmd *cobra.Command, args []string) error { | ||||||
| 	var ( | 	var ( | ||||||
| 		err error | 		err error | ||||||
| 	) | 	) | ||||||
| 	cliVals.Net, err = common.NetFlagsToNetOptions(cmd, cliVals.Pod == "") | 	cliVals.Net, err = common.NetFlagsToNetOptions(cmd, cliVals.Pod == "" && cliVals.PodIDFile == "") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -106,7 +106,7 @@ func init() { | ||||||
| 
 | 
 | ||||||
| func run(cmd *cobra.Command, args []string) error { | func run(cmd *cobra.Command, args []string) error { | ||||||
| 	var err error | 	var err error | ||||||
| 	cliVals.Net, err = common.NetFlagsToNetOptions(cmd, cliVals.Pod == "") | 	cliVals.Net, err = common.NetFlagsToNetOptions(cmd, cliVals.Pod == "" && cliVals.PodIDFile == "") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -121,6 +121,21 @@ var _ = Describe("Podman pod create", func() { | ||||||
| 		Expect(check).Should(Exit(0)) | 		Expect(check).Should(Exit(0)) | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
|  | 	It("podman create pod with id file with network portbindings", func() { | ||||||
|  | 		file := filepath.Join(podmanTest.TempDir, "pod.id") | ||||||
|  | 		name := "test" | ||||||
|  | 		session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--pod-id-file", file, "-p", "8080:80"}) | ||||||
|  | 		session.WaitWithDefaultTimeout() | ||||||
|  | 		Expect(session).Should(Exit(0)) | ||||||
|  | 
 | ||||||
|  | 		webserver := podmanTest.Podman([]string{"run", "--pod-id-file", file, "-dt", nginx}) | ||||||
|  | 		webserver.WaitWithDefaultTimeout() | ||||||
|  | 		Expect(webserver).Should(Exit(0)) | ||||||
|  | 
 | ||||||
|  | 		check := SystemExec("nc", []string{"-z", "localhost", "8080"}) | ||||||
|  | 		Expect(check).Should(Exit(0)) | ||||||
|  | 	}) | ||||||
|  | 
 | ||||||
| 	It("podman create pod with no infra but portbindings should fail", func() { | 	It("podman create pod with no infra but portbindings should fail", func() { | ||||||
| 		name := "test" | 		name := "test" | ||||||
| 		session := podmanTest.Podman([]string{"pod", "create", "--infra=false", "--name", name, "-p", "80:80"}) | 		session := podmanTest.Podman([]string{"pod", "create", "--infra=false", "--name", name, "-p", "80:80"}) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue