Skip to content

Commit

Permalink
Merge pull request #19957 from spowelljr/fixPanic
Browse files Browse the repository at this point in the history
Fix panic when no services in namespace with --all specified
  • Loading branch information
spowelljr authored Nov 12, 2024
2 parents 1496a6b + e679c4a commit 49eb584
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/minikube/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ var serviceCmd = &cobra.Command{
services = newServices
}

if len(services) == 0 {
if len(services) == 0 && all {
exit.Message(reason.SvcNotFound, `No services were found in the '{{.namespace}}' namespace.
You may select another namespace by using 'minikube service --all -n <namespace>'`, out.V{"namespace": namespace})
} else if len(services) == 0 {
exit.Message(reason.SvcNotFound, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
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})
}
Expand Down

0 comments on commit 49eb584

Please sign in to comment.