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

"odo config unset" doesn't unset an environment variable but says it did #2139

Closed
dharmit opened this issue Sep 18, 2019 · 5 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).

Comments

@dharmit
Copy link
Member

dharmit commented Sep 18, 2019

[kind/bug]

What versions of software are you using?

  • Operating System: all
  • Output of odo version: master

How did you run odo exactly?

  1. Set an env var using odo config set --env.
  2. Unset it using odo config unset --env foo=bar.
  3. Unset it using odo config unset --env foo (don't mention the value of foo this time).
    Verify output of odo config view at the end of each step
$ odo config set --env foo=bar
Environment variables were successfully updated.
Run `odo push --config` command to apply changes to the cluster.

$ odo config view
ENVIRONMENT VARIABLES
------------------------------------------------
NAME    VALUE
foo     bar

COMPONENT SETTINGS
------------------------------------------------
PARAMETER         CURRENT_VALUE
Type              nodejs
Application       app
Project           myproject
SourceType        local
Ref               
SourceLocation    ./
Ports             8080/TCP
Name              nodejs-nodejs-ex-ulzb
MinMemory         
MaxMemory         
Ignore            
MinCPU            
MaxCPU           

$ odo config unset --env foo=bar
Environment variables were successfully updated.

$ odo config view
ENVIRONMENT VARIABLES
------------------------------------------------
NAME    VALUE
foo     bar        <------------------- This still shows!

COMPONENT SETTINGS
------------------------------------------------
PARAMETER         CURRENT_VALUE
Type              nodejs
Application       app
Project           myproject
SourceType        local
Ref               
SourceLocation    ./
Ports             8080/TCP
Name              nodejs-nodejs-ex-ulzb
MinMemory         
MaxMemory         
Ignore            
MinCPU            
MaxCPU            

$ odo config unset --env foo
Environment variables were successfully updated.

$ odo config view
COMPONENT SETTINGS
------------------------------------------------
PARAMETER         CURRENT_VALUE
Type              nodejs
Application       app
Project           myproject
SourceType        local
Ref               
SourceLocation    ./
Ports             8080/TCP
Name              nodejs-nodejs-ex-ulzb
MinMemory         
MaxMemory         
Ignore            
MinCPU            
MaxCPU            

Actual behavior

odo says that it has successfully unset the env var but it actually hasn't.

Expected behavior

Either odo config unset should complain that it can't handle the input given by user or unset the value as user would expect

@kadel
Copy link
Member

kadel commented Sep 18, 2019

/kind bug
/priority high

@openshift-ci-robot openshift-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). labels Sep 18, 2019
@amitkrout
Copy link
Contributor

@dharmit Is it a correct approach to unset env var, i mean passing the key value pair to unset the env var. Practically i would pass the key instead of passing the whole key value pair. But yes in some point i would say its a corner usecase.

@dharmit
Copy link
Member Author

dharmit commented Sep 18, 2019

@amitkrout yes, I would not pass the key-value pair when doing unset. And it could be a corner use-case depending on how frequently/infrequently one uses env vars in their components. Assuming it's a corner case, odo should, IMHO, at least not say that it managed to unset the env var.

In my particular case, I ended up discarding and redoing demo recordings because env var was already there in the component's pod. 😂

@kadel kadel added this to the 1.0 milestone Sep 23, 2019
cdrage added a commit to cdrage/odo that referenced this issue Oct 10, 2019
This PR:
- Adds ability to use `foo=bar` when unsetting an environment variable
- Tests have been added

To test:
```sh
git clone https://github.com/openshift/nodejs-ex && cd ~/nodejs-ex
odo create
odo push
odo config set --env foo=bar
odo push  # optional
odo config view
odo config unset --env foo=bar
odo push  # optional
odo config view
```

Closes redhat-developer#2139
cdrage added a commit to cdrage/odo that referenced this issue Oct 10, 2019
This PR:
- Adds ability to use `foo=bar` when unsetting an environment variable
- Tests have been added

To test:
```sh
git clone https://github.com/openshift/nodejs-ex && cd ~/nodejs-ex
odo create
odo push
odo config set --env foo=bar
odo push  # optional
odo config view
odo config unset --env foo=bar
odo push  # optional
odo config view
```

Closes redhat-developer#2139
@girishramnani girishramnani removed this from the 1.0 milestone Oct 14, 2019
cdrage added a commit to cdrage/odo that referenced this issue Oct 16, 2019
This PR errors out when there is a missing environment variable or an
invalid environment variable has been passed.

To test:

```sh
odo config set --env foo=bar
odo config unset --env testvariable # will error
odo config unset --env foo=bar # will error
odo config unset --env foo # will pass
```

Closes redhat-developer#2139
cdrage added a commit to cdrage/odo that referenced this issue Oct 17, 2019
This PR errors out when there is a missing environment variable or an
invalid environment variable has been passed.

To test:

```sh
odo config set --env foo=bar
odo config unset --env testvariable # will error
odo config unset --env foo=bar # will error
odo config unset --env foo # will pass
```

Closes redhat-developer#2139
cdrage added a commit to cdrage/odo that referenced this issue Oct 17, 2019
This PR errors out when there is a missing environment variable or an
invalid environment variable has been passed.

To test:

```sh
odo config set --env foo=bar
odo config unset --env testvariable # will error
odo config unset --env foo=bar # will error
odo config unset --env foo # will pass
```

Closes redhat-developer#2139
@cdrage cdrage assigned dharmit and unassigned cdrage Oct 25, 2019
@cdrage
Copy link
Member

cdrage commented Oct 25, 2019

Assigning this to you @dharmit since you already have a PR open and we combined our separate PR's :)

@girishramnani
Copy link
Contributor

#2274 is already merged and this is a duplicate to that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
None yet
6 participants