Merge lp://staging/~adeuring/charm-tools/empty-requires-spec into lp://staging/~charmers/charm-tools/trunk

Proposed by Abel Deuring
Status: Merged
Approved by: Marco Ceppi
Approved revision: 178
Merged at revision: 178
Proposed branch: lp://staging/~adeuring/charm-tools/empty-requires-spec
Merge into: lp://staging/~charmers/charm-tools/trunk
Diff against target: 364 lines (+258/-13)
14 files modified
scripts/lib/proof.py (+9/-13)
tests/charms/empty-requires/README (+1/-0)
tests/charms/empty-requires/copyright (+1/-0)
tests/charms/empty-requires/hooks/install (+5/-0)
tests/charms/empty-requires/hooks/relation-name-relation-broken (+2/-0)
tests/charms/empty-requires/hooks/relation-name-relation-changed (+9/-0)
tests/charms/empty-requires/hooks/relation-name-relation-departed (+5/-0)
tests/charms/empty-requires/hooks/relation-name-relation-joined (+5/-0)
tests/charms/empty-requires/hooks/start (+4/-0)
tests/charms/empty-requires/hooks/stop (+7/-0)
tests/charms/empty-requires/icon.svg (+198/-0)
tests/charms/empty-requires/metadata.yaml (+10/-0)
tests/charms/empty-requires/revision (+1/-0)
tests/proof/expected/empty-requires (+1/-0)
To merge this branch: bzr merge lp://staging/~adeuring/charm-tools/empty-requires-spec
Reviewer Review Type Date Requested Status
Marco Ceppi (community) Approve
Review via email: mp+162089@code.staging.launchpad.net

Description of the change

This branch fixes bug 1172822: charm proof raises an exception on empty requires.

The cause was simple: There is at least one charm that has a line like

requires:

in its metadata.yaml file.

The fix is quite simple: The function run() in scripts/lib/proof.py already checked if the metadata has the keys "requires", "provides", "peers"; if they do not exist, the script just continues (or emits a warning iin the case of a missing "provides" entry).

I changed the "try: metadata['requires']; except KeyError" blocks to metadata.get('provides') so that empty requires/provides/peers entries are treated like missing entries. The removal of try/except should also help to uncover failures caused by possible KeyErrors somewhere in check_relation_hooks(), which were also "silenced" by the try/except.

The test is basically cargo-culted from an existing test --let me know if I can simplify the test data.

To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

This LGTM!

review: Approve

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