Repository navigation
bosh upload-stemcell panics if authentication with UAA fails #487
Copy link
Copy link
Closed
Description
What?
Running bosh with a UAA for authentication, trying to run bosh upload-stemcells, the command panics with an error if anything related to the authentication fails: wrong creds, wrong url, invalid ssl cert in UAA...
How to reproduce and output
$ BOSH_CLIENT_SECRET=aaa bosh -n upload-stemcell light-bosh-stemcell-97.28-aws-xen-hvm-ubuntu-xenial-go_agent.tgz
[CLI] 2018/10/25 14:25:42 ERROR - Panic: runtime error: invalid memory address or nil pointer dereference
********************
goroutine 1 [running]:
runtime/debug.Stack(0xe48de0, 0xc0004220c0, 0x40)
/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
main.handlePanic()
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/main.go:110 +0x15f
panic(0xda7580, 0x1894390)
/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/cloudfoundry/bosh-cli/cmd.Cmd.Execute.func1(0xc00027ebd8)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/cmd/cmd.go:47 +0x9a
panic(0xda7580, 0x1894390)
/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/cloudfoundry/bosh-cli/director.Client.StemcellNeedsUpload(0xc0000f6c40, 0x33, 0x0, 0x0, 0xc0000be400, 0x116fd40, 0xc0000ab3e0, 0x117bc60, 0xc000336520, 0xc0000f6c40, ...)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/director/stemcells.go:174 +0x198
github.com/cloudfoundry/bosh-cli/director.DirectorImpl.StemcellNeedsUpload(0xc0000f6c40, 0x33, 0x0, 0x0, 0xc0000be400, 0x116fd40, 0xc0000ab3e0, 0x117bc60, 0xc000336520, 0xc0000f6c40, ...)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/director/stemcells.go:125 +0xa0
github.com/cloudfoundry/bosh-cli/cmd.UploadStemcellCmd.needToUpload(0x11882a0, 0xc00045a2c0, 0xc00041e9e0, 0x117d460, 0xc00002e100, 0xc0004da270, 0x27, 0xc0004c1390, 0x5, 0x0, ...)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/cmd/upload_stemcell.go:75 +0x90
github.com/cloudfoundry/bosh-cli/cmd.UploadStemcellCmd.uploadFile(0x11882a0, 0xc00045a2c0, 0xc00041e9e0, 0x117d460, 0xc00002e100, 0x7fff62a4d429, 0x40, 0x0, 0x0, 0xd8bb00)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/cmd/upload_stemcell.go:57 +0x15d
github.com/cloudfoundry/bosh-cli/cmd.UploadStemcellCmd.Run(0x11882a0, 0xc00045a2c0, 0xc00041e9e0, 0x117d460, 0xc00002e100, 0x7fff62a4d429, 0x40, 0x0, 0x0, 0x0, ...)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/cmd/upload_stemcell.go:35 +0xe7
github.com/cloudfoundry/bosh-cli/cmd.Cmd.Execute(0xf20650, 0xdbd95c, 0xe, 0xc000034051, 0x25, 0x11853e0, 0xc00002e140, 0xc00004000d, 0x6dc, 0x0, ...)
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/cmd/cmd.go:176 +0x570c
main.main()
/tmp/build/9674af12/gopath/src/github.com/cloudfoundry/bosh-cli/main.go:35 +0x312
********************
Exit code 1
Expected result
An error reporting the problem:
# BOSH_CLIENT_SECRET=aaa bosh stemcells
Using environment 'bosh.hector.dev.cloudpipeline.digital' as client 'admin'
Finding stemcells:
Performing request GET 'https://bosh.hector.dev.cloudpipeline.digital:25555/stemcells':
Performing GET request:
Requesting token via client credentials grant: UAA responded with non-successful status code '401' response '{"error":"unauthorized","error_description":"Bad credentials"}'
Exit code 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
cf-gitbot commentedon Oct 25, 2018
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/161481490
The labels on this github issue will be updated when the story is started.
mfine30 commentedon Oct 25, 2018
Hey @keymon, thanks for submitting the issue. Could you let us know which version of the
bosh-cliyou're using?keymon commentedon Oct 26, 2018
Tested with v5.3.1
mariash commentedon Apr 9, 2019
Seeing this panic with
5.4.0geofffranks commentedon May 20, 2019
Saw this today with 5.5.0
geofffranks commentedon May 20, 2019
specifically, we were using BOSH_CLIENT + BOSH_CLIENT_SECRET env vars for providing credentials
Remove fallback behaviour of upload-stemcell querying /stemcells if