Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1367655 - oc project meets panic "invalid memory address or nil pointer dereference" when the kube config is abnormal
Summary: oc project meets panic "invalid memory address or nil pointer dereference" wh...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Command Line Interface
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.x
Assignee: Fabiano Franz
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-17 06:39 UTC by Xingxing Xia
Modified: 2016-09-19 13:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-19 13:49:43 UTC


Attachments (Terms of Use)

Description Xingxing Xia 2016-08-17 06:39:11 UTC
Description of problem:
oc project meets panic "invalid memory address or nil pointer dereference" when the kube config is abnormal. E.g. This can be reproduced via `oc project` inside pod

Version-Release number of selected component (if applicable):
oc v1.3.0-alpha.3+0eb9cf4
kubernetes v1.3.0+507d3a7
features: Basic-Auth GSSAPI Kerberos SPNEGO

How reproducible:
Always

Steps to Reproduce:
1. Create pod which contains oc, e.g. via openshift/origin image:
$ oc run mydc --image=openshift/origin --command=true sleep 1d
2. Enter into pod shell
1> $ oc rsh mydc-1-vnt0d
sh-4.2$ 

Do following checks:
2>
sh-4.2$ oc version
oc v1.3.0-alpha.3+0eb9cf4
kubernetes v1.3.0+507d3a7
features: Basic-Auth GSSAPI Kerberos SPNEGO
...

3>
sh-4.2$ oc config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []

4> sh-4.2$ oc project
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x59749e]

goroutine 1 [running]:
panic(0x419fd20, 0xc820012090)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/openshift/origin/pkg/cmd/cli/cmd.ProjectOptions.RunProject(0x0, 0x0, 0x0, 0x0, 0x0, 0xc8203f6ed0, 0xc8203f6f00, 0xc8203f6f30, 0xc8203f6f60, 0x0, ...)
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/pkg/cmd/cli/cmd/project.go:126 +0x26ce
github.com/openshift/origin/pkg/cmd/cli/cmd.NewCmdProject.func1(0xc8208d18c0, 0x8056348, 0x0, 0x0)
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/pkg/cmd/cli/cmd/project.go:76 +0x1a3
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).execute(0xc8208d18c0, 0x8056348, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:603 +0x896
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc8208ad200, 0xc8208d18c0, 0x0, 0x0)
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:689 +0x55c
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Execute(0xc8208ad200, 0x0, 0x0)
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:648 +0x2d
main.main()
	/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/cmd/openshift/openshift.go:33 +0x199

Actual results:
2.
4> Meet panic (note: the user inside a pod is serviceaccout "default")

Expected results:
2.
4> Should not meet panic and give proper message

Additional info:

Comment 2 Fabiano Franz 2016-08-18 21:23:20 UTC
Fixed in https://github.com/openshift/origin/pull/10521

Comment 3 Xingxing Xia 2016-08-19 07:45:45 UTC
Checked with oc v1.3.0-alpha.3+670926d, inside pod, now `oc project` does not panic. Instead, it prompts "No project has been set. Pass a project name to make that the default." as it did under OS bash. Looks good.


Note You need to log in before you can comment on or make changes to this bug.