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

Output does not match current project on first use #171

Closed
gvnnn opened this issue Jun 20, 2024 · 0 comments · Fixed by #172
Closed

Output does not match current project on first use #171

gvnnn opened this issue Jun 20, 2024 · 0 comments · Fixed by #172

Comments

@gvnnn
Copy link
Contributor

gvnnn commented Jun 20, 2024

When you omc use a must-gather/inspect, the printed Project does not match the current context being used. In case no omc.json is present, an empty project is printed:

$ git switch main
Previous HEAD position was 7273c934 [FIX] close #162
Switched to branch 'main'
Your branch is up to date with 'upstream/main'.
$ go build -o omc main.go 

# let's start with a clean env
$ rm ~/.omc/omc.json 

$ tree cmd/use/testdata/useContext/must-gather-singleNS.sample/
cmd/use/testdata/useContext/must-gather-singleNS.sample/
└── namespaces
    └── openshift-etcd
        └── openshift-etcd.yaml

3 directories, 1 file

# project is not printed
$ ./omc use cmd/use/testdata/useContext/must-gather-singleNS.sample
Must-Gather  : /home/gistella/Projects/github.com/gmeghnag/omc/cmd/use/testdata/useContext/must-gather-singleNS.sample
Project      : 

# to show an old context is kept in memory, I will create a mock inspect
$ mkdir -p test-inspect/namespaces/ns-1
$ touch test-inspect/timestamp

# Notice how the previous namespace gets printed, even though the new path is correctly selected
$ ./omc use test-inspect
Must-Gather  : /home/gistella/Projects/github.com/gmeghnag/omc/test-inspect
Project      : openshift-etcd

This appears to be a side effect of ccaf241.

gvnnn pushed a commit to gvnnn/omc that referenced this issue Jun 20, 2024
Ensure the in-memory state of a must-gather/inspect's path and
project are consistent with the context being used, regardless of
wether the context is new.

Fixes gmeghnag#171
gvnnn added a commit to gvnnn/omc that referenced this issue Jun 20, 2024
Ensure the in-memory state of a must-gather/inspect's path and
project are consistent with the context being used, regardless of
wether the context is new.

Fixes gmeghnag#171
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

Successfully merging a pull request may close this issue.

1 participant