Skip to content

Commit

Permalink
Merge pull request #5332 from giuseppe/uts-lookup-container
Browse files Browse the repository at this point in the history
spec: allow container alias name in lookup
  • Loading branch information
openshift-merge-robot authored Feb 26, 2020
2 parents 75d0d48 + 418dee1 commit 19016f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/spec/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func (c *UtsConfig) ConfigureGenerator(g *generate.Generator, net *NetworkConfig
if hostname == "" {
switch {
case utsCtrID != "":
utsCtr, err := runtime.GetContainer(utsCtrID)
utsCtr, err := runtime.LookupContainer(utsCtrID)
if err != nil {
return errors.Wrapf(err, "unable to retrieve hostname from dependency container %s", utsCtrID)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/specgen/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (s *SpecGenerator) utsConfigureGenerator(g *generate.Generator, runtime *li
if hostname == "" {
switch {
case s.UtsNS.IsContainer():
utsCtr, err := runtime.GetContainer(s.UtsNS.Value)
utsCtr, err := runtime.LookupContainer(s.UtsNS.Value)
if err != nil {
return errors.Wrapf(err, "unable to retrieve hostname from dependency container %s", s.UtsNS.Value)
}
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/run_networking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ var _ = Describe("Podman run networking", func() {
Expect(match).Should(BeTrue())
})

It("podman run --net container: and --uts container:", func() {
ctrName := "ctrToJoin"
ctr1 := podmanTest.RunTopContainer(ctrName)
ctr1.WaitWithDefaultTimeout()
Expect(ctr1.ExitCode()).To(Equal(0))

ctr2 := podmanTest.Podman([]string{"run", "-d", "--net=container:" + ctrName, "--uts=container:" + ctrName, ALPINE, "true"})
ctr2.WaitWithDefaultTimeout()
Expect(ctr2.ExitCode()).To(Equal(0))
})

It("podman run --net container: copies hosts and resolv", func() {
SkipIfRootless()
ctrName := "ctr1"
Expand Down

0 comments on commit 19016f3

Please sign in to comment.