Merge lp://staging/~fwereade/pyjuju/restrict-relation-broken-context into lp://staging/pyjuju

Proposed by William Reade
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 433
Merged at revision: 449
Proposed branch: lp://staging/~fwereade/pyjuju/restrict-relation-broken-context
Merge into: lp://staging/pyjuju
Diff against target: 935 lines (+398/-244)
6 files modified
juju/state/errors.py (+4/-0)
juju/state/hook.py (+73/-7)
juju/state/tests/test_errors.py (+7/-1)
juju/state/tests/test_hook.py (+244/-175)
juju/unit/lifecycle.py (+67/-56)
juju/unit/tests/test_lifecycle.py (+3/-5)
To merge this branch: bzr merge lp://staging/~fwereade/pyjuju/restrict-relation-broken-context
Reviewer Review Type Date Requested Status
Benjamin Saller (community) Approve
Kapil Thangavelu (community) Approve
Review via email: mp+85267@code.staging.launchpad.net

Description of the change

Part 1 extracted from the horrifyingly overgrown restart-transitions branch:

relation-broken hooks now execute in a more constrained environment than do normal relation hooks (same things accessible, but with less functionality).

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Nice work, some minors.

[0]

Cache instance attributes could always use a documentation line on
what's being cached.

hook.py line 269

self._relation_cache = None

[1]

set_value/set

        return fail(NotImplementedError(
            "Cannot change settings in broken relation"))

That doesn't seem like the appropriate error in this
context. Something more specific to the problem at hand seems
appropriate, ie. RelationBrokenContextError

[2] pep8 nags, trailing newline at EOF, over 80 (unrelated to diff) in hook.py

unit_state = yield service_state_manager.get_unit_state(self._unit_name)

[3]

seems like the mixin here should be merged into hookcontexttestbase,
all the tests have the same pair of base classes.

HookContextTest(HookContextTestBase, CommonHookContextTestsMixin):

review: Approve
Revision history for this message
William Reade (fwereade) wrote :

Thanks Kapil.

[0]

Good point, thanks.

[1]

Fair enough :).

[2]

I'll take a look at those.

[3]

I'd prefer to avoid that: (1) the mixin depends on .service and .context, which are not part of the TestBase, and (2) they do have different responsibilities, and it feels somewhat coincidental that all the subclasses currently happen to use both base classes' services.

Revision history for this message
William Reade (fwereade) wrote :

(Ha, "over 80" -- I thought the whole file was riddled with pep8 violations, and was bemused when it only reported 2 :))

433. By William Reade

address review points

Revision history for this message
Benjamin Saller (bcsaller) wrote :

LGTM +1

review: Approve
434. By William Reade

merge parent

435. By William Reade

merge parent

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: