Unverified Commit 0447efea authored by Mark Vander Stel's avatar Mark Vander Stel
Browse files

Fix error message from kubectl if no context

If no current context was set and the KUBE_NAMESPACE feature was
enabled, kubectl would print an error message, which would leak through
to the terminal.

Fixes #695
parent cfad0e3f
......@@ -1246,7 +1246,8 @@ _lp_kubernetes_context() {
if (( LP_ENABLE_KUBE_NAMESPACE )); then
local line kubernetes_namespace
line=$(kubectl config view --minify --output 'jsonpath={.current-context}{"/"}{..namespace}')
line=$(kubectl config view --minify --output \
'jsonpath={.current-context}{"/"}{..namespace}' 2>/dev/null) || return 1
kubernetes_context=${line%/*}
kubernetes_namespace=${line##*/}
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment