diff --git a/src/cmd/create.go b/src/cmd/create.go index 87c7217..42cd0de 100644 --- a/src/cmd/create.go +++ b/src/cmd/create.go @@ -178,7 +178,7 @@ func createContainer(container, image, release string, showCommandToEnter bool) panic("release not specified") } - enterCommand := getEnterCommand(container, release) + enterCommand := getEnterCommand(container) logrus.Debugf("Checking if container %s already exists", container) @@ -503,15 +503,12 @@ func getDBusSystemSocket() (string, error) { return pathEvaled, nil } -func getEnterCommand(container, release string) string { +func getEnterCommand(container string) string { var enterCommand string - containerNamePrefixDefaultWithRelease := utils.ContainerNamePrefixDefault + "-" + release switch container { case utils.ContainerNameDefault: enterCommand = fmt.Sprintf("%s enter", executableBase) - case containerNamePrefixDefaultWithRelease: - enterCommand = fmt.Sprintf("%s enter --release %s", executableBase, release) default: enterCommand = fmt.Sprintf("%s enter %s", executableBase, container) } diff --git a/src/pkg/utils/utils.go b/src/pkg/utils/utils.go index fb3d628..6baf06a 100644 --- a/src/pkg/utils/utils.go +++ b/src/pkg/utils/utils.go @@ -61,6 +61,8 @@ const ( ) var ( + containerNamePrefixDefault = "fedora-toolbox" + distroDefault = "fedora" preservedEnvironmentVariables = []string{ @@ -112,8 +114,7 @@ var ( ) var ( - ContainerNameDefault string - ContainerNamePrefixDefault = "fedora-toolbox" + ContainerNameDefault string ) func init() { @@ -124,14 +125,14 @@ func init() { if distroObj, supportedDistro := supportedDistros[hostID]; supportedDistro { release, err := GetHostVersionID() if err == nil { - ContainerNamePrefixDefault = distroObj.ContainerNamePrefix + containerNamePrefixDefault = distroObj.ContainerNamePrefix distroDefault = hostID releaseDefault = release } } } - ContainerNameDefault = ContainerNamePrefixDefault + "-" + releaseDefault + ContainerNameDefault = containerNamePrefixDefault + "-" + releaseDefault } func AskForConfirmation(prompt string) bool { diff --git a/test/system/101-create.bats b/test/system/101-create.bats index dfb4d89..3cc3eaf 100644 --- a/test/system/101-create.bats +++ b/test/system/101-create.bats @@ -62,7 +62,7 @@ teardown() { assert_success assert_output --partial "Created container: fedora-toolbox-32" - assert_output --partial "Enter with: toolbox enter --release 32" + assert_output --partial "Enter with: toolbox enter fedora-toolbox-32" # Make sure the container has actually been created run podman ps -a