mirror of https://github.com/containers/podman.git
				
				
				
			Support annotations from containers.conf
Currently podman does not use the annotations specified in the containers.conf. This PR fixes this. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
		
							parent
							
								
									763d522983
								
							
						
					
					
						commit
						cc846a8cd9
					
				|  | @ -3,6 +3,7 @@ package generate | |||
| import ( | ||||
| 	"context" | ||||
| 	"os" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	"github.com/containers/image/v5/manifest" | ||||
| 	"github.com/containers/podman/v2/libpod" | ||||
|  | @ -197,6 +198,15 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat | |||
| 		annotations[ann.ContainerType] = ann.ContainerTypeContainer | ||||
| 	} | ||||
| 
 | ||||
| 	for _, v := range rtc.Containers.Annotations { | ||||
| 		split := strings.SplitN(v, "=", 2) | ||||
| 		k := split[0] | ||||
| 		v := "" | ||||
| 		if len(split) == 2 { | ||||
| 			v = split[1] | ||||
| 		} | ||||
| 		annotations[k] = v | ||||
| 	} | ||||
| 	// now pass in the values from client
 | ||||
| 	for k, v := range s.Annotations { | ||||
| 		annotations[k] = v | ||||
|  |  | |||
|  | @ -53,6 +53,8 @@ tz = "Pacific/Honolulu" | |||
| 
 | ||||
| umask = "0002" | ||||
| 
 | ||||
| annotations=["run.oci.keep_original_groups=1",] | ||||
| 
 | ||||
| [engine] | ||||
| 
 | ||||
| network_cmd_options=["allow_host_loopback=true"] | ||||
|  |  | |||
|  | @ -320,4 +320,15 @@ var _ = Describe("Podman run", func() { | |||
| 		Expect(session.OutputToString()).To(Equal("0022")) | ||||
| 	}) | ||||
| 
 | ||||
| 	It("podman run containers.conf annotations test", func() { | ||||
| 		//containers.conf is set to   "run.oci.keep_original_groups=1"
 | ||||
| 		session := podmanTest.Podman([]string{"create", "--rm", "--name", "test", fedoraMinimal}) | ||||
| 		session.WaitWithDefaultTimeout() | ||||
| 		Expect(session.ExitCode()).To(Equal(0)) | ||||
| 
 | ||||
| 		inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .Config.Annotations }}", "test"}) | ||||
| 		inspect.WaitWithDefaultTimeout() | ||||
| 		Expect(inspect.OutputToString()).To(ContainSubstring("run.oci.keep_original_groups:1")) | ||||
| 	}) | ||||
| 
 | ||||
| }) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue