Merge lp:~ubuntuone-pqm-team/charm-tools/trunk into lp:~charmers/charm-tools/trunk
- trunk
- Merge into trunk
Proposed by
Sidnei da Silva
Status: | Merged |
---|---|
Approved by: | Mark Mims |
Approved revision: | 174 |
Merged at revision: | 173 |
Proposed branch: | lp:~ubuntuone-pqm-team/charm-tools/trunk |
Merge into: | lp:~charmers/charm-tools/trunk |
Diff against target: |
553 lines (+114/-131) 8 files modified
Makefile (+1/-1) helpers/python/charmhelpers/__init__.py (+24/-25) helpers/python/charmhelpers/tests/test_charmhelpers.py (+27/-44) scripts/create (+3/-2) scripts/promulgate (+13/-13) scripts/review (+4/-4) scripts/review-queue (+22/-23) scripts/subscribers (+20/-19) |
To merge this branch: | bzr merge lp:~ubuntuone-pqm-team/charm-tools/trunk |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mark Mims (community) | Approve | ||
Review via email: mp+156709@code.launchpad.net |
Commit message
Fix pep8 issues which caused the build to fail on raring, since raring pep8 is more nosy.
Description of the change
Fix pep8 issues which caused the build to fail on raring, since raring pep8 is more nosy.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile' |
2 | --- Makefile 2013-02-25 21:54:26 +0000 |
3 | +++ Makefile 2013-04-02 22:30:30 +0000 |
4 | @@ -36,4 +36,4 @@ |
5 | tests/create/test.sh |
6 | PYTHONPATH=helpers/python python helpers/python/charmhelpers/tests/test_charmhelpers.py |
7 | @echo PEP8 Lint of Python files |
8 | - pep8 ./ `grep -rl '^#!/.*python' .` |
9 | + @echo `grep -rl '^#!/.*python' .` | xargs -r -n1 pep8 |
10 | |
11 | === modified file 'helpers/python/charmhelpers/__init__.py' |
12 | --- helpers/python/charmhelpers/__init__.py 2013-02-25 21:40:13 +0000 |
13 | +++ helpers/python/charmhelpers/__init__.py 2013-04-02 22:30:30 +0000 |
14 | @@ -4,26 +4,25 @@ |
15 | """Helper functions for writing Juju charms in Python.""" |
16 | |
17 | __metaclass__ = type |
18 | -__all__ = [ |
19 | - 'get_config', |
20 | - 'log', |
21 | - 'log_entry', |
22 | - 'log_exit', |
23 | - 'relation_get', |
24 | - 'relation_set', |
25 | - 'relation_ids', |
26 | - 'relation_list', |
27 | - 'config_get', |
28 | - 'unit_get', |
29 | - 'open_port', |
30 | - 'close_port', |
31 | - 'service_control', |
32 | - 'unit_info', |
33 | - 'wait_for_machine', |
34 | - 'wait_for_page_contents', |
35 | - 'wait_for_relation', |
36 | - 'wait_for_unit', |
37 | - ] |
38 | +__all__ = ['get_config', |
39 | + 'log', |
40 | + 'log_entry', |
41 | + 'log_exit', |
42 | + 'relation_get', |
43 | + 'relation_set', |
44 | + 'relation_ids', |
45 | + 'relation_list', |
46 | + 'config_get', |
47 | + 'unit_get', |
48 | + 'open_port', |
49 | + 'close_port', |
50 | + 'service_control', |
51 | + 'unit_info', |
52 | + 'wait_for_machine', |
53 | + 'wait_for_page_contents', |
54 | + 'wait_for_relation', |
55 | + 'wait_for_unit', |
56 | + ] |
57 | |
58 | from collections import namedtuple |
59 | import json |
60 | @@ -31,8 +30,8 @@ |
61 | from shelltoolbox import ( |
62 | command, |
63 | script_name, |
64 | - run |
65 | - ) |
66 | + run, |
67 | +) |
68 | import tempfile |
69 | import time |
70 | import urllib2 |
71 | @@ -146,9 +145,9 @@ |
72 | |
73 | def configure_source(update=False): |
74 | source = config_get('source') |
75 | - if (source.startswith('ppa:') or |
76 | - source.startswith('cloud:') or |
77 | - source.startswith('http:')): |
78 | + if ((source.startswith('ppa:') or |
79 | + source.startswith('cloud:') or |
80 | + source.startswith('http:'))): |
81 | run('add-apt-repository', source) |
82 | if source.startswith("http:"): |
83 | run('apt-key', 'import', config_get('key')) |
84 | |
85 | === modified file 'helpers/python/charmhelpers/tests/test_charmhelpers.py' |
86 | --- helpers/python/charmhelpers/tests/test_charmhelpers.py 2013-03-15 15:54:29 +0000 |
87 | +++ helpers/python/charmhelpers/tests/test_charmhelpers.py 2013-04-02 22:30:30 +0000 |
88 | @@ -36,16 +36,12 @@ |
89 | """Generate valid juju status dict and return it.""" |
90 | machine_data = {} |
91 | # The 0th machine is the Zookeeper. |
92 | - machine_data[0] = { |
93 | - 'dns-name': 'zookeeper.example.com', |
94 | - 'instance-id': 'machine0', |
95 | - 'state': 'not-started', |
96 | - } |
97 | - service_data = { |
98 | - 'charm': 'local:precise/{}-1'.format(service_name), |
99 | - 'relations': {}, |
100 | - 'units': {}, |
101 | - } |
102 | + machine_data[0] = {'dns-name': 'zookeeper.example.com', |
103 | + 'instance-id': 'machine0', |
104 | + 'state': 'not-started'} |
105 | + service_data = {'charm': 'local:precise/{}-1'.format(service_name), |
106 | + 'relations': {}, |
107 | + 'units': {}} |
108 | for i in range(num_units): |
109 | # The machine is always going to be i+1 because there |
110 | # will always be num_units+1 machines. |
111 | @@ -54,24 +50,18 @@ |
112 | 'dns-name': 'machine{}.example.com'.format(machine_number), |
113 | 'instance-id': 'machine{}'.format(machine_number), |
114 | 'state': machine_state, |
115 | - 'instance-state': machine_state, |
116 | - } |
117 | + 'instance-state': machine_state} |
118 | machine_data[machine_number] = unit_machine_data |
119 | unit_data = { |
120 | 'machine': machine_number, |
121 | 'public-address': |
122 | - '{}-{}.example.com'.format(service_name, i), |
123 | - 'relations': { |
124 | - 'db': {'state': 'up'}, |
125 | - }, |
126 | - 'agent-state': unit_state, |
127 | - } |
128 | + '{}-{}.example.com'.format(service_name, i), |
129 | + 'relations': {'db': {'state': 'up'}}, |
130 | + 'agent-state': unit_state} |
131 | service_data['units']['{}/{}'.format(service_name, i)] = ( |
132 | unit_data) |
133 | - juju_status_data = { |
134 | - 'machines': machine_data, |
135 | - 'services': {service_name: service_data}, |
136 | - } |
137 | + juju_status_data = {'machines': machine_data, |
138 | + 'services': {service_name: service_data}} |
139 | return juju_status_data |
140 | |
141 | def _make_juju_status_yaml(self, num_units=1, |
142 | @@ -116,21 +106,20 @@ |
143 | # as returned by relation-get $VAR. |
144 | mock_relation_values = { |
145 | 'foo': 'bar', |
146 | - 'spam': 'eggs', |
147 | - } |
148 | + 'spam': 'eggs'} |
149 | self._patch_command(lambda *args: mock_relation_values[args[0]]) |
150 | self.assertEqual('bar', charmhelpers.relation_get('foo')) |
151 | self.assertEqual('eggs', charmhelpers.relation_get('spam')) |
152 | |
153 | self._patch_command(lambda *args: mock_relation_values[args[2]]) |
154 | self.assertEqual('bar', |
155 | - charmhelpers.relation_get('foo', 'test', 'test:1')) |
156 | + charmhelpers.relation_get('foo', 'test', 'test:1')) |
157 | self.assertEqual('eggs', |
158 | - charmhelpers.relation_get('spam', 'test', 'test:1')) |
159 | + charmhelpers.relation_get('spam', 'test', 'test:1')) |
160 | |
161 | self._patch_command(lambda *args: '%s' % mock_relation_values) |
162 | self.assertEqual("{'foo': 'bar', 'spam': 'eggs'}", |
163 | - charmhelpers.relation_get()) |
164 | + charmhelpers.relation_get()) |
165 | |
166 | def test_relation_set(self): |
167 | # relation_set calls out to relation-set and passes key=value |
168 | @@ -149,9 +138,7 @@ |
169 | def test_relation_ids(self): |
170 | # relation_ids returns a list of relations id for the given |
171 | # named relation |
172 | - mock_relation_ids = { |
173 | - 'test': 'test:1 test:2' |
174 | - } |
175 | + mock_relation_ids = {'test': 'test:1 test:2'} |
176 | self._patch_command(lambda *args: mock_relation_ids[args[0]]) |
177 | self.assertEqual(mock_relation_ids['test'].split(), |
178 | charmhelpers.relation_ids('test')) |
179 | @@ -159,10 +146,8 @@ |
180 | def test_relation_list(self): |
181 | # relation_list returns a list of unit names either for the current |
182 | # context or for the provided relation ID |
183 | - mock_unit_names = { |
184 | - 'test:1': 'test/0 test/1 test/2', |
185 | - 'test:2': 'test/3 test/4 test/5' |
186 | - } |
187 | + mock_unit_names = {'test:1': 'test/0 test/1 test/2', |
188 | + 'test:2': 'test/3 test/4 test/5'} |
189 | |
190 | # Patch command for current context use base - context = test:1 |
191 | self._patch_command(lambda: mock_unit_names['test:1']) |
192 | @@ -209,9 +194,9 @@ |
193 | action = args[1] |
194 | if service not in commands_set: |
195 | commands_set[service] = [] |
196 | - if (len(commands_set[service]) > 1 and |
197 | - commands_set[service][-1] == 'stop' and |
198 | - action == 'restart'): |
199 | + if ((len(commands_set[service]) > 1 and |
200 | + commands_set[service][-1] == 'stop' and |
201 | + action == 'restart')): |
202 | # Service is stopped - so needs 'start' |
203 | # action as restart will fail |
204 | commands_set[service].append(action) |
205 | @@ -231,11 +216,9 @@ |
206 | def test_make_charm_config_file(self): |
207 | # make_charm_config_file() writes the passed configuration to a |
208 | # temporary file as YAML. |
209 | - charm_config = { |
210 | - 'foo': 'bar', |
211 | - 'spam': 'eggs', |
212 | - 'ham': 'jam', |
213 | - } |
214 | + charm_config = {'foo': 'bar', |
215 | + 'spam': 'eggs', |
216 | + 'ham': 'jam'} |
217 | # make_charm_config_file() returns the file object so that it |
218 | # can be garbage collected properly. |
219 | charm_config_file = charmhelpers.make_charm_config_file(charm_config) |
220 | @@ -367,7 +350,7 @@ |
221 | mock_juju_status = lambda: juju_yaml |
222 | self.patch(charmhelpers, 'juju_status', mock_juju_status) |
223 | self.assertRaises(RuntimeError, charmhelpers.wait_for_unit, |
224 | - 'test-service', timeout=0) |
225 | + 'test-service', timeout=0) |
226 | |
227 | def test_wait_for_unit_raises_error_on_timeout(self): |
228 | # If the unit does not start before the timeout is reached, |
229 | @@ -377,7 +360,7 @@ |
230 | mock_juju_status = lambda: juju_yaml |
231 | self.patch(charmhelpers, 'juju_status', mock_juju_status) |
232 | self.assertRaises(RuntimeError, charmhelpers.wait_for_unit, |
233 | - 'test-service', timeout=0) |
234 | + 'test-service', timeout=0) |
235 | |
236 | def test_wait_for_relation_returns_if_relation_up(self): |
237 | # wait_for_relation() waits for relations to come up. If a |
238 | |
239 | === modified file 'scripts/create' |
240 | --- scripts/create 2013-02-25 21:54:26 +0000 |
241 | +++ scripts/create 2013-04-02 22:30:30 +0000 |
242 | @@ -55,7 +55,8 @@ |
243 | parser = argparse.ArgumentParser() |
244 | parser.add_argument('charmname', help='Name of charm to create.') |
245 | parser.add_argument('charmhome', nargs='?', |
246 | - help='Dir to create charm in. Defaults to CHARM_HOME env var or PWD') |
247 | + help='Dir to create charm in. Defaults to CHARM_HOME ' |
248 | + 'env var or PWD') |
249 | args = parser.parse_args() |
250 | |
251 | if args.charmhome: |
252 | @@ -77,7 +78,7 @@ |
253 | shutil.copytree(path.join(template_dir, 'charm'), output_dir) |
254 | |
255 | v = {'package': args.charmname, |
256 | - 'maintainer': '%s <%s>' % get_maintainer()} |
257 | + 'maintainer': '%s <%s>' % get_maintainer()} |
258 | |
259 | try: |
260 | c = apt.Cache() |
261 | |
262 | === modified file 'scripts/promulgate' |
263 | --- scripts/promulgate 2013-02-25 21:54:26 +0000 |
264 | +++ scripts/promulgate 2013-04-02 22:30:30 +0000 |
265 | @@ -83,7 +83,7 @@ |
266 | '-o', '--owner-branch', dest='promulgate_owner_branch', |
267 | action='store_true', default=False, |
268 | help='Promulgate a branch owned by a someone/group other than ' |
269 | - + '~charmers') |
270 | + '~charmers') |
271 | |
272 | return parser.parse_args() |
273 | |
274 | @@ -108,7 +108,7 @@ |
275 | if charm_proof == 100: |
276 | if ignore_warnings: |
277 | logging.info("ignore-warnings enabled ... Continuing with " |
278 | - + "warnings") |
279 | + "warnings") |
280 | elif force: |
281 | logging.info("force option enabled ... Continuing with warnings") |
282 | else: |
283 | @@ -169,11 +169,11 @@ |
284 | |
285 | def update_branch_info(charm_branch, branch_status, branch_reviewer): |
286 | logging.info("Setting status of %s to %s", charm_branch.bzr_identity, |
287 | - branch_status) |
288 | + branch_status) |
289 | charm_branch.lifecycle_status = branch_status |
290 | |
291 | logging.info("Setting reviewer of %s to %s", charm_branch.bzr_identity, |
292 | - branch_reviewer) |
293 | + branch_reviewer) |
294 | charm_branch.reviewer = branch_reviewer |
295 | |
296 | charm_branch.lp_save() |
297 | @@ -184,10 +184,10 @@ |
298 | lp_charm = charm_series.getSourcePackage(name=charm_name) |
299 | if charm_branch: |
300 | logging.info('Setting %s as the official branch for %s', |
301 | - charm_branch.bzr_identity, |
302 | - lp_charm.name) |
303 | + charm_branch.bzr_identity, |
304 | + lp_charm.name) |
305 | update_branch_info(charm_branch, OFFICIAL_BRANCH_STATUS, |
306 | - lp.people[REVIEW_TEAM_NAME]) |
307 | + lp.people[REVIEW_TEAM_NAME]) |
308 | else: |
309 | logging.info('Removing official branch for %s', lp_charm.name) |
310 | lp_charm.setBranch(branch=charm_branch, pocket=OFFICIAL_BRANCH_POCKET) |
311 | @@ -207,7 +207,7 @@ |
312 | def main(argv): |
313 | options, args = parse_options() |
314 | logging.basicConfig(level=log_level(options.verbose), |
315 | - format='%(levelname)s:%(message)s') |
316 | + format='%(levelname)s:%(message)s') |
317 | |
318 | if len(args): |
319 | charm_dir = args[0] |
320 | @@ -229,14 +229,14 @@ |
321 | if not is_valid_owner(charm_branch, options.promulgate_owner_branch): |
322 | logging.error(" Invalid branch owner: %s", branch_owner(charm_branch)) |
323 | logging.error(" Branch push location must be owned by '~charmers'\n" |
324 | - + " use `bzr push --remember lp:~charmers/charms/" |
325 | - + "<series>/<charm-name>/trunk`\n or override this " |
326 | - + "behavior using the '--owner-branch'" |
327 | - + " option") |
328 | + " use `bzr push --remember lp:~charmers/charms/" |
329 | + "<series>/<charm-name>/trunk`\n or override this " |
330 | + "behavior using the '--owner-branch'" |
331 | + " option") |
332 | return 1 |
333 | |
334 | update_official_charm_branch(lp, options.series, charm_branch, |
335 | - charm_name_from_metadata(charm_dir)) |
336 | + charm_name_from_metadata(charm_dir)) |
337 | |
338 | return 0 |
339 | |
340 | |
341 | === modified file 'scripts/review' |
342 | --- scripts/review 2013-02-25 21:54:26 +0000 |
343 | +++ scripts/review 2013-04-02 22:30:30 +0000 |
344 | @@ -29,11 +29,11 @@ |
345 | def parse_options(): |
346 | parser = argparse.ArgumentParser( |
347 | description="Review a charm by adding a comment to the corresponding" |
348 | - + " charm bug. The review comment can be passed as a --message" |
349 | - + " arg or via stdin") |
350 | + " charm bug. The review comment can be passed as a --message" |
351 | + " arg or via stdin") |
352 | |
353 | parser.add_argument('bug_id', |
354 | - help='The launchpad bug for the charm being reviewed.') |
355 | + help='The launchpad bug for the charm being reviewed.') |
356 | |
357 | parser.add_argument( |
358 | '--message', '-m', |
359 | @@ -86,7 +86,7 @@ |
360 | def main(argv): |
361 | args = parse_options() |
362 | logging.basicConfig(level=log_level(args.verbose), |
363 | - format='%(levelname)s:%(message)s') |
364 | + format='%(levelname)s:%(message)s') |
365 | |
366 | review_message = get_message(args.message) # before connecting to lp |
367 | |
368 | |
369 | === modified file 'scripts/review-queue' |
370 | --- scripts/review-queue 2013-02-25 21:54:26 +0000 |
371 | +++ scripts/review-queue 2013-04-02 22:30:30 +0000 |
372 | @@ -76,19 +76,20 @@ |
373 | def charm_review_queue(): |
374 | print "Connecting to launchpad..." |
375 | lp = Launchpad.login_anonymously('charm-tools', 'production', |
376 | - version='devel', launchpadlib_dir='~/.cache/launchpadlib') |
377 | + version='devel', |
378 | + launchpadlib_dir='~/.cache/launchpadlib') |
379 | charm = lp.distributions['charms'] |
380 | charmers = lp.people['charmers'] |
381 | charm_contributors = lp.people['charm-contributors'] |
382 | |
383 | print "Querying launchpad for bugs ..." |
384 | bugs = charm.searchTasks(tags=['new-formula', 'new-charm'], |
385 | - status=['New', 'Confirmed', 'Triaged', 'In Progress', |
386 | - 'Fix Committed'], |
387 | - tags_combinator="Any") |
388 | + status=['New', 'Confirmed', 'Triaged', |
389 | + 'In Progress', 'Fix Committed'], |
390 | + tags_combinator="Any") |
391 | charmers_bugs = charmers.searchTasks( |
392 | status=['New', 'Confirmed', 'Triaged', 'In Progress', |
393 | - 'Fix Committed']) |
394 | + 'Fix Committed']) |
395 | |
396 | print "Querying launchpad for proposals ..." |
397 | proposals = charmers.getRequestedReviews(status="Needs review") |
398 | @@ -105,14 +106,13 @@ |
399 | bug_created = datetime.datetime.strptime( |
400 | bug['date_created'].split('+')[0], "%Y-%m-%dT%H:%M:%S.%f") |
401 | entry_age = datetime.datetime.utcnow() - bug_created |
402 | - entry = { |
403 | - 'date_created': bug['date_created'].split("T")[0], |
404 | - 'age': str(entry_age).split('.')[0], |
405 | - 'summary': (entry_summary[:max_summary_length] + '...') |
406 | - if len(entry_summary) > max_summary_length else entry_summary, |
407 | - 'item': bug['web_link'], |
408 | - 'status': bug['status'], |
409 | - } |
410 | + entry = {'date_created': bug['date_created'].split("T")[0], |
411 | + 'age': str(entry_age).split('.')[0], |
412 | + 'summary': (entry_summary[:max_summary_length] + '...') |
413 | + if len(entry_summary) > max_summary_length else entry_summary, |
414 | + 'item': bug['web_link'], |
415 | + 'status': bug['status'], |
416 | + } |
417 | queue.append(entry) |
418 | |
419 | # Merge proposals in charmers group |
420 | @@ -124,15 +124,14 @@ |
421 | proposal_age = datetime.datetime.utcnow() - proposal_date_created |
422 | if proposal_summary is None: |
423 | proposal_summary = "Proposal" |
424 | - entry = { |
425 | - 'date_created': proposal['date_created'].split("T")[0], |
426 | - 'age': str(proposal_age).split('.')[0], |
427 | - 'summary': (proposal_summary[:max_summary_length] + '...') |
428 | - if len(proposal_summary) > max_summary_length |
429 | - else proposal_summary, |
430 | - 'item': proposal['web_link'], |
431 | - 'status': proposal['queue_status'], |
432 | - } |
433 | + entry = {'date_created': proposal['date_created'].split("T")[0], |
434 | + 'age': str(proposal_age).split('.')[0], |
435 | + 'summary': (proposal_summary[:max_summary_length] + '...') |
436 | + if len(proposal_summary) > max_summary_length |
437 | + else proposal_summary, |
438 | + 'item': proposal['web_link'], |
439 | + 'status': proposal['queue_status'], |
440 | + } |
441 | queue.append(entry) |
442 | |
443 | return(sorted(queue, key=lambda k: k['date_created'])) |
444 | @@ -140,7 +139,7 @@ |
445 | |
446 | def main(): |
447 | parser = argparse.ArgumentParser( |
448 | - description="Shows items needing the attention of ~charmers") |
449 | + description="Shows items needing the attention of ~charmers") |
450 | parser.parse_args() |
451 | review_queue = charm_review_queue() |
452 | keys = ['date_created', 'age', 'summary', 'item', 'status'] |
453 | |
454 | === modified file 'scripts/subscribers' |
455 | --- scripts/subscribers 2013-02-25 21:54:26 +0000 |
456 | +++ scripts/subscribers 2013-04-02 22:30:30 +0000 |
457 | @@ -36,27 +36,28 @@ |
458 | in the specified repository so that metadata.yaml can be inspected |
459 | to find the maintainer.""") |
460 | parser.add_argument('--subscribed', default=False, action='store_true', |
461 | - help='Show maintainers who are properly subscribed instead of ' |
462 | - + 'unsubscribed') |
463 | + help='Show maintainers who are properly subscribed ' |
464 | + 'instead of unsubscribed') |
465 | parser.add_argument('--repository', default=None, type=str, |
466 | - help='Repository to look for charms in. Defaults to $JUJU_REPOSITORY ' |
467 | - + 'or getcwd') |
468 | + help='Repository to look for charms in. Defaults to ' |
469 | + '$JUJU_REPOSITORY or getcwd') |
470 | parser.add_argument('--quiet', default=False, action='store_true', |
471 | - help='Hide everything except maintainer subscription lists.') |
472 | + help='Hide everything except maintainer subscription ' |
473 | + 'lists.') |
474 | parser.add_argument('--series', '-s', default=None, |
475 | - help='Which series of the charm store to run against. Defaults to ' |
476 | - + 'current dev focus') |
477 | + help='Which series of the charm store to run against. ' |
478 | + 'Defaults to current dev focus') |
479 | parser.add_argument('--maintainer', default=None, |
480 | - help='Limit output to this maintainer\'s charms only.') |
481 | + help='Limit output to this maintainer\'s charms only.') |
482 | parser.add_argument('--log-priority', default='WARNING') |
483 | parser.add_argument('--launchpad-instance', default='production') |
484 | parser.add_argument('--fix-unsubscribed', default=False, action='store_true', |
485 | - help='Add a bug subscription for any unsubscribed maintainers. Requires ' |
486 | - + '--maintainer') |
487 | + help='Add a bug subscription for any unsubscribed ' |
488 | + 'maintainers. Requires --maintainer') |
489 | parser.add_argument('--force-fix-all', default=False, action='store_true', |
490 | - help=argparse.SUPPRESS) |
491 | + help=argparse.SUPPRESS) |
492 | parser.add_argument('charms', default=[], nargs='*', |
493 | - help='Charms to check for subscriptions') |
494 | + help='Charms to check for subscriptions') |
495 | |
496 | args = parser.parse_args() |
497 | |
498 | @@ -79,14 +80,14 @@ |
499 | log_prio = logging.DEBUG |
500 | |
501 | logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', |
502 | - level=log_prio) |
503 | + level=log_prio) |
504 | |
505 | if args.quiet: |
506 | logging.disable(logging.WARNING) |
507 | |
508 | if args.maintainer is None and args.fix_unsubscribed: |
509 | warn('Running --fix-unsubscribed and without --maintainer is against' |
510 | - + ' policy.') |
511 | + ' policy.') |
512 | if not args.force_fix_all: |
513 | warn('Use --force-fix-all to override policy') |
514 | sys.exit(1) |
515 | @@ -103,7 +104,7 @@ |
516 | login = launchpad.Launchpad.login_anonymously |
517 | |
518 | lp = login(app_name, args.launchpad_instance, |
519 | - version='devel', launchpadlib_dir=launchpadlib_dir) |
520 | + version='devel', launchpadlib_dir=launchpadlib_dir) |
521 | |
522 | charmdistro = lp.distributions['charms'] |
523 | |
524 | @@ -132,11 +133,11 @@ |
525 | for charm_name in charms: |
526 | try: |
527 | with open('%s/%s/%s/metadata.yaml' % (repository, current_series, |
528 | - charm_name)) as mdata: |
529 | + charm_name)) as mdata: |
530 | mdata_parsed = yaml.safe_load(mdata) |
531 | except IOError: |
532 | warn('%s/%s has no metadata in charm repo' % (current_series, |
533 | - charm_name)) |
534 | + charm_name)) |
535 | continue |
536 | try: |
537 | maintainers = mdata_parsed['maintainer'] |
538 | @@ -153,7 +154,7 @@ |
539 | for m in maintainers] |
540 | if args.maintainer not in maints_by_email: |
541 | debug('%s not in maintainer list %s' % (args.maintainer, |
542 | - maintainers)) |
543 | + maintainers)) |
544 | continue |
545 | |
546 | for maintainer in maintainers: |
547 | @@ -178,5 +179,5 @@ |
548 | print msg |
549 | if args.fix_unsubscribed: |
550 | info('adding bug subscription to %s for %s' % (charm_name, |
551 | - maint_email)) |
552 | + maint_email)) |
553 | pkg.addBugSubscription(subscriber=lp_maintainer) |
lgtm