Merge lp:~jimbaker/pyjuju/unit-rel-lifecycle-start-invoker into lp:pyjuju
Proposed by
Jim Baker
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 535 | ||||
Proposed branch: | lp:~jimbaker/pyjuju/unit-rel-lifecycle-start-invoker | ||||
Merge into: | lp:pyjuju | ||||
Diff against target: |
156 lines (+69/-6) 4 files modified
juju/hooks/invoker.py (+6/-1) juju/hooks/tests/test_invoker.py (+3/-3) juju/unit/lifecycle.py (+1/-0) juju/unit/tests/test_lifecycle.py (+59/-2) |
||||
To merge this branch: | bzr merge lp:~jimbaker/pyjuju/unit-rel-lifecycle-start-invoker | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+104195@code.launchpad.net |
Description of the change
Ensure Invoker.start is called from UnitRelationLif
UnitRelationLif
To post a comment you must log in.
Reviewers: mp+104195_ code.launchpad. net,
Message:
Please take a look.
Description: ecycle usage.
Ensure Invoker.start is called from UnitRelationLif
UnitRelationLif ecycle did not properly call Invoker.start (a one-line ecycle and UnitLifecycle usages.
fix), which prevented relation hook contexts from being cached for the
corresponding hook call. Because caching of the hook contexts is logged,
this can be verified to ensure this method is properly called for both
UnitRelationLif
https:/ /code.launchpad .net/~jimbaker/ juju/unit- rel-lifecycle- start-invoker/ +merge/ 104195
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6131061/
Affected files: invoker. py lifecycle. py tests/test_ lifecycle. py
A [revision details]
M juju/hooks/
M juju/unit/
M juju/unit/
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: juju/hooks/ invoker. py invoker. py' invoker. py 2012-04-05 00:49:40 +0000 invoker. py 2012-05-01 00:26:25 +0000 self._context, RelationHookCon text):
relation_ idents. discard( self._context. relation_ ident) parent_ relation_ ident = " on %r" % \ relation_ ident parent_ relation_ ident = "" get_relation_ hook_context(
relation_ ident)
self._relation_ contexts[ relation_ ident] = child debug(" Cached relation hook contexts: %s" % ( debug(" Cached relation hook contexts%s: %r" % ( parent_ relation_ ident,
sorted( relation_ idents) ))
=== modified file 'juju/hooks/
--- juju/hooks/
+++ juju/hooks/
@@ -175,11 +175,16 @@
if isinstance(
# Exclude the parent context for being looked up as a child
+ display_
+ self._context.
+ else:
+ display_
for relation_ident in relation_idents:
child = yield self._context.
- self._log.
+ self._log.
+ display_
@property
Index: juju/unit/ lifecycle. py lifecycle. py' lifecycle. py 2012-04-10 22:58:44 +0000 lifecycle. py 2012-05-01 00:26:25 +0000
=== modified file 'juju/unit/
--- juju/unit/
+++ juju/unit/
@@ -731,6 +731,7 @@
@ inlineCallbacks
self._unit_ dir, "charm", "hooks", hook_name) lock.acquire( )
def _execute_hook(self, invoker, hook_name, change):
+ yield invoker.start()
hook_path = os.path.join(
yield self._run_
Index: juju/unit/ tests/test_ lifecycle. py tests/test_ lifecycle. py' tests/test_ lifecycle. py 2012-04-10 07:10:47 +0000 tests/test_ lifecycle. py 2012-05-01 00:26:25 +0000 tests.test_ charm import CharmPublisherT estBase
=== modified file 'juju/unit/
--- juju/unit/
+++ juju/unit/
@@ -34,7 +34,7 @@
from juju.unit.
from juju.lib.testing import TestCase
-from juju.lib.mocker import (ANY, MATCH, Mocker)
+from juju.lib.mocker import MATCH
class UnwriteablePath (object) : "unit"] .set_relation_ resolved(
{self.states[ "unit_rela. ..
@@ -358,7 +358,6 @@
yield self.states[