~jimbaker/pyjuju/debug-relation-hook-context

« back to all changes in this revision

Viewing changes to docs/source/internals/unit-agent-hooks.rst

  • Committer: Gustavo Niemeyer
  • Date: 2011-09-16 00:36:31 UTC
  • mto: This revision was merged to the branch mainline in revision 349.
  • Revision ID: gustavo@niemeyer.net-20110916003631-4g3p7ycpisxbi3eu
Fixed several broken tests, including some coming from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
Because of the way in which settings state is presented through the
106
106
command line utilities within hooks clients are provided a string
107
107
token through a calling environmental variable,
108
 
*ENSEMBLE_CLIENT_ID*. Using this variable all command line tools will
 
108
*JUJU_CLIENT_ID*. Using this variable all command line tools will
109
109
connect with a shared common state when used from a single hook
110
110
invocation.
111
111
 
174
174
    * **list_relations(client_id)** - Returns a list of all relations
175
175
        associated with a hook at the time of invocation. The values
176
176
        of this call will typically also be exposed as a environment
177
 
        variable, **ENSEMBLE_MEMBERS**.
 
177
        variable, **JUJU_MEMBERS**.
178
178
 
179
179
    * **flush(client_id)** - reserved
180
180
 
259
259
Hooks can expect to be invoked with a standard environment and
260
260
context. The following be included:
261
261
 
262
 
    * `$ENSEMBLE_SOCKET` - Path to a UNIX Domain socket which will be
 
262
    * `$JUJU_SOCKET` - Path to a UNIX Domain socket which will be
263
263
      made available to the command line tools in order to communicate
264
264
      with the UA.
265
265
 
266
 
    * `$ENSEMBLE_CLIENT_ID` - A unique identifier passed to a hook
 
266
    * `$JUJU_CLIENT_ID` - A unique identifier passed to a hook
267
267
      invocation used to populate the --client_id flag to cli
268
268
      tools. This is describe in the section, `Client Id`_.
269
269
 
270
 
   * `$ENSEMBLE_LOCAL_UNIT` - The unit name of the unit this hook is
 
270
   * `$JUJU_LOCAL_UNIT` - The unit name of the unit this hook is
271
271
     being invoked in. (ex: myblog/0)
272
272
 
273
 
   * `$ENSEMBLE_SERVICE` - The name of the service for which this hook
 
273
   * `$JUJU_SERVICE` - The name of the service for which this hook
274
274
     is running. (ex: myblog)
275
275
 
276
 
   * `$ENSEMBLE_FORMULA` - The name of the forumla which deployed the
 
276
   * `$JUJU_CHARM` - The name of the charm which deployed the
277
277
     unit the hook is running in. (ex: wordpress)
278
278
 
279
279
 
280
280
Hooks called for relationships will have the follow additional
281
281
environment variables available to them.
282
282
 
283
 
    * `$ENSEMBLE_MEMBERS` - A space-delimited list of qualified
 
283
    * `$JUJU_MEMBERS` - A space-delimited list of qualified
284
284
      relationship ids uniquely specifying all the UAs participating in
285
285
      a given relationship. (ex. "wordpress/1 worpress/2")
286
286
 
287
 
    * `$ENSEMBLE_RELATION` - The relation name this hook is running
 
287
    * `$JUJU_RELATION` - The relation name this hook is running
288
288
      for.  It's redundant with the hook name, but is necessary for
289
289
      the command line tools to know the current context.
290
290
 
291
 
    * `$ENSEMBLE_REMOTE_UNIT` - The unit name of the remote unit
 
291
    * `$JUJU_REMOTE_UNIT` - The unit name of the remote unit
292
292
      which has triggered the hook execution.
293
293
 
294
294