Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes segment spams "error: current-context is not set" if kubectl available but not configured yet #65

Open
darkvertex opened this issue Aug 31, 2021 · 1 comment

Comments

@darkvertex
Copy link
Contributor

When the command exists but kubernetes has no context currently configured, kubectl config current-context prints error: current-context is not set into the stderr.

It's annoying and can be bypassed by disabling the Kubernetes segment temporarily HOWEVER I think it may be worth fixing here:
https://github.com/chris-marsh/pureline/blob/main/segments/kubernetes_segment#L12
and changing it for:

        local context=$(kubectl config current-context 2>/dev/null)

to silence the stderr (because you have the exit code and stdout will be empty when not set, so it's superfluous.)

@chris-marsh
Copy link
Owner

Thanks for the report and fix. I'll include it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants