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 registry list causes panic if preference has not been setup #3842

Closed
mohammedzee1000 opened this issue Aug 26, 2020 · 8 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/Medium Nice to have issue. Getting it done before priority changes would be great.

Comments

@mohammedzee1000
Copy link
Contributor

/kind bug

What versions of software are you using?

Master

Operating System:
Fedora 31

Output of odo version:

❯ make bin && sudo cp -avrf ./odo /usr/bin/odo
go build -ldflags="-w -X github.com/openshift/odo/pkg/version.GITCOMMIT=68bc98ba8" cmd/odo/odo.go
'./odo' -> '/usr/bin/odo'
❯ odo version
odo v1.2.5 (68bc98ba8)

How did you run odo exactly?

❯ rm -rf ~/.odo && odo registry list

Actual behavior

❯ rm -rf ~/.odo && odo registry list
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x188db3d]

goroutine 1 [running]:
github.com/openshift/odo/pkg/odo/cli/registry.(*ListOptions).Run(0x316a9c8, 0x0, 0x0)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/pkg/odo/cli/registry/list.go:60 +0x5d
github.com/openshift/odo/pkg/odo/genericclioptions.GenericRun(0x2062c80, 0x316a9c8, 0xc000524280, 0x316a9c8, 0x0, 0x0)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/pkg/odo/genericclioptions/runnable.go:31 +0x13c
github.com/openshift/odo/pkg/odo/cli/registry.NewCmdList.func1(0xc000524280, 0x316a9c8, 0x0, 0x0)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/pkg/odo/cli/registry/list.go:101 +0x5e
github.com/openshift/odo/vendor/github.com/spf13/cobra.(*Command).execute(0xc000524280, 0x316a9c8, 0x0, 0x0, 0xc000524280, 0x316a9c8)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:830 +0x2aa
github.com/openshift/odo/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000189180, 0x1e47658, 0xc000043920, 0x2)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:914 +0x2fb
github.com/openshift/odo/vendor/github.com/spf13/cobra.(*Command).Execute(...)
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:864
main.main()
	/home/mzee1000/workbench/work/golang/redhat/src/github.com/openshift/odo/cmd/odo/odo.go:67 +0x330


Expected behavior

The preference should be initialized

Any logs, error output, etc?

see above

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 26, 2020
@mohammedzee1000
Copy link
Contributor Author

/priority medium

@openshift-ci-robot openshift-ci-robot added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Aug 26, 2020
@johnmcollier
Copy link
Member

johnmcollier commented Aug 26, 2020

Seems to be the same panic as in #3747 (comment)

The solution for the alpha branch/release was to do always make sure we properly initialize the registry in the preferences file johnmcollier@274acb7

But, should we even be allowing the odo registry commands to run if experimental mode isn't enabled? (I'd assume anything devfile specific is gated under experimental mode until the 2.0 release)

@mohammedzee1000
Copy link
Contributor Author

I ran it with experimental mode enabled. Note: once I did odo registry add default blah or tried creating etc, it worked fine.

Also, the issue here is panic. Something we ideally SHOULD NOT have, if we can prevent it, maybe gracefully exit if you are not initializing preference

@johnmcollier
Copy link
Member

I'm guessing you're setting experimental mode via the ODO_EXPERIMENTAL variable? (Otherwise, odo preference set experimental true would initialize the preferences file)

Agreed that we shouldn't have the panic, and so backporting johnmcollier@274acb7 should fix things

@johnmcollier
Copy link
Member

I can work on this

/assign

@cdrage
Copy link
Member

cdrage commented Aug 26, 2020

Just an FYI. I do have it in this PR as well: #3705

Unsure if the current test failures I'm facing are because of this issue or not. But going to do a quick /retest and will report back.

@johnmcollier
Copy link
Member

Decided to close my PR in favour of #3705, which has the same change in there

@girishramnani
Copy link
Contributor

closeing this issue then as #3705 got merge @johnmcollier

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/Medium Nice to have issue. Getting it done before priority changes would be great.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants