Merge lp:~nick-moffitt/charm-helpers/fix-arg-count into lp:charm-helpers

Proposed by Nick Moffitt
Status: Needs review
Proposed branch: lp:~nick-moffitt/charm-helpers/fix-arg-count
Merge into: lp:charm-helpers
Diff against target: 12 lines (+1/-1)
1 file modified
charmhelpers/core/services/base.py (+1/-1)
To merge this branch: bzr merge lp:~nick-moffitt/charm-helpers/fix-arg-count
Reviewer Review Type Date Requested Status
Alex Kavanagh Needs Fixing
Review via email: mp+324493@code.launchpad.net

Description of the change

Someone had changed the argument count logic at some point, seemingly forgetting that "self" is one of the arguments in an object's method.

To post a comment you must log in.
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

There are some tests around this in tests/core/test_services.py but (obviously?) none of them picked this up. It would be really good if we could have a test for this that picks up this problem and ensures that nobody will repeat the issue in the future.

review: Needs Fixing

Unmerged revisions

746. By Nick Moffitt

foo.bar(baz, quux) is three arguments, not two.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/core/services/base.py'
2--- charmhelpers/core/services/base.py 2016-07-06 14:41:05 +0000
3+++ charmhelpers/core/services/base.py 2017-05-23 16:26:07 +0000
4@@ -170,7 +170,7 @@
5 continue
6 remote_service = units[0].split('/')[0]
7 argspec = getargspec(provider.provide_data)
8- if len(argspec.args) > 1:
9+ if len(argspec.args) > 2:
10 data = provider.provide_data(remote_service, service_ready)
11 else:
12 data = provider.provide_data()

Subscribers

People subscribed via source and target branches