openwhisk-cli icon indicating copy to clipboard operation
openwhisk-cli copied to clipboard

CLI always resets actions to default kind

Open akrabat opened this issue 8 years ago • 5 comments

If you don't specify the --kind on every command, then the CLI will reset back to the default:

$ wsk action list
actions
/19FT_dev/ping                                                         private swift:3

$ wsk action update ping ping.swift --kind swift:3.1.1
ok: updated action ping

$ wsk action list
actions
/19FT_dev/ping                                                         private swift:3.1.1

$ wsk action update ping ping.swift
ok: updated action ping

$ wsk action list
actions
/19FT_dev/ping                                                         private swift:3

I expect that once I've set a kind, then that action will always stay on that kind.

akrabat avatar Oct 26 '17 07:10 akrabat

@csantanapr, I think the above is because swift:3 is the default still.

dubee avatar Oct 26 '17 22:10 dubee

this is bad, on wsk update if the action already exist it should not change the kind by sending kind:default

csantanapr avatar Oct 26 '17 22:10 csantanapr

It would also be nice not to have to fetch the action to update it. The way the request schema is today the kind and code are part of the request. We could use a sentinel type for kind in this case, or do client side merge, or get rid of default although that doesn’t fix the problem.

rabbah avatar Oct 26 '17 22:10 rabbah

Should the whisk API offer http HEAD that will allow a quick check to see if resource exist?

csantanapr avatar Oct 26 '17 22:10 csantanapr

:+1: on moving the responsibility for merging to the API rather than the client. Does this also affect annotations and parameters?

There's probably not a clean solution as we're using the same HTTP verb to handle two operations.

What about a "merge" query parameter (that defaults to false for backwards compatibility) that if the action exists will merge, rather than replace, the action definition? This is similar in semantics to the UPSERT SQL command in Postgres.

jthomas avatar Oct 27 '17 09:10 jthomas