diff -Nru charm-tools-0.3+bzr172/Makefile charm-tools-0.3+bzr174/Makefile --- charm-tools-0.3+bzr172/Makefile 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/Makefile 2013-04-02 22:16:08.000000000 +0000 @@ -36,4 +36,4 @@ tests/create/test.sh PYTHONPATH=helpers/python python helpers/python/charmhelpers/tests/test_charmhelpers.py @echo PEP8 Lint of Python files - pep8 ./ `grep -rl '^#!/.*python' .` + @echo `grep -rl '^#!/.*python' .` | xargs -r -n1 pep8 diff -Nru charm-tools-0.3+bzr172/debian/bzr-builder.manifest charm-tools-0.3+bzr174/debian/bzr-builder.manifest --- charm-tools-0.3+bzr172/debian/bzr-builder.manifest 2013-04-02 14:22:19.000000000 +0000 +++ charm-tools-0.3+bzr174/debian/bzr-builder.manifest 2013-04-02 22:16:10.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version 0.3+bzr172-ppa22 -lp:charm-tools revid:marco@ceppi.net-20130315160613-3nso2lctcmq05zmp +# bzr-builder format 0.3 deb-version 0.3+bzr174-ppa22 +lp:~ubuntuone-pqm-team/charm-tools/trunk revid:sidnei.da.silva@canonical.com-20130402213049-0q61l5huqbdf1x31 nest-part packaging lp:~ubuntuone-pqm-team/ubuntu/raring/charm-tools/raring debian debian revid:sidnei.da.silva@canonical.com-20130402141246-ewa6foye7xr1qvu9 diff -Nru charm-tools-0.3+bzr172/debian/changelog charm-tools-0.3+bzr174/debian/changelog --- charm-tools-0.3+bzr172/debian/changelog 2013-04-02 14:22:19.000000000 +0000 +++ charm-tools-0.3+bzr174/debian/changelog 2013-04-02 22:16:10.000000000 +0000 @@ -1,8 +1,8 @@ -charm-tools (0.3+bzr172-ppa22~raring1) raring; urgency=low +charm-tools (0.3+bzr174-ppa22~raring1) raring; urgency=low * Auto build. - -- Launchpad Package Builder Tue, 02 Apr 2013 14:22:19 +0000 + -- David Ames Tue, 02 Apr 2013 22:16:10 +0000 charm-tools (0.3+172-0ubuntu1) raring; urgency=low diff -Nru charm-tools-0.3+bzr172/helpers/python/charmhelpers/__init__.py charm-tools-0.3+bzr174/helpers/python/charmhelpers/__init__.py --- charm-tools-0.3+bzr172/helpers/python/charmhelpers/__init__.py 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/helpers/python/charmhelpers/__init__.py 2013-04-02 22:16:08.000000000 +0000 @@ -4,26 +4,25 @@ """Helper functions for writing Juju charms in Python.""" __metaclass__ = type -__all__ = [ - 'get_config', - 'log', - 'log_entry', - 'log_exit', - 'relation_get', - 'relation_set', - 'relation_ids', - 'relation_list', - 'config_get', - 'unit_get', - 'open_port', - 'close_port', - 'service_control', - 'unit_info', - 'wait_for_machine', - 'wait_for_page_contents', - 'wait_for_relation', - 'wait_for_unit', - ] +__all__ = ['get_config', + 'log', + 'log_entry', + 'log_exit', + 'relation_get', + 'relation_set', + 'relation_ids', + 'relation_list', + 'config_get', + 'unit_get', + 'open_port', + 'close_port', + 'service_control', + 'unit_info', + 'wait_for_machine', + 'wait_for_page_contents', + 'wait_for_relation', + 'wait_for_unit', + ] from collections import namedtuple import json @@ -31,8 +30,8 @@ from shelltoolbox import ( command, script_name, - run - ) + run, +) import tempfile import time import urllib2 @@ -146,9 +145,9 @@ def configure_source(update=False): source = config_get('source') - if (source.startswith('ppa:') or - source.startswith('cloud:') or - source.startswith('http:')): + if ((source.startswith('ppa:') or + source.startswith('cloud:') or + source.startswith('http:'))): run('add-apt-repository', source) if source.startswith("http:"): run('apt-key', 'import', config_get('key')) diff -Nru charm-tools-0.3+bzr172/helpers/python/charmhelpers/tests/test_charmhelpers.py charm-tools-0.3+bzr174/helpers/python/charmhelpers/tests/test_charmhelpers.py --- charm-tools-0.3+bzr172/helpers/python/charmhelpers/tests/test_charmhelpers.py 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/helpers/python/charmhelpers/tests/test_charmhelpers.py 2013-04-02 22:16:08.000000000 +0000 @@ -36,16 +36,12 @@ """Generate valid juju status dict and return it.""" machine_data = {} # The 0th machine is the Zookeeper. - machine_data[0] = { - 'dns-name': 'zookeeper.example.com', - 'instance-id': 'machine0', - 'state': 'not-started', - } - service_data = { - 'charm': 'local:precise/{}-1'.format(service_name), - 'relations': {}, - 'units': {}, - } + machine_data[0] = {'dns-name': 'zookeeper.example.com', + 'instance-id': 'machine0', + 'state': 'not-started'} + service_data = {'charm': 'local:precise/{}-1'.format(service_name), + 'relations': {}, + 'units': {}} for i in range(num_units): # The machine is always going to be i+1 because there # will always be num_units+1 machines. @@ -54,24 +50,18 @@ 'dns-name': 'machine{}.example.com'.format(machine_number), 'instance-id': 'machine{}'.format(machine_number), 'state': machine_state, - 'instance-state': machine_state, - } + 'instance-state': machine_state} machine_data[machine_number] = unit_machine_data unit_data = { 'machine': machine_number, 'public-address': - '{}-{}.example.com'.format(service_name, i), - 'relations': { - 'db': {'state': 'up'}, - }, - 'agent-state': unit_state, - } + '{}-{}.example.com'.format(service_name, i), + 'relations': {'db': {'state': 'up'}}, + 'agent-state': unit_state} service_data['units']['{}/{}'.format(service_name, i)] = ( unit_data) - juju_status_data = { - 'machines': machine_data, - 'services': {service_name: service_data}, - } + juju_status_data = {'machines': machine_data, + 'services': {service_name: service_data}} return juju_status_data def _make_juju_status_yaml(self, num_units=1, @@ -116,21 +106,20 @@ # as returned by relation-get $VAR. mock_relation_values = { 'foo': 'bar', - 'spam': 'eggs', - } + 'spam': 'eggs'} self._patch_command(lambda *args: mock_relation_values[args[0]]) self.assertEqual('bar', charmhelpers.relation_get('foo')) self.assertEqual('eggs', charmhelpers.relation_get('spam')) self._patch_command(lambda *args: mock_relation_values[args[2]]) self.assertEqual('bar', - charmhelpers.relation_get('foo', 'test', 'test:1')) + charmhelpers.relation_get('foo', 'test', 'test:1')) self.assertEqual('eggs', - charmhelpers.relation_get('spam', 'test', 'test:1')) + charmhelpers.relation_get('spam', 'test', 'test:1')) self._patch_command(lambda *args: '%s' % mock_relation_values) self.assertEqual("{'foo': 'bar', 'spam': 'eggs'}", - charmhelpers.relation_get()) + charmhelpers.relation_get()) def test_relation_set(self): # relation_set calls out to relation-set and passes key=value @@ -149,9 +138,7 @@ def test_relation_ids(self): # relation_ids returns a list of relations id for the given # named relation - mock_relation_ids = { - 'test': 'test:1 test:2' - } + mock_relation_ids = {'test': 'test:1 test:2'} self._patch_command(lambda *args: mock_relation_ids[args[0]]) self.assertEqual(mock_relation_ids['test'].split(), charmhelpers.relation_ids('test')) @@ -159,10 +146,8 @@ def test_relation_list(self): # relation_list returns a list of unit names either for the current # context or for the provided relation ID - mock_unit_names = { - 'test:1': 'test/0 test/1 test/2', - 'test:2': 'test/3 test/4 test/5' - } + mock_unit_names = {'test:1': 'test/0 test/1 test/2', + 'test:2': 'test/3 test/4 test/5'} # Patch command for current context use base - context = test:1 self._patch_command(lambda: mock_unit_names['test:1']) @@ -209,9 +194,9 @@ action = args[1] if service not in commands_set: commands_set[service] = [] - if (len(commands_set[service]) > 1 and - commands_set[service][-1] == 'stop' and - action == 'restart'): + if ((len(commands_set[service]) > 1 and + commands_set[service][-1] == 'stop' and + action == 'restart')): # Service is stopped - so needs 'start' # action as restart will fail commands_set[service].append(action) @@ -231,11 +216,9 @@ def test_make_charm_config_file(self): # make_charm_config_file() writes the passed configuration to a # temporary file as YAML. - charm_config = { - 'foo': 'bar', - 'spam': 'eggs', - 'ham': 'jam', - } + charm_config = {'foo': 'bar', + 'spam': 'eggs', + 'ham': 'jam'} # make_charm_config_file() returns the file object so that it # can be garbage collected properly. charm_config_file = charmhelpers.make_charm_config_file(charm_config) @@ -367,7 +350,7 @@ mock_juju_status = lambda: juju_yaml self.patch(charmhelpers, 'juju_status', mock_juju_status) self.assertRaises(RuntimeError, charmhelpers.wait_for_unit, - 'test-service', timeout=0) + 'test-service', timeout=0) def test_wait_for_unit_raises_error_on_timeout(self): # If the unit does not start before the timeout is reached, @@ -377,7 +360,7 @@ mock_juju_status = lambda: juju_yaml self.patch(charmhelpers, 'juju_status', mock_juju_status) self.assertRaises(RuntimeError, charmhelpers.wait_for_unit, - 'test-service', timeout=0) + 'test-service', timeout=0) def test_wait_for_relation_returns_if_relation_up(self): # wait_for_relation() waits for relations to come up. If a diff -Nru charm-tools-0.3+bzr172/scripts/create charm-tools-0.3+bzr174/scripts/create --- charm-tools-0.3+bzr172/scripts/create 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/scripts/create 2013-04-02 22:16:08.000000000 +0000 @@ -55,7 +55,8 @@ parser = argparse.ArgumentParser() parser.add_argument('charmname', help='Name of charm to create.') parser.add_argument('charmhome', nargs='?', - help='Dir to create charm in. Defaults to CHARM_HOME env var or PWD') + help='Dir to create charm in. Defaults to CHARM_HOME ' + 'env var or PWD') args = parser.parse_args() if args.charmhome: @@ -77,7 +78,7 @@ shutil.copytree(path.join(template_dir, 'charm'), output_dir) v = {'package': args.charmname, - 'maintainer': '%s <%s>' % get_maintainer()} + 'maintainer': '%s <%s>' % get_maintainer()} try: c = apt.Cache() diff -Nru charm-tools-0.3+bzr172/scripts/promulgate charm-tools-0.3+bzr174/scripts/promulgate --- charm-tools-0.3+bzr172/scripts/promulgate 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/scripts/promulgate 2013-04-02 22:16:08.000000000 +0000 @@ -83,7 +83,7 @@ '-o', '--owner-branch', dest='promulgate_owner_branch', action='store_true', default=False, help='Promulgate a branch owned by a someone/group other than ' - + '~charmers') + '~charmers') return parser.parse_args() @@ -108,7 +108,7 @@ if charm_proof == 100: if ignore_warnings: logging.info("ignore-warnings enabled ... Continuing with " - + "warnings") + "warnings") elif force: logging.info("force option enabled ... Continuing with warnings") else: @@ -169,11 +169,11 @@ def update_branch_info(charm_branch, branch_status, branch_reviewer): logging.info("Setting status of %s to %s", charm_branch.bzr_identity, - branch_status) + branch_status) charm_branch.lifecycle_status = branch_status logging.info("Setting reviewer of %s to %s", charm_branch.bzr_identity, - branch_reviewer) + branch_reviewer) charm_branch.reviewer = branch_reviewer charm_branch.lp_save() @@ -184,10 +184,10 @@ lp_charm = charm_series.getSourcePackage(name=charm_name) if charm_branch: logging.info('Setting %s as the official branch for %s', - charm_branch.bzr_identity, - lp_charm.name) + charm_branch.bzr_identity, + lp_charm.name) update_branch_info(charm_branch, OFFICIAL_BRANCH_STATUS, - lp.people[REVIEW_TEAM_NAME]) + lp.people[REVIEW_TEAM_NAME]) else: logging.info('Removing official branch for %s', lp_charm.name) lp_charm.setBranch(branch=charm_branch, pocket=OFFICIAL_BRANCH_POCKET) @@ -207,7 +207,7 @@ def main(argv): options, args = parse_options() logging.basicConfig(level=log_level(options.verbose), - format='%(levelname)s:%(message)s') + format='%(levelname)s:%(message)s') if len(args): charm_dir = args[0] @@ -229,14 +229,14 @@ if not is_valid_owner(charm_branch, options.promulgate_owner_branch): logging.error(" Invalid branch owner: %s", branch_owner(charm_branch)) logging.error(" Branch push location must be owned by '~charmers'\n" - + " use `bzr push --remember lp:~charmers/charms/" - + "//trunk`\n or override this " - + "behavior using the '--owner-branch'" - + " option") + " use `bzr push --remember lp:~charmers/charms/" + "//trunk`\n or override this " + "behavior using the '--owner-branch'" + " option") return 1 update_official_charm_branch(lp, options.series, charm_branch, - charm_name_from_metadata(charm_dir)) + charm_name_from_metadata(charm_dir)) return 0 diff -Nru charm-tools-0.3+bzr172/scripts/review charm-tools-0.3+bzr174/scripts/review --- charm-tools-0.3+bzr172/scripts/review 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/scripts/review 2013-04-02 22:16:08.000000000 +0000 @@ -29,11 +29,11 @@ def parse_options(): parser = argparse.ArgumentParser( description="Review a charm by adding a comment to the corresponding" - + " charm bug. The review comment can be passed as a --message" - + " arg or via stdin") + " charm bug. The review comment can be passed as a --message" + " arg or via stdin") parser.add_argument('bug_id', - help='The launchpad bug for the charm being reviewed.') + help='The launchpad bug for the charm being reviewed.') parser.add_argument( '--message', '-m', @@ -86,7 +86,7 @@ def main(argv): args = parse_options() logging.basicConfig(level=log_level(args.verbose), - format='%(levelname)s:%(message)s') + format='%(levelname)s:%(message)s') review_message = get_message(args.message) # before connecting to lp diff -Nru charm-tools-0.3+bzr172/scripts/review-queue charm-tools-0.3+bzr174/scripts/review-queue --- charm-tools-0.3+bzr172/scripts/review-queue 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/scripts/review-queue 2013-04-02 22:16:08.000000000 +0000 @@ -76,19 +76,20 @@ def charm_review_queue(): print "Connecting to launchpad..." lp = Launchpad.login_anonymously('charm-tools', 'production', - version='devel', launchpadlib_dir='~/.cache/launchpadlib') + version='devel', + launchpadlib_dir='~/.cache/launchpadlib') charm = lp.distributions['charms'] charmers = lp.people['charmers'] charm_contributors = lp.people['charm-contributors'] print "Querying launchpad for bugs ..." bugs = charm.searchTasks(tags=['new-formula', 'new-charm'], - status=['New', 'Confirmed', 'Triaged', 'In Progress', - 'Fix Committed'], - tags_combinator="Any") + status=['New', 'Confirmed', 'Triaged', + 'In Progress', 'Fix Committed'], + tags_combinator="Any") charmers_bugs = charmers.searchTasks( status=['New', 'Confirmed', 'Triaged', 'In Progress', - 'Fix Committed']) + 'Fix Committed']) print "Querying launchpad for proposals ..." proposals = charmers.getRequestedReviews(status="Needs review") @@ -105,14 +106,13 @@ bug_created = datetime.datetime.strptime( bug['date_created'].split('+')[0], "%Y-%m-%dT%H:%M:%S.%f") entry_age = datetime.datetime.utcnow() - bug_created - entry = { - 'date_created': bug['date_created'].split("T")[0], - 'age': str(entry_age).split('.')[0], - 'summary': (entry_summary[:max_summary_length] + '...') - if len(entry_summary) > max_summary_length else entry_summary, - 'item': bug['web_link'], - 'status': bug['status'], - } + entry = {'date_created': bug['date_created'].split("T")[0], + 'age': str(entry_age).split('.')[0], + 'summary': (entry_summary[:max_summary_length] + '...') + if len(entry_summary) > max_summary_length else entry_summary, + 'item': bug['web_link'], + 'status': bug['status'], + } queue.append(entry) # Merge proposals in charmers group @@ -124,15 +124,14 @@ proposal_age = datetime.datetime.utcnow() - proposal_date_created if proposal_summary is None: proposal_summary = "Proposal" - entry = { - 'date_created': proposal['date_created'].split("T")[0], - 'age': str(proposal_age).split('.')[0], - 'summary': (proposal_summary[:max_summary_length] + '...') - if len(proposal_summary) > max_summary_length - else proposal_summary, - 'item': proposal['web_link'], - 'status': proposal['queue_status'], - } + entry = {'date_created': proposal['date_created'].split("T")[0], + 'age': str(proposal_age).split('.')[0], + 'summary': (proposal_summary[:max_summary_length] + '...') + if len(proposal_summary) > max_summary_length + else proposal_summary, + 'item': proposal['web_link'], + 'status': proposal['queue_status'], + } queue.append(entry) return(sorted(queue, key=lambda k: k['date_created'])) @@ -140,7 +139,7 @@ def main(): parser = argparse.ArgumentParser( - description="Shows items needing the attention of ~charmers") + description="Shows items needing the attention of ~charmers") parser.parse_args() review_queue = charm_review_queue() keys = ['date_created', 'age', 'summary', 'item', 'status'] diff -Nru charm-tools-0.3+bzr172/scripts/subscribers charm-tools-0.3+bzr174/scripts/subscribers --- charm-tools-0.3+bzr172/scripts/subscribers 2013-04-02 14:22:17.000000000 +0000 +++ charm-tools-0.3+bzr174/scripts/subscribers 2013-04-02 22:16:08.000000000 +0000 @@ -36,27 +36,28 @@ in the specified repository so that metadata.yaml can be inspected to find the maintainer.""") parser.add_argument('--subscribed', default=False, action='store_true', - help='Show maintainers who are properly subscribed instead of ' - + 'unsubscribed') + help='Show maintainers who are properly subscribed ' + 'instead of unsubscribed') parser.add_argument('--repository', default=None, type=str, - help='Repository to look for charms in. Defaults to $JUJU_REPOSITORY ' - + 'or getcwd') + help='Repository to look for charms in. Defaults to ' + '$JUJU_REPOSITORY or getcwd') parser.add_argument('--quiet', default=False, action='store_true', - help='Hide everything except maintainer subscription lists.') + help='Hide everything except maintainer subscription ' + 'lists.') parser.add_argument('--series', '-s', default=None, - help='Which series of the charm store to run against. Defaults to ' - + 'current dev focus') + help='Which series of the charm store to run against. ' + 'Defaults to current dev focus') parser.add_argument('--maintainer', default=None, - help='Limit output to this maintainer\'s charms only.') + help='Limit output to this maintainer\'s charms only.') parser.add_argument('--log-priority', default='WARNING') parser.add_argument('--launchpad-instance', default='production') parser.add_argument('--fix-unsubscribed', default=False, action='store_true', - help='Add a bug subscription for any unsubscribed maintainers. Requires ' - + '--maintainer') + help='Add a bug subscription for any unsubscribed ' + 'maintainers. Requires --maintainer') parser.add_argument('--force-fix-all', default=False, action='store_true', - help=argparse.SUPPRESS) + help=argparse.SUPPRESS) parser.add_argument('charms', default=[], nargs='*', - help='Charms to check for subscriptions') + help='Charms to check for subscriptions') args = parser.parse_args() @@ -79,14 +80,14 @@ log_prio = logging.DEBUG logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', - level=log_prio) + level=log_prio) if args.quiet: logging.disable(logging.WARNING) if args.maintainer is None and args.fix_unsubscribed: warn('Running --fix-unsubscribed and without --maintainer is against' - + ' policy.') + ' policy.') if not args.force_fix_all: warn('Use --force-fix-all to override policy') sys.exit(1) @@ -103,7 +104,7 @@ login = launchpad.Launchpad.login_anonymously lp = login(app_name, args.launchpad_instance, - version='devel', launchpadlib_dir=launchpadlib_dir) + version='devel', launchpadlib_dir=launchpadlib_dir) charmdistro = lp.distributions['charms'] @@ -132,11 +133,11 @@ for charm_name in charms: try: with open('%s/%s/%s/metadata.yaml' % (repository, current_series, - charm_name)) as mdata: + charm_name)) as mdata: mdata_parsed = yaml.safe_load(mdata) except IOError: warn('%s/%s has no metadata in charm repo' % (current_series, - charm_name)) + charm_name)) continue try: maintainers = mdata_parsed['maintainer'] @@ -153,7 +154,7 @@ for m in maintainers] if args.maintainer not in maints_by_email: debug('%s not in maintainer list %s' % (args.maintainer, - maintainers)) + maintainers)) continue for maintainer in maintainers: @@ -178,5 +179,5 @@ print msg if args.fix_unsubscribed: info('adding bug subscription to %s for %s' % (charm_name, - maint_email)) + maint_email)) pkg.addBugSubscription(subscriber=lp_maintainer)