diff --git a/pkg/crc/machine/bundle/metadata.go b/pkg/crc/machine/bundle/metadata.go index dd9f39f02c..1a44b59764 100644 --- a/pkg/crc/machine/bundle/metadata.go +++ b/pkg/crc/machine/bundle/metadata.go @@ -172,6 +172,15 @@ func (bundle *CrcBundleInfo) GetPodmanVersion() string { return bundle.Nodes[0].PodmanVersion } +func (bundle *CrcBundleInfo) GetVersion() string { + switch bundle.GetBundleType() { + case crcPreset.Podman: + return bundle.GetPodmanVersion() + default: + return bundle.GetOpenshiftVersion() + } +} + func (bundle *CrcBundleInfo) GetBundleNameWithoutExtension() string { return GetBundleNameWithoutExtension(bundle.GetBundleName()) } diff --git a/pkg/crc/machine/start.go b/pkg/crc/machine/start.go index f3d4164243..0a96533cdf 100644 --- a/pkg/crc/machine/start.go +++ b/pkg/crc/machine/start.go @@ -242,11 +242,7 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig) return nil, errors.Wrap(err, "Failed to ask for pull secret") } - if crcBundleMetadata.IsOpenShift() { - logging.Infof("Creating CRC VM for %s %s...", startConfig.Preset, crcBundleMetadata.GetOpenshiftVersion()) - } else { - logging.Infof("Creating CRC VM for Podman %s...", crcBundleMetadata.GetPodmanVersion()) - } + logging.Infof("Creating CRC VM for %s %s...", startConfig.Preset.ForDisplay(), crcBundleMetadata.GetVersion()) sharedDirs := []string{} if homeDir, err := os.UserHomeDir(); err == nil { diff --git a/pkg/crc/preset/preset.go b/pkg/crc/preset/preset.go index 0176ccf60a..77fd26fed3 100644 --- a/pkg/crc/preset/preset.go +++ b/pkg/crc/preset/preset.go @@ -29,6 +29,20 @@ func (preset Preset) String() string { return "invalid" } +func (preset Preset) ForDisplay() string { + switch preset { + case Podman: + return "Podman" + case OpenShift: + return "OpenShift" + case OKD: + return "OKD" + case Microshift: + return "MicroShift" + } + return "unknown" +} + func ParsePresetE(input string) (Preset, error) { switch input { case Podman.String():