Skip to content

Commit 49eb584

Browse files
authored
Merge pull request #19957 from spowelljr/fixPanic
Fix panic when no services in namespace with --all specified
2 parents 1496a6b + e679c4a commit 49eb584

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/minikube/cmd/service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ var serviceCmd = &cobra.Command{
112112
services = newServices
113113
}
114114

115-
if len(services) == 0 {
115+
if len(services) == 0 && all {
116+
exit.Message(reason.SvcNotFound, `No services were found in the '{{.namespace}}' namespace.
117+
You may select another namespace by using 'minikube service --all -n <namespace>'`, out.V{"namespace": namespace})
118+
} else if len(services) == 0 {
116119
exit.Message(reason.SvcNotFound, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
117120
You may select another namespace by using 'minikube service {{.service}} -n <namespace>'. Or list out all the services using 'minikube service list'`, out.V{"service": args[0], "namespace": namespace})
118121
}

0 commit comments

Comments
 (0)