Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID #17315

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libpod/container_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (c *Container) ExecCreate(config *ExecConfig) (string, error) {
}

// Generate an ID for our new exec session
sessionID := stringid.GenerateNonCryptoID()
sessionID := stringid.GenerateRandomID()
found := true
// This really ought to be a do-while, but Go doesn't have those...
for found {
Expand All @@ -194,7 +194,7 @@ func (c *Container) ExecCreate(config *ExecConfig) (string, error) {
}
}
if found {
sessionID = stringid.GenerateNonCryptoID()
sessionID = stringid.GenerateRandomID()
}
}

Expand Down
2 changes: 1 addition & 1 deletion libpod/pod_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func newPod(runtime *Runtime) *Pod {
pod := new(Pod)
pod.config = new(PodConfig)
pod.config.ID = stringid.GenerateNonCryptoID()
pod.config.ID = stringid.GenerateRandomID()
pod.config.Labels = make(map[string]string)
pod.config.CreatedTime = time.Now()
// pod.config.InfraContainer = new(ContainerConfig)
Expand Down
6 changes: 3 additions & 3 deletions libpod/runtime_ctr.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf
ctr.state = new(ContainerState)

if config == nil {
ctr.config.ID = stringid.GenerateNonCryptoID()
ctr.config.ID = stringid.GenerateRandomID()
size, err := units.FromHumanSize(r.config.Containers.ShmSize)
if err != nil {
return nil, fmt.Errorf("converting containers.conf ShmSize %s to an int: %w", r.config.Containers.ShmSize, err)
Expand All @@ -188,7 +188,7 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf
}
// If the ID is empty a new name for the restored container was requested
if ctr.config.ID == "" {
ctr.config.ID = stringid.GenerateNonCryptoID()
ctr.config.ID = stringid.GenerateRandomID()
}
// Reset the log path to point to the default
ctr.config.LogPath = ""
Expand Down Expand Up @@ -461,7 +461,7 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
if vol.Name == "" {
// Anonymous volume. We'll need to create it.
// It needs a name first.
vol.Name = stringid.GenerateNonCryptoID()
vol.Name = stringid.GenerateRandomID()
isAnonymous = true
} else {
// Check if it exists already
Expand Down
2 changes: 1 addition & 1 deletion libpod/runtime_volume_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (r *Runtime) newVolume(noCreatePluginVolume bool, options ...VolumeCreateOp
}

if volume.config.Name == "" {
volume.config.Name = stringid.GenerateNonCryptoID()
volume.config.Name = stringid.GenerateRandomID()
}
if volume.config.Driver == "" {
volume.config.Driver = define.VolumeDriverLocal
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
// happens. So, use a podman-%s.sock-lock empty file as a marker.
tries := 0
for {
uuid := stringid.GenerateNonCryptoID()
uuid := stringid.GenerateRandomID()
lockPath := fmt.Sprintf("%s-%s.sock-lock", pathPrefix, uuid)
lockFile, err := os.OpenFile(lockPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0700)
if err == nil {
Expand Down Expand Up @@ -894,7 +894,7 @@ func generateNetworkConfig(p *PodmanTestIntegration) (string, string) {
conf string
)
// generate a random name to prevent conflicts with other tests
name := "net" + stringid.GenerateNonCryptoID()
name := "net" + stringid.GenerateRandomID()
if p.NetworkBackend != Netavark {
path = filepath.Join(p.NetworkConfigDir, fmt.Sprintf("%s.conflist", name))
conf = fmt.Sprintf(`{
Expand Down Expand Up @@ -1030,7 +1030,7 @@ func ncz(port int) bool {
}

func createNetworkName(name string) string {
return name + stringid.GenerateNonCryptoID()[:10]
return name + stringid.GenerateRandomID()[:10]
}

var IPRegex = `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}`
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/create_staticmac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("Podman run with --mac-address flag", func() {
})

It("Podman run --mac-address with custom network", func() {
net := "n1" + stringid.GenerateNonCryptoID()
net := "n1" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ var _ = Describe("Podman create", func() {
pod.WaitWithDefaultTimeout()
Expect(pod).Should(Exit(0))

netName := "pod" + stringid.GenerateNonCryptoID()
netName := "pod" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ var _ = Describe("Podman diff", func() {
})

It("podman image diff", func() {
file1 := "/" + stringid.GenerateNonCryptoID()
file2 := "/" + stringid.GenerateNonCryptoID()
file3 := "/" + stringid.GenerateNonCryptoID()
file1 := "/" + stringid.GenerateRandomID()
file2 := "/" + stringid.GenerateRandomID()
file3 := "/" + stringid.GenerateRandomID()

// Create container image with the files
containerfile := fmt.Sprintf(`
Expand Down Expand Up @@ -152,8 +152,8 @@ RUN echo test
})

It("podman diff container and image with same name", func() {
imagefile := "/" + stringid.GenerateNonCryptoID()
confile := "/" + stringid.GenerateNonCryptoID()
imagefile := "/" + stringid.GenerateRandomID()
confile := "/" + stringid.GenerateRandomID()

// Create container image with the files
containerfile := fmt.Sprintf(`
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ var _ = Describe("Podman events", func() {
})

It("podman events --until future", func() {
name1 := stringid.GenerateNonCryptoID()
name2 := stringid.GenerateNonCryptoID()
name3 := stringid.GenerateNonCryptoID()
name1 := stringid.GenerateRandomID()
name2 := stringid.GenerateRandomID()
name3 := stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"create", "--name", name1, ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ var _ = Describe("Podman logs", func() {
skipIfJournaldInContainer()

cname := "log-test"
content := stringid.GenerateNonCryptoID()
content := stringid.GenerateRandomID()
// use printf to print no extra newline
logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", cname, ALPINE, "printf", content})
logc.WaitWithDefaultTimeout()
Expand Down
34 changes: 18 additions & 16 deletions test/e2e/network_connect_disconnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("bad container name in network disconnect should result in error", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -53,7 +53,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("network disconnect with net mode slirp4netns should result in error", func() {
netName := "slirp" + stringid.GenerateNonCryptoID()
netName := "slirp" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -71,7 +71,8 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network disconnect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
SkipIfRootlessCgroupsV1("stats not supported under rootless CgroupsV1")
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down Expand Up @@ -127,7 +128,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("bad container name in network connect should result in error", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -139,7 +140,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("network connect with net mode slirp4netns should result in error", func() {
netName := "slirp" + stringid.GenerateNonCryptoID()
netName := "slirp" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -156,8 +157,8 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(con.ErrorToString()).To(ContainSubstring(`"slirp4netns" is not supported: invalid network mode`))
})

It("podman connect on a container that already is connected to the network should error", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
It("podman connect on a container that already is connected to the network should error after init", func() {
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -180,7 +181,8 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network connect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
SkipIfRootlessCgroupsV1("stats not supported under rootless CgroupsV1")
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -196,7 +198,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(exec).Should(Exit(0))

// Create a second network
newNetName := "aliasTest" + stringid.GenerateNonCryptoID()
newNetName := "aliasTest" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", newNetName, "--subnet", "10.11.100.0/24"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down Expand Up @@ -254,13 +256,13 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network connect when not running", func() {
netName1 := "connect1" + stringid.GenerateNonCryptoID()
netName1 := "connect1" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
defer podmanTest.removeNetwork(netName1)

netName2 := "connect2" + stringid.GenerateNonCryptoID()
netName2 := "connect2" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", netName2})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down Expand Up @@ -293,7 +295,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network connect and run with network ID", func() {
netName := "ID" + stringid.GenerateNonCryptoID()
netName := "ID" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -313,7 +315,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(exec).Should(Exit(0))

// Create a second network
newNetName := "ID2" + stringid.GenerateNonCryptoID()
newNetName := "ID2" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", newNetName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -340,13 +342,13 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network disconnect when not running", func() {
netName1 := "aliasTest" + stringid.GenerateNonCryptoID()
netName1 := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
defer podmanTest.removeNetwork(netName1)

netName2 := "aliasTest" + stringid.GenerateNonCryptoID()
netName2 := "aliasTest" + stringid.GenerateRandomID()
session2 := podmanTest.Podman([]string{"network", "create", netName2})
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
Expand Down Expand Up @@ -385,7 +387,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
})

It("podman network disconnect and run with network ID", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down
Loading