Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(323)

Issue 90130044: Implements "juju actions <service>".

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by Bodie
Modified:
10 years ago
Reviewers:
mp+216651, natefinch, fwereade
Visibility:
Public.

Description

Implements "juju actions <service>". https://code.launchpad.net/~binary132/juju-core/skeletal_actions/+merge/216651 The client command "actions" queries against the service's charm, building a representation of the available actions from actions.yaml in the charm's root directory. Actions themselves will be implemented as hooks in a future revision. The actions.yaml spec is as follows: actionspecs: <an action name>: description: "A description string for the action." params: <a param name>: description: "A description string for the parameter." type: (string|int|float|boolean) default: <a default value> <...more param names...> <...more action names...>

Patch Set 1 #

Total comments: 25
Unified diffs Side-by-side diffs Delta from patch set Stats (+606 lines, -28 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
A charm/actions.go View 1 chunk +135 lines, -0 lines 12 comments Download
A charm/actions_test.go View 1 chunk +92 lines, -0 lines 0 comments Download
M charm/bundle.go View 3 chunks +26 lines, -6 lines 0 comments Download
M charm/bundle_test.go View 2 chunks +11 lines, -0 lines 0 comments Download
M charm/charm.go View 1 chunk +1 line, -0 lines 0 comments Download
M charm/dir.go View 3 chunks +23 lines, -4 lines 1 comment Download
M charm/hooks/hooks.go View 2 chunks +2 lines, -0 lines 0 comments Download
M charm/meta_test.go View 2 chunks +5 lines, -0 lines 0 comments Download
M charm/repo_test.go View 1 chunk +3 lines, -3 lines 0 comments Download
A cmd/juju/actions.go View 1 chunk +68 lines, -0 lines 4 comments Download
A cmd/juju/actions_test.go View 1 chunk +69 lines, -0 lines 0 comments Download
M state/api/client.go View 2 chunks +16 lines, -0 lines 1 comment Download
M state/api/params/params.go View 1 chunk +13 lines, -0 lines 1 comment Download
A state/apiserver/client/actions.go View 1 chunk +51 lines, -0 lines 2 comments Download
A state/apiserver/client/actions_test.go View 1 chunk +38 lines, -0 lines 0 comments Download
A state/apiserver/client/do_test.go View 1 chunk +6 lines, -0 lines 1 comment Download
M state/charm.go View 2 chunks +6 lines, -0 lines 0 comments Download
M state/state.go View 2 chunks +2 lines, -0 lines 2 comments Download
M store/store.go View 6 chunks +25 lines, -15 lines 0 comments Download
M store/store_test.go View 1 chunk +4 lines, -0 lines 1 comment Download
A testing/repo/quantal/dummy/actions.yaml View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 3
Bodie
Please take a look.
10 years ago (2014-04-22 01:12:10 UTC) #1
natefinch
Some thoughts and possibilities for cleanup below. One additional thought I had was if there's ...
10 years ago (2014-04-22 19:44:35 UTC) #2
fwereade
10 years ago (2014-04-23 07:05:29 UTC) #3
This is a very large CL, hitting an awful lot of the codebase, to the extent
that I'm not sure I've properly reviewed it all -- eg I have registered little
worries about cross-version compatibility at various points.

And... it exposes misleading functionality to the user. It gives them an
"actions" command that merely tantalises them with the possibility of actions,
and we're nowhere *near* ready for that -- there's a *load* of subtle and
complex functionality that needs to be in place before we expose this at the UI
level.

I would strongly suggest that you break this work up roughly as follows -- with
the understanding that each numbered step below potentially involves several
CLs:

1) Make changes to the charm package alone
2) Make the changes to the state server necessary to store this information for
all charms (distinguishing between "no actions" and "might have actions, but was
imported by a version of the state server that didn't know about them", and
fixing the latter at runtime, either during upgrade or on-demand)
3) Work on the state-level infrastructure for storing requested actions and
producing their results, taking into account the fact that charm versions can
change and thus so will the validity of pre-queued actions; come up with a plan
for handling this. (Doesn't need to be complex -- just fail, and explain why, is
fine for v1 -- but needs to exist)
4) Figure out how to get the unit agents themselves to actually run the actions
and store the results, again taking differing charm versions into account -- and
figuring out when we *should* run actions, taking unit lifecycle into account,
etc etc. 
5) actually expose fully tested, working functionality, via the API and finally
the CLI -- I would ideally want "do" and all associated commands to land
together, in the same release if not necessarily in the same branch.

https://codereview.appspot.com/90130044/diff/1/charm/actions.go
File charm/actions.go (right):

https://codereview.appspot.com/90130044/diff/1/charm/actions.go#newcode4
charm/actions.go:4: package charm
This file appears to be largely copy/pasted from config.yaml.

There are indeed clear parallels between the two pieces of functionality, but I
am concerned that:

1) similar parallel code paths will drift out of sync, leading to unpleasant UX
2) config *and* actions are needlessly limited by this string/int/float/bool
nonsense, and we will *definitely* hit exactly the same issues here as we have
with charm config in the past. People *will* need to specify (eg) maps, and
having to yaml-base64-encode them *just to get them into juju* is really
unpleasant.

So, I think there are two viable paths here -- we could design actions nicely,
and write fresh code for them, with a view to eventually migrating config to use
the new code as well; or we could make them look just like config, and reap the
benefits of the code already being written, and dump the externalities on our
users.

I hope it's clear that I favour the former path (although I am always
potentially open to argument); but ISTM that the current approach combines the
worst aspects of both, and isn't going to fly.

https://codereview.appspot.com/90130044/diff/1/cmd/juju/actions.go
File cmd/juju/actions.go (right):

https://codereview.appspot.com/90130044/diff/1/cmd/juju/actions.go#newcode14
cmd/juju/actions.go:14: )
This also appears to be a copy/paste job, to the point of cloning comments that
don't make sense.

https://codereview.appspot.com/90130044/diff/1/cmd/juju/actions.go#newcode59
cmd/juju/actions.go:59: return err
If you're dealing with a state server too old to handle a ServiceActions
request, please inform the user of this fact nicely :).

https://codereview.appspot.com/90130044/diff/1/cmd/juju/actions.go#newcode65
cmd/juju/actions.go:65: "actionspecs": results.ActionsSpec,
What's the rationale for this form of results, beyond "get did it"?

https://codereview.appspot.com/90130044/diff/1/state/api/params/params.go
File state/api/params/params.go (right):

https://codereview.appspot.com/90130044/diff/1/state/api/params/params.go#new...
state/api/params/params.go:182: type ServiceActions struct {
Bulk calls, please; and *please* don't name objects after the verbs to which
they are tangentially related.

https://codereview.appspot.com/90130044/diff/1/state/apiserver/client/actions.go
File state/apiserver/client/actions.go (right):

https://codereview.appspot.com/90130044/diff/1/state/apiserver/client/actions...
state/apiserver/client/actions.go:22: return params.ServiceActionsResults{
How is this a "Results"? Looks like a "Result" to me -- we *should* indeed be
accepting multiple requests, and returning multiple results, but we're not.

https://codereview.appspot.com/90130044/diff/1/state/apiserver/client/actions...
state/apiserver/client/actions.go:24: Charm:       charm.Meta().Name,
Charm URL is useful information; charm name is ambiguous. Copy/paste from
get.go?

https://codereview.appspot.com/90130044/diff/1/state/state.go
File state/state.go (right):

https://codereview.appspot.com/90130044/diff/1/state/state.go#newcode518
state/state.go:518: ActionsSpec:  ch.ActionsSpec(),
I've been biting by tongue a little, but... "ActionsSpec"? Why not "Actions"?

https://codereview.appspot.com/90130044/diff/1/state/state.go#newcode869
state/state.go:869: {"actionspec", ch.ActionsSpec()},
is it an actionspec or an actionsspec?

https://codereview.appspot.com/90130044/diff/1/store/store_test.go
File store/store_test.go (right):

https://codereview.appspot.com/90130044/diff/1/store/store_test.go#newcode97
store/store_test.go:97: return
&charm.ActionsSpec{make(map[string]charm.ActionSpec)}
If you're adding code to the store to handle actions, I think you need to test
it a little more than this.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b