apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.54k stars 1.17k forks source link

setting wsk cli to use vagrant host error supplied authentication is not authorized #334

Closed csantanapr closed 8 years ago

csantanapr commented 8 years ago

Following the setup using vagrant. Reach the point to use an external wsk cli to talk to openwhisk inside vagrant

Did this $ wsk list error: The supplied authentication is not authorized to access this resource (code 287)

👻  $ wsk property set --apihost 192.168.33.13 --auth 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
ok: whisk auth set
ok: whisk API host set
~/dev/whisk/demos/cleansetup
👻  $ wsk action invoke /whisk.system/samples/echo -p message hello --blocking --result
{
    "message": "hello"
}
~/dev/whisk/demos/cleansetup
👻  $ wsk list
error: The supplied authentication is not authorized to access this resource (code 287)
~/dev/whisk/demos/cleansetup
👻  $ wsk property get
whisk auth      23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
whisk API host      192.168.33.13
whisk API version   v1
whisk namespace     csantana@us.ibm.com_dev
whisk CLI version   2016-04-08T03:37:43-05:00
whisk API build     2016-05-04T19:45:38+00:00
whisk API buildno   latest
rabbah commented 8 years ago

you're using the wrong namespace - your clean setup not so clean ;)

whisk namespace csantana@us.ibm.com_dev

suggest you remove property file.

csantanapr commented 8 years ago

I notice when I compare both

vagrant@carlosmacb-wsk:~/openwhisk$ wsk property get
whisk auth      23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
whisk API host      172.17.0.1
whisk API version   v1
whisk namespace     _
whisk CLI version   2016-05-04T19:45:38+00:00
whisk API build     2016-05-04T19:45:38+00:00
whisk API buildno   latest
~/dev/whisk/demos/cleansetup
👻  $ wsk property get
whisk auth      23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
whisk API host      192.168.33.13
whisk API version   v1
whisk namespace     csantana@us.ibm.com_dev
whisk CLI version   2016-04-08T03:37:43-05:00
whisk API build     2016-05-04T19:45:38+00:00
whisk API buildno   latest
csantanapr commented 8 years ago

@rabbah But how do I do it with the CLI? trying to find what do we need to put in the README

Tried this

$ wsk property set --namespace _
error: you are either not entitled to a namespace or you made an invalid choice

But it didn't work

rabbah commented 8 years ago

wsk property unset --namespace would remove the namespace (and your command will work). If you were starting from a clean box and following the instructions there would be no namespace (because there would be no property file).

For guest, the namespace would be (if you want to set it explicitly) wsk property set --namespace guest.

csantanapr commented 8 years ago

So the subject name is "guest" then, right? Or "default" ?

I asked because I see both being used

here default

$ wsk property get
whisk auth      23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
whisk API host      172.17.0.1
whisk API version   v1
whisk namespace     _
whisk CLI version   2016-05-04T19:45:38+00:00
whisk API build     2016-05-04T19:45:38+00:00
whisk API buildno   latest
$ wsk list
entities in namespace: default
packages
actions
triggers
rules

and guest here

$ wsk property get
whisk auth      23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
whisk API host      192.168.33.13
whisk API version   v1
whisk namespace     guest
whisk CLI version   2016-04-08T03:37:43-05:00
whisk API build     2016-05-04T19:45:38+00:00
whisk API buildno   latest
~/dev/whisk/demos/cleansetup
👻  $ wsk list
entities in namespace: guest
packages
actions
triggers
rules
csantanapr commented 8 years ago

I will close this one and fix with #321 by adding info in the README