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

om bosh-env should be able to un-set vars #457

Closed
kcboyle opened this issue Jan 14, 2020 · 5 comments · Fixed by #520
Closed

om bosh-env should be able to un-set vars #457

kcboyle opened this issue Jan 14, 2020 · 5 comments · Fixed by #520

Comments

@kcboyle
Copy link
Contributor

kcboyle commented Jan 14, 2020

Reference: #385 for more context

In order to make om a better command line tool, it would be nice to be able to easily un-set all vars set by om bosh-env. This makes it easier for users to know that their environment is clean (the biggest use case for this is the headache associated with using a traditional bosh-login when env vars are (silently) set).

Proposed addition to the om bosh-env command:

om bosh-env --unset

Please discuss if this seems unreasonable. Thank you for the proposal @aegershman!

@cf-gitbot
Copy link
Member

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

@iplay88keys
Copy link

This isn't possible directly as written since om bosh-env just outputs a list of export commands as it cannot affect the environment of its parent shell.

$ om bosh-env
export BOSH_ENVIRONMENT: example.com
export BOSH_CLIENT: some-client
export BOSH_CLIENT_SECRET: some-client-secret
⋮

As a result, it must be called as: eval "$(om bosh-env)" in order for the environment variables to be persisted after the command has completed.

However, if the unset flag outputted the following:

$ om bosh-env --unset
unset BOSH_ENVIRONMENT
unset BOSH_CLIENT
unset BOSH_CLIENT_SECRET
⋮

We would be able to remove the environment variables by calling: eval "$(om bosh-env --unset)"

@xyloman
Copy link

xyloman commented Jan 30, 2020

I am a fan of this approach. This might have been stated before but a flag for just Bosh or just credhub env vars would be an added plus.

@iplay88keys
Copy link

@kcboyle Any issue with my picking this up and submitting a PR?

@kcboyle
Copy link
Contributor Author

kcboyle commented Oct 20, 2020

None at all! We'd appreciate a PR @iplay88keys

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

Successfully merging a pull request may close this issue.

4 participants