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

Commit 905005f

Browse files
authored
cli: Shows message for no meshes (#4738)
Shows message if no mesh exits in the cluster. Fixes #4697 Signed-off-by: mudit singh <[email protected]>
1 parent 8da8732 commit 905005f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/cli/version.go

+3
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func (r *remoteVersion) proxyGetMeshVersion(pod string, namespace string, client
170170
}
171171

172172
func (v *versionCmd) outputPrettyVersionInfo(remoteVerList []*remoteVersionInfo) string {
173+
if len(remoteVerList) == 0 {
174+
return "Unable to find OSM control plane in the cluster\n"
175+
}
173176
table := "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n"
174177
for _, remoteVersionInfo := range remoteVerList {
175178
if remoteVersionInfo != nil && remoteVersionInfo.meshName != "" {

cmd/cli/version_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ func TestOutputPrettyVersionInfo(t *testing.T) {
216216
},
217217
{
218218
name: "mesh versions with no remote version info",
219-
remoteVersionInfoList: nil,
220-
expected: "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n",
219+
remoteVersionInfoList: []*remoteVersionInfo{},
220+
expected: "Unable to find OSM control plane in the cluster\n",
221221
},
222222
}
223223

0 commit comments

Comments
 (0)