Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

cli: Shows message for no meshes #4738

Merged
merged 8 commits into from
Jun 21, 2022
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
3 changes: 3 additions & 0 deletions cmd/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ func (r *remoteVersion) proxyGetMeshVersion(pod string, namespace string, client
}

func (v *versionCmd) outputPrettyVersionInfo(remoteVerList []*remoteVersionInfo) string {
if len(remoteVerList) == 0 {
return "Unable to find OSM control plane in the cluster\n"
}
table := "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n"
for _, remoteVersionInfo := range remoteVerList {
if remoteVersionInfo != nil && remoteVersionInfo.meshName != "" {
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ func TestOutputPrettyVersionInfo(t *testing.T) {
},
{
name: "mesh versions with no remote version info",
remoteVersionInfoList: nil,
expected: "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n",
remoteVersionInfoList: []*remoteVersionInfo{},
expected: "Unable to find OSM control plane in the cluster\n",
},
}

Expand Down