Merge lp://staging/~jimbaker/pyjuju/relation-hook-commands-spec into lp://staging/~juju/pyjuju/docs
Proposed by
Jim Baker
Status: | Merged |
---|---|
Approved by: | Kapil Thangavelu |
Approved revision: | 9 |
Merge reported by: | Mark Mims |
Merged at revision: | not available |
Proposed branch: | lp://staging/~jimbaker/pyjuju/relation-hook-commands-spec |
Merge into: | lp://staging/~juju/pyjuju/docs |
Diff against target: |
97 lines (+93/-0) 1 file modified
source/drafts/relation-hook-commands.rst (+93/-0) |
To merge this branch: | bzr merge lp://staging/~jimbaker/pyjuju/relation-hook-commands-spec |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+97733@code.staging.launchpad.net |
Description of the change
Enable relation hook commands to work with arbitrary relations.
Enable `relation-get`, `relation-set`, `relation-list` to work in
any hook on arbitrary relations, as specified unambiguously by relation id.
To post a comment you must log in.
Reviewers: mp+97733_ code.launchpad. net,
Message:
Please take a look.
Description:
Enable relation hook commands to work with arbitrary relations.
Enable `relation-get`, `relation-set`, `relation-list` to work in
any hook on arbitrary relations, as specified by a relation name or
unambiguously by relation id.
https:/ /code.launchpad .net/~jimbaker/ juju/relation- hook-commands- spec/+merge/ 97733
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/5836050/
Affected files: drafts/ relation- hook-commands. rst
A [revision details]
A source/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: source/ drafts/ relation- hook-commands. rst drafts/ relation- hook-commands. rst' drafts/ relation- hook-commands. rst 1970-01-01 00:00:00 +0000 drafts/ relation- hook-commands. rst 2012-03-15 19:34:59 +0000 ------- ------- ------- ------- ------- ------- ------ NAME_OR_ ID] [-|SETTING] [UNIT_NAME] NAME_OR_ ID] NAME_OR_ ID] [UNIT_NAME]
=== added file 'source/
--- source/
+++ source/
@@ -0,0 +1,62 @@
+Commands to work with relation settings and membership
+------
+
+The hook commands working with relation settings (`relation-get`,
+`relation-set`, and `relation-list`) are modified to enable their use
+with other relations than the implied relation and also for other
+hooks besides relation hooks::
+
+ relation-get [-r RELATION_
+
+ relation-set [-r RELATION_
+ [SETTING=VALUE [SETTING=VALUE ...]] [UNIT_NAME]
+
+ relation-list [-r RELATION_
+
+The current behavior for these commands is to use the **implied
+relation**. This relation is the one in effect when the relation hook
+command is used in a relation hook. When not running in the context of
+a relation hook and its implied relation, it is necessary to specify a
+relation unambiguously. Note that there can be several possible
+implied relations for a given relation name, in which case the
+relation id *must* be used to specify the desired relation.
+
+Example. To get the user name from the relation named `db` from
+`mysql/0` from any hook::
+
+ user=`relation-get -r db user mysql/0`
+
+For the relational hook commands `relation-get`, `relation-set`, and
+`relation-list`, the following apply for non-implied relations when
+run from any hook:
+
+ * Referring to a relation causes its hook context to be instantiated
+ and cached. Subsequent reads of settings and the relation listing
+ will return the same values for the duration of the hook calling
+ these hook commands ("consistency").
+
+ * If a relation name is specified with `-r` and the relation cannot
+ be precisely determined by this name, an error is raised stating
+ "Ambiguous relation name".
+
+ * If the relation does not exist at the time of read/caching, an
+ error is raised stating "Relation not found".
+
+ * If the hook exits with status code 0, the hook contexts are then
+ written into ZooKeeper, one at a ti...