Merge lp:~jimbaker/juju-jitsu/juju-do into lp:juju-jitsu
| Status: | Merged |
|---|---|
| Merged at revision: | 36 |
| Proposed branch: | lp:~jimbaker/juju-jitsu/juju-do |
| Merge into: | lp:juju-jitsu |
| Diff against target: |
407 lines (+387/-0) 4 files modified
sub-commands/aiki/__init__.py (+1/-0) sub-commands/aiki/introspect.py (+57/-0) sub-commands/aiki/invoker.py (+126/-0) sub-commands/do (+203/-0) |
| To merge this branch: | bzr merge lp:~jimbaker/juju-jitsu/juju-do |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Juju-Jitsu Hackers | 2012-04-24 | Pending | |
|
Review via email:
|
|||
Description of the Change
Adds a "juju do" subcommand. Use as follows:
$ juju do --help
usage: do [-h] [-e ENVIRONMENT] [--loglevel CRITICAL|
Examples:
To introspect a relation setting on the db:0 relation for the mysql/0 service unit:
$ PASSWORD=$(juju do mysql/0 relation-get -r db:0 password)
Note that a relation id must be supplied when using relation hook commands. It might make sense to default this if there's only one relation; that could be done in a future branch.
Define a script refresh.sh like so:
#!/bin/bash
for relation_id in $(relation-ids db); do
relation-set -r $relation_id ready=$1
done
$ juju do --loglevel=DEBUG mysql/0 refresh.sh 32
2012-04-24 11:02:19,671 juju.ec2:WARNING txaws.client.ssl unavailable for SSL hostname verification
2012-04-24 11:02:19,671 juju.ec2:WARNING EC2 API calls encrypted but not authenticated
2012-04-24 11:02:19,671 juju.ec2:WARNING S3 API calls encrypted but not authenticated
2012-04-24 11:02:19,671 juju.ec2:WARNING Ubuntu Cloud Image lookups encrypted but not authenticated
2012-04-24 11:02:19,673 juju.common:INFO Connecting to environment...
2012-04-24 11:02:20,547 juju.common:DEBUG Connecting to environment using ec2-50-
2012-04-24 11:02:20,548 juju.state.
2012-04-24 11:02:22,186 juju.common:DEBUG Environment is initialized.
2012-04-24 11:02:22,186 juju.common:INFO Connected to environment.
2012-04-24 11:02:22,592 juju-do-
2012-04-24 11:02:23,352 juju.jitsu.
2012-04-24 11:02:23,794 juju.jitsu.
2012-04-24 11:02:23,875 juju-do-
2012-04-24 11:02:24,666 juju-do-
Setting changed: 'ready'=u'32' (was '42') on 'db:0'
Setting changed: 'ready'=u'32' (was '42') on 'db:1'
"juju do" can also run on a Juju machine as well. This can make it useful for running as part of a cron job, for example.
Still needs unit testing, but it should be suitable for merging against juju-jitsu at this time.
| Clint Byrum (clint-fewbar) wrote : | # |
| Jim Baker (jimbaker) wrote : | # |
I changed 'juju do' to 'jitsu do' accordingly in both the docs and the code (to keep it consistent with docs), then merged. Thanks for the review!

Looks great Jim. I've not given it a line by line analysis, but I like the direction and the utility.
One thing, it should be documented as 'jitsu do' not 'juju do' since sub-commands are only added to juju if 'wrap-juju' is invoked.
Thats the only thing, otherwise, merge away!