Closed ioana-blue closed 7 years ago
I think it's a cli bug. See output below (edited out auth and path):
bluewhisk/open/ansible/../bin/wsk --verbose -i --apihost 192.168.99.100 --apiversion v1 action create --auth ***** /_/sequenceWithBindingParams package2/print --sequence
exit code = 147
stdout: [/go-whisk/whisk.NewClient]:070:[Inf] Disabling certificate checking.
[mmands.parseQualifiedName]:112:[Inf] Qualified entityName: sequenceWithBindingParams
[mmands.parseQualifiedName]:113:[Inf] Qaulified namespace: _
[-cli/commands.parseAction]:477:[Inf] Parsing parameters: []string(nil)
[.getKeyValueFormattedJSON]:197:[Inf] Created key/value format '[]' from 'map[]'
[-cli/commands.parseAction]:489:[Inf] Parsing annotations: []string(nil)
[.getKeyValueFormattedJSON]:197:[Inf] Created key/value format '[]' from 'map[]'
[-cli/commands.parseAction]:624:[Inf] Parsed action struct: &whisk.Action{Namespace:"_", Name:"sequenceWithBindingParams", Version:"", Publish:false, Exec:(*whisk.Exec)(0x4208aa300), Annotations:whisk.KeyValueArr(nil), Parameters:whisk.KeyValueArr(nil), Limits:(*whisk.Limits)(nil)}
[k.(*ActionService).Insert]:153:[Inf] Action insert route: actions/sequenceWithBindingParams?overwrite=false
REQUEST:
[PUT] https://192.168.99.100/api/v1/namespaces/_/actions/sequenceWithBindingParams?overwrite=false
Req Headers
{
"Authorization": [
"Basic ***********"
],
"Content-Type": [
"application/json"
]
}Req Body
{{"exec":{"kind":"sequence","code":"","components":["/ioana@us.ibm.com_dev/package2/print"]}}
}
[-whisk/whisk.(*Client).Do]:209:[Inf] Req Body (ASCII quoted string):
{"{\"exec\":{\"kind\":\"sequence\",\"code\":\"\",\"components\":[\"/ioana@us.ibm.com_dev/package2/print\"]}}\n"}
RESPONSE:Got response with code 403
Response body size is 103 bytes
Response body received:
{
"error": "The supplied authentication is not authorized to access this resource.",
"code": 1304
}
[-whisk/whisk.(*Client).Do]:233:[Inf] Response body received (ASCII quoted string):
"{\n \"error\": \"The supplied authentication is not authorized to access this resource.\",\n \"code\": 1304\n}"
[/whisk.parseErrorResponse]:280:[Inf] HTTP failure 403 + body
[/whisk.parseErrorResponse]:292:[Inf] HTTP failure 403; server error The supplied authentication is not authorized to access this resource. (code 1304)
[k.(*ActionService).Insert]:168:[Err] s.client.Do() error - HTTP req https://192.168.99.100/api/v1/namespaces/_/actions/sequenceWithBindingParams?overwrite=false; error 'The supplied authentication is not authorized to access this resource. (code 1304)'
[sk-cli/commands/action.go]:074:[Err] client.Actions.Insert(&whisk.Action{Namespace:"_", Name:"sequenceWithBindingParams", Version:"", Publish:false, Exec:(*whisk.Exec)(0x4208aa300), Annotations:whisk.KeyValueArr(nil), Parameters:whisk.KeyValueArr(nil), Limits:(*whisk.Limits)(nil)}, false, false) error: The supplied authentication is not authorized to access this resource. (code 1304)
[main.main ]:066:[Inf] err object type: *whisk.WskError
[main.main ]:070:[Err] Got a *whisk.WskError error: &whisk.WskError{RootErr:(*errors.errorString)(0x420988330), ExitCode:147, DisplayMsg:true, MsgDisplayed:false, DisplayUsage:false, ApplicationError:false}
stderr: error: Unable to create action: The supplied authentication is not authorized to access this resource. (code 1304)
The output above contains the cli command and the output with verbose and debug enabled. The cli is instructed to create a sequence and the component action does not have a namespace. The cli infers it as being default (i.e., _
) and then fills it in with info from .wskprops
:
Req Body
{{"exec":{"kind":"sequence","code":"","components":["/ioana@us.ibm.com_dev/package2/print"]}}
}
(note the namespace; it should be guest for my local run or _
)
I can confirm that if the default namespace is explicit, the cli works properly.
If I don't have a .wskprops
file, I can confirm that the default package is inferred as _
by the cli.
I'll push my changes to a branch such that this issue can be reproduced easily.
I should also say that during the same test, several other entities are created with a default namespace unspecified (i.e., package/action
) and the cli just uses the default namespaces (i.e., /_/package/action
).
Not sure whether the cli behaves as designed and we may need to specify where to get a whisk properties file when using it during testing. FYI @rabbah
Branch https://github.com/ioana-blue/openwhisk/tree/ioana-issue1584 can be used to reproduce the output above. Run this test: https://github.com/ioana-blue/openwhisk/blob/ioana-issue1584/tests/src/system/basic/WskSequenceTests.scala#L271
A side note - @paulcastro noticed on his local deployment a similar issue with rules as well.
This is not a CLI bug (it's operating as expected/designed). The defect is in the Wsk
scala helper - it provides an empty environment for running CLI commands but should instead override the wskprops
file via WSK_CONFIG_FILE=
in the env
map.
The helper resolves all names in CLI commands to be qualified names but it looks like for sequences, these can sneak through raw.
@rabbah pointed out a couple more missing fqns. I'll fix these bugs.
Fixed by #1585
While working on test in #1581 I noticed some behavior that looked buggy. Initially, I didn't specify any namespace for any of the entities created.
guest
was used by default. However, for the action component, the value in.wskprops
from my home dir seemed to have been used. I need to investigate if there is a bug and where the bug is.Environment details:
Steps to reproduce the issue:
Related to test in #1581