From 12c4b44cddf1c9b7b2fcc86402df67564eee342d Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 5 Feb 2014 20:30:39 +0100 Subject: [PATCH] Fix indentation errors found by Pep8 1.4.6+ As a preparation in order to switch to a newer Pep8 version in the future, fix the indentation errors that are missed by Pep8 1.4.5 due to bugs. Change-Id: I44d1a5194633d2992215fd0d1b740dfd0863e6f1 Closes-Bug: #1267994 --- heat/common/config.py | 5 +++-- heat/common/heat_keystoneclient.py | 5 +++-- heat/db/sqlalchemy/api.py | 16 ++++++++-------- heat/engine/resources/autoscaling.py | 13 +++++++------ heat/engine/resources/instance.py | 5 +++-- heat/engine/resources/s3.py | 2 +- heat/engine/resources/server.py | 2 +- heat/engine/resources/swift.py | 6 +++--- heat/engine/resources/template_resource.py | 8 ++++---- heat/engine/resources/user.py | 17 +++++++++-------- heat/engine/update.py | 4 ++-- heat/engine/watchrule.py | 10 +++++----- heat/tests/test_neutron_loadbalancer.py | 5 +++-- 13 files changed, 52 insertions(+), 46 deletions(-) diff --git a/heat/common/config.py b/heat/common/config.py index 44f11694a..0dda28a18 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -132,8 +132,9 @@ auth_password_opts = [ clients_opts = [ cfg.StrOpt('endpoint_type', default='publicURL', - help=_('Type of endpoint in Identity service catalog to use ' - 'for communication with the OpenStack service.')), + help=_( + 'Type of endpoint in Identity service catalog to use ' + 'for communication with the OpenStack service.')), cfg.StrOpt('ca_file', help=_('Optional CA cert file to use in SSL connections')), cfg.StrOpt('cert_file', diff --git a/heat/common/heat_keystoneclient.py b/heat/common/heat_keystoneclient.py index efc8191a2..582323aa4 100644 --- a/heat/common/heat_keystoneclient.py +++ b/heat/common/heat_keystoneclient.py @@ -239,8 +239,9 @@ class KeystoneClient(object): project=self.context.tenant_id) else: logger.error(_("Failed to add user %(user)s to role %(role)s, " - "check role exists!") % {'user': username, - 'role': self.conf.heat_stack_user_role}) + "check role exists!") % { + 'user': username, + 'role': self.conf.heat_stack_user_role}) return user.id diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index c657e28a8..a7e58a43a 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -384,8 +384,8 @@ def stack_update(context, stack_id, values): if not stack: raise exception.NotFound(_('Attempt to update a stack with id: ' '%(id)s %(msg)s') % { - 'id': stack_id, - 'msg': 'that does not exist'}) + 'id': stack_id, + 'msg': 'that does not exist'}) stack.update(values) stack.save(_session(context)) @@ -396,8 +396,8 @@ def stack_delete(context, stack_id): if not s: raise exception.NotFound(_('Attempt to delete a stack with id: ' '%(id)s %(msg)s') % { - 'id': stack_id, - 'msg': 'that does not exist'}) + 'id': stack_id, + 'msg': 'that does not exist'}) session = Session.object_session(s) @@ -581,8 +581,8 @@ def watch_rule_update(context, watch_id, values): if not wr: raise exception.NotFound(_('Attempt to update a watch with id: ' '%(id)s %(msg)s') % { - 'id': watch_id, - 'msg': 'that does not exist'}) + 'id': watch_id, + 'msg': 'that does not exist'}) wr.update(values) wr.save(_session(context)) @@ -593,8 +593,8 @@ def watch_rule_delete(context, watch_id): if not wr: raise exception.NotFound(_('Attempt to delete watch_rule: ' '%(id)s %(msg)s') % { - 'id': watch_id, - 'msg': 'that does not exist'}) + 'id': watch_id, + 'msg': 'that does not exist'}) session = Session.object_session(wr) for d in wr.watch_data: diff --git a/heat/engine/resources/autoscaling.py b/heat/engine/resources/autoscaling.py index ddbb75ee3..79810b43a 100644 --- a/heat/engine/resources/autoscaling.py +++ b/heat/engine/resources/autoscaling.py @@ -592,8 +592,8 @@ class AutoScalingGroup(InstanceGroup, CooldownMixin): if self._cooldown_inprogress(): logger.info(_("%(name)s NOT performing scaling adjustment, " "cooldown %(cooldown)s") % { - 'name': self.name, - 'cooldown': self.properties[self.COOLDOWN]}) + 'name': self.name, + 'cooldown': self.properties[self.COOLDOWN]}) return capacity = len(self.get_instances()) @@ -873,8 +873,8 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin): if self._cooldown_inprogress(): logger.info(_("%(name)s NOT performing scaling action, " "cooldown %(cooldown)s") % { - 'name': self.name, - 'cooldown': self.properties[self.COOLDOWN]}) + 'name': self.name, + 'cooldown': self.properties[self.COOLDOWN]}) return asgn_id = self.properties[self.AUTO_SCALING_GROUP_NAME] @@ -887,8 +887,9 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin): logger.info(_('%(name)s Alarm, adjusting Group %(group)s with id ' '%(asgn_id)s by %(filter)s') % { - 'name': self.name, 'group': group.name, 'asgn_id': asgn_id, - 'filter': self.properties[self.SCALING_ADJUSTMENT]}) + 'name': self.name, 'group': group.name, + 'asgn_id': asgn_id, + 'filter': self.properties[self.SCALING_ADJUSTMENT]}) group.adjust(int(self.properties[self.SCALING_ADJUSTMENT]), self.properties[self.ADJUSTMENT_TYPE]) diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index fcb2d53d2..9d16029dc 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -81,8 +81,9 @@ class Restarter(signal_responder.SignalResponder): victim = self._find_resource(self.properties[self.INSTANCE_ID]) if victim is None: logger.info(_('%(name)s Alarm, can not find instance ' - '%(instance)s') % {'name': self.name, - 'instance': self.properties[self.INSTANCE_ID]}) + '%(instance)s') % { + 'name': self.name, + 'instance': self.properties[self.INSTANCE_ID]}) return logger.info(_('%(name)s Alarm, restarting resource: %(victim)s') % { diff --git a/heat/engine/resources/s3.py b/heat/engine/resources/s3.py index 0faebbb6d..beb189155 100644 --- a/heat/engine/resources/s3.py +++ b/heat/engine/resources/s3.py @@ -113,7 +113,7 @@ class S3Bucket(resource.Resource): headers = self.tags_to_headers() logger.debug(_('S3Bucket create container %(container)s with headers ' '%(headers)s') % { - 'container': container, 'headers': headers}) + 'container': container, 'headers': headers}) if self.properties[self.WEBSITE_CONFIGURATION] is not None: sc = self.properties[self.WEBSITE_CONFIGURATION] index_doc = sc[self.WEBSITE_CONFIGURATION_INDEX_DOCUMENT] diff --git a/heat/engine/resources/server.py b/heat/engine/resources/server.py index 0cc4085c8..2da423a47 100644 --- a/heat/engine/resources/server.py +++ b/heat/engine/resources/server.py @@ -621,7 +621,7 @@ class Server(resource.Resource): server.get() logger.debug(_('%(name)s check_suspend_complete status ' '= %(status)s') % { - 'name': self.name, 'status': server.status}) + 'name': self.name, 'status': server.status}) if server.status in list(nova_utils.deferred_server_statuses + ['ACTIVE']): return server.status == 'SUSPENDED' diff --git a/heat/engine/resources/swift.py b/heat/engine/resources/swift.py index 95c410864..3378dcba5 100644 --- a/heat/engine/resources/swift.py +++ b/heat/engine/resources/swift.py @@ -111,9 +111,9 @@ class SwiftContainer(resource.Resource): logger.debug(_('SwiftContainer create container %(container)s with ' 'container headers %(container_headers)s and ' 'account headers %(account_headers)s') % { - 'container': container, - 'account_headers': account_headers, - 'container_headers': container_headers}) + 'container': container, + 'account_headers': account_headers, + 'container_headers': container_headers}) self.swift().put_container(container, container_headers) diff --git a/heat/engine/resources/template_resource.py b/heat/engine/resources/template_resource.py index 326b0c8b7..85f077ae5 100644 --- a/heat/engine/resources/template_resource.py +++ b/heat/engine/resources/template_resource.py @@ -179,8 +179,8 @@ class TemplateResource(stack_resource.StackResource): # Type mismatch msg = (_("Property %(n)s type mismatch between facade %(type)s" " (%(fs_type)s) and provider (%(ps_type)s)") % { - 'n': n, 'type': self.type(), - 'fs_type': fs.type, 'ps_type': ps.type}) + 'n': n, 'type': self.type(), + 'fs_type': fs.type, 'ps_type': ps.type}) raise exception.StackValidationFailed(message=msg) for n, ps in self.properties_schema.items(): @@ -188,14 +188,14 @@ class TemplateResource(stack_resource.StackResource): # Required property for template not present in facade msg = (_("Provider requires property %(n)s " "unknown in facade %(type)s") % { - 'n': n, 'type': self.type()}) + 'n': n, 'type': self.type()}) raise exception.StackValidationFailed(message=msg) for attr in facade_cls.attributes_schema: if attr not in self.attributes_schema: msg = (_("Attribute %(attr)s for facade %(type)s " "missing in provider") % { - 'attr': attr, 'type': self.type()}) + 'attr': attr, 'type': self.type()}) raise exception.StackValidationFailed(message=msg) def validate(self): diff --git a/heat/engine/resources/user.py b/heat/engine/resources/user.py index daed6057d..34fa701d0 100644 --- a/heat/engine/resources/user.py +++ b/heat/engine/resources/user.py @@ -89,7 +89,8 @@ class User(resource.Resource): except KeyError: logger.error(_("Policy %(policy)s does not exist in stack " "%(stack)s") % { - 'policy': policy, 'stack': self.stack.name}) + 'policy': policy, + 'stack': self.stack.name}) return False if not callable(getattr(policy_rsrc, 'access_allowed', None)): @@ -258,8 +259,8 @@ class AccessKey(resource.Resource): if not self.resource_id: logger.warn(_('could not get secret for %(username)s ' 'Error:%(msg)s') % { - 'username': self.properties[self.USER_NAME], - 'msg': "resource_id not yet set"}) + 'username': self.properties[self.USER_NAME], + 'msg': "resource_id not yet set"}) else: # First try to retrieve the secret from resource_data, but # for backwards compatibility, fall back to requesting from @@ -279,11 +280,11 @@ class AccessKey(resource.Resource): db_api.resource_data_set(self, 'credential_id', kp.id, redact=True) except Exception as ex: - logger.warn(_('could not get secret for %(username)s ' - 'Error:%(msg)s') % { - 'username': - self.properties[self.USER_NAME], - 'msg': str(ex)}) + logger.warn( + _('could not get secret for %(username)s ' + 'Error:%(msg)s') % { + 'username': self.properties[self.USER_NAME], + 'msg': str(ex)}) return self._secret or '000-000-000' diff --git a/heat/engine/update.py b/heat/engine/update.py index 95180df0b..bd276759d 100644 --- a/heat/engine/update.py +++ b/heat/engine/update.py @@ -135,8 +135,8 @@ class StackUpdate(object): else: logger.info(_("Resource %(res_name)s for stack %(stack_name)s" " updated") % { - 'res_name': res_name, - 'stack_name': self.existing_stack.name}) + 'res_name': res_name, + 'stack_name': self.existing_stack.name}) return yield self._create_resource(new_res) diff --git a/heat/engine/watchrule.py b/heat/engine/watchrule.py index e3e60aeab..7b6c449d6 100644 --- a/heat/engine/watchrule.py +++ b/heat/engine/watchrule.py @@ -78,7 +78,7 @@ class WatchRule(object): except Exception as ex: logger.warn(_('WatchRule.load (%(watch_name)s) db error ' '%(ex)s') % { - 'watch_name': watch_name, 'ex': str(ex)}) + 'watch_name': watch_name, 'ex': str(ex)}) if watch is None: raise exception.WatchRuleNotFound(watch_name=watch_name) else: @@ -310,7 +310,7 @@ class WatchRule(object): # so just ignore any data which doesn't contain MetricName logger.debug(_('Ignoring metric data (only accept %(metric)s) ' ': %(data)s') % { - 'metric': self.rule['MetricName'], 'data': data}) + 'metric': self.rule['MetricName'], 'data': data}) return watch_data = { @@ -346,12 +346,12 @@ class WatchRule(object): if actions: logger.debug(_("Overriding state %(self_state)s for watch " "%(name)s with %(state)s") % { - 'self_state': self.state, 'name': self.name, - 'state': state}) + 'self_state': self.state, 'name': self.name, + 'state': state}) else: logger.warning(_("Unable to override state %(state)s for " "watch %(name)s") % { - 'state': self.state, 'name': self.name}) + 'state': self.state, 'name': self.name}) return actions diff --git a/heat/tests/test_neutron_loadbalancer.py b/heat/tests/test_neutron_loadbalancer.py index 9456dfba8..dc36485cd 100644 --- a/heat/tests/test_neutron_loadbalancer.py +++ b/heat/tests/test_neutron_loadbalancer.py @@ -447,8 +447,9 @@ class PoolTest(HeatTestCase): 'protocol': u'HTTP', 'name': 'pool.vip', 'admin_state_up': True, 'subnet_id': u'sub123', 'pool_id': '5678', 'protocol_port': 80, - 'session_persistence': {'type': 'APP_COOKIE', - 'cookie_name': 'cookie'}}} + 'session_persistence': { + 'type': 'APP_COOKIE', + 'cookie_name': 'cookie'}}} ).AndReturn({'vip': {'id': 'xyz'}}) neutronclient.Client.show_pool('5678').AndReturn( {'pool': {'status': 'ACTIVE'}})