~hazmat/pyjuju/rapi-rollup

« back to all changes in this revision

Viewing changes to juju/hooks/invoker.py

  • Committer: Kapil Thangavelu
  • Date: 2013-01-20 12:17:15 UTC
  • mfrom: (616.2.13 rapi-annotation)
  • Revision ID: kapil@canonical.com-20130120121715-exju6n7miobz9gmc
Merged rapi-annotation into rapi-rollup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        exit_code = reason.value.exitCode
51
51
        if exit_code == 0:
52
52
            return deferred.callback(exit_code)
53
 
        elif exit_code == None and reason.value.signal:
 
53
        elif exit_code is None and reason.value.signal:
54
54
            error = errors.CharmInvocationError(
55
55
                self._hook_name, exit_code, signal=reason.value.signal)
56
56
        else:
215
215
                    JUJU_CLIENT_ID=self._client_id,
216
216
                    CHARM_DIR=os.path.join(self._unit_path, "charm"),
217
217
                    _JUJU_CHARM_FORMAT=str(self.charm_format),
 
218
                    JUJU_ENV_UUID=os.environ["JUJU_ENV_UUID"],
218
219
                    JUJU_UNIT_NAME=os.environ["JUJU_UNIT_NAME"],
219
220
                    DEBIAN_FRONTEND="noninteractive",
220
221
                    APT_LISTCHANGES_FRONTEND="none",
234
235
        """Returns the hook context for the invocation."""
235
236
        return self._context
236
237
 
237
 
    def get_relation_hook_context(self, relation_ident):
238
 
        """Returns a hook context corresponding to `relation_ident`"""
 
238
    def get_cached_relation_hook_context(self, relation_ident):
 
239
        """Returns cached hook context corresponding to `relation_ident`"""
239
240
        try:
240
241
            return self._relation_contexts[relation_ident]
241
242
        except KeyError:
255
256
 
256
257
        if not os.access(hook_filename, os.X_OK):
257
258
            raise errors.CharmError(hook_filename,
258
 
                                      "hook is not executable")
 
259
                                    "hook is not executable")
259
260
 
260
261
    def send_signal(self, signal_id):
261
262
        """Send a signal of the given signal_id.