Skip to content

Commit

Permalink
Merge pull request #15788 from kolyshkin/non-crypto-id
Browse files Browse the repository at this point in the history
all: stop using deprecated GenerateNonCryptoID
  • Loading branch information
openshift-merge-robot authored Sep 14, 2022
2 parents a3876c2 + 75740be commit 017d81d
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 101 deletions.
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 useDevShm {
if err != nil {
Expand All @@ -193,7 +193,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 @@ -466,7 +466,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 @@ -595,7 +595,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 @@ -154,9 +154,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
30 changes: 15 additions & 15 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 @@ -72,7 +72,7 @@ var _ = Describe("Podman network connect and disconnect", func() {

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

It("podman connect on a container that already is connected to the network should error after init", 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 Expand Up @@ -190,7 +190,7 @@ var _ = Describe("Podman network connect and disconnect", func() {

It("podman network connect", func() {
SkipIfRootlessCgroupsV1("stats not supported under rootless CgroupsV1")
netName := "aliasTest" + stringid.GenerateNonCryptoID()
netName := "aliasTest" + stringid.GenerateRandomID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand All @@ -206,7 +206,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 @@ -264,13 +264,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 @@ -303,7 +303,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 @@ -323,7 +323,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 @@ -350,13 +350,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 @@ -395,7 +395,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

0 comments on commit 017d81d

Please sign in to comment.