Skip to content

Commit

Permalink
microshift: Fix "Creating CRC VM for xxx" message
Browse files Browse the repository at this point in the history
At the moment it's not taking into account the MicroShift preset, and
it's not spelling correctly OpenShift, MicroShift, ...
This commit should address both problems.
  • Loading branch information
cfergeau authored and openshift-merge-robot committed Mar 29, 2023
1 parent f64c291 commit 73e2ccb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
9 changes: 9 additions & 0 deletions pkg/crc/machine/bundle/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
6 changes: 1 addition & 5 deletions pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 14 additions & 0 deletions pkg/crc/preset/preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 73e2ccb

Please sign in to comment.