Merge lp://staging/~benji/landscape-client/bug-1428826-restore-register-function-public-API into lp://staging/~landscape/landscape-client/trunk

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: 816
Merged at revision: 813
Proposed branch: lp://staging/~benji/landscape-client/bug-1428826-restore-register-function-public-API
Merge into: lp://staging/~landscape/landscape-client/trunk
Diff against target: 168 lines (+91/-18)
2 files modified
landscape/configuration.py (+25/-15)
landscape/tests/test_configuration.py (+66/-3)
To merge this branch: bzr merge lp://staging/~benji/landscape-client/bug-1428826-restore-register-function-public-API
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
Björn Tillenius (community) Approve
Review via email: mp+252126@code.staging.launchpad.net

Commit message

Instead of running client configuration as an independent executable
(which would have been preferable), the client charm reaches inside and
calls the register() function directly. That has resulted in a
dependency on register()'s API which was not enforced via testing or
documented in register()'s docstring.

This branch restores the API the charm depends on, adds documentation as
to its meaning and importance, and adds tests that will warn us if the
API is broken in the future.

Description of the change

Instead of running client configuration as an independent executable (which would have been preferable), the client charm reaches inside and calls the register() function directly. That has resulted in a dependency on register()'s API which was not enforced via testing or documented in register()'s docstring.

This branch restores the API the charm depends on, adds documentation as to its meaning and importance, and adds tests that will warn us if the API is broken in the future.

To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

+1. I have some minor inline comment on style.

review: Approve
814. By Benji York

A few small review changes:

- tweak a test so as to record the fact that a function got called
  and then assert that it didn't instead of making it call
  self.fail() when called
- add some commentary about the charm's use of register() in an
  additional place

Revision history for this message
Benji York (benji) :
Revision history for this message
Adam Collard (adam-collard) wrote :

I don't see how this change will make the charm work

Charm code hooks/common.py ~ line 171

            register(config, on_error=error_handler.flag_error)

This branch will fall over because there is no reactor being passed, the docstring suggests it should only be passed if you're doing crazy things, but it's a positional argument (!).

review: Needs Fixing
815. By Benji York

make providing a reactor optional (for the client charm)

Revision history for this message
Adam Collard (adam-collard) :
Revision history for this message
Adam Collard (adam-collard) wrote :

Confirmed that a deployment of this branch with trunk landscape-client charm worked fine

cat > client-config.yaml <<EOF
landscape-client:
  origin: lp:~benji/landscape-client/bug-1428826-restore-register-function-public-API
  account-name: adam-collard
EOF

juju deploy landscape-client --config client-config.yaml
juju add-relation landscape-client postgresql

Minor docstring fixes inline from previous comment

review: Approve
816. By Benji York

fix docstring/comment bugs

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 all changes: