Enable E265 style check

block comment should start with '# '

Change-Id: Iffae1b10e81b12ca8455139eae609ddca5e8dd09
This commit is contained in:
Pavlo Shchelokovskyy 2014-12-14 20:26:38 +02:00
parent 8f801e29c8
commit 8415baf6cc
32 changed files with 97 additions and 98 deletions

View File

@ -152,7 +152,7 @@ class KeystoneClientV2(object):
if(len(username) > 64): if(len(username) > 64):
LOG.warn(_LW("Truncating the username %s to the last 64 " LOG.warn(_LW("Truncating the username %s to the last 64 "
"characters."), username) "characters."), username)
#get the last 64 characters of the username # get the last 64 characters of the username
username = username[-64:] username = username[-64:]
user = self.client.users.create(username, user = self.client.users.create(username,
password, password,

View File

@ -24,7 +24,7 @@ try:
from pyrax.exceptions import NotFound from pyrax.exceptions import NotFound
PYRAX_INSTALLED = True PYRAX_INSTALLED = True
except ImportError: except ImportError:
#Setup fake exception for testing without pyrax # Setup fake exception for testing without pyrax
class NotFound(Exception): class NotFound(Exception):
pass pass

View File

@ -32,7 +32,7 @@ try:
from pyrax.exceptions import NotFound # noqa from pyrax.exceptions import NotFound # noqa
PYRAX_INSTALLED = True PYRAX_INSTALLED = True
except ImportError: except ImportError:
#Setup fake exception for testing without pyrax # Setup fake exception for testing without pyrax
class NotFound(Exception): class NotFound(Exception):
pass pass
PYRAX_INSTALLED = False PYRAX_INSTALLED = False
@ -860,8 +860,8 @@ class CloudLoadBalancer(resource.Resource):
% self.HALF_CLOSED) % self.HALF_CLOSED)
raise exception.StackValidationFailed(message=message) raise exception.StackValidationFailed(message=message)
#health_monitor connect and http types require completely different # health_monitor connect and http types require completely different
#schema # schema
if self.properties.get(self.HEALTH_MONITOR): if self.properties.get(self.HEALTH_MONITOR):
prop_val = self.properties[self.HEALTH_MONITOR] prop_val = self.properties[self.HEALTH_MONITOR]
health_monitor = self._remove_none(prop_val) health_monitor = self._remove_none(prop_val)

View File

@ -404,7 +404,7 @@ class LoadBalancerTest(common.HeatTestCase):
self.m.VerifyAll() self.m.VerifyAll()
def test_alter_properties(self): def test_alter_properties(self):
#test alter properties functions # test alter properties functions
template = self._set_template(self.lb_template, template = self._set_template(self.lb_template,
sessionPersistence='HTTP_COOKIE', sessionPersistence='HTTP_COOKIE',
connectionLogging=True, connectionLogging=True,
@ -455,7 +455,7 @@ class LoadBalancerTest(common.HeatTestCase):
self.assertIn("Must specify VIP type and version", str(exc)) self.assertIn("Must specify VIP type and version", str(exc))
def test_validate_half_closed(self): def test_validate_half_closed(self):
#test failure (invalid protocol) # test failure (invalid protocol)
template = self._set_template(self.lb_template, halfClosed=True) template = self._set_template(self.lb_template, halfClosed=True)
expected = self._set_expected(self.expected_body, halfClosed=True) expected = self._set_expected(self.expected_body, halfClosed=True)
rsrc, fake_loadbalancer = self._mock_loadbalancer(template, rsrc, fake_loadbalancer = self._mock_loadbalancer(template,
@ -466,7 +466,7 @@ class LoadBalancerTest(common.HeatTestCase):
self.assertIn('The halfClosed property is only available for the TCP' self.assertIn('The halfClosed property is only available for the TCP'
' or TCP_CLIENT_FIRST protocols', str(exc)) ' or TCP_CLIENT_FIRST protocols', str(exc))
#test TCP protocol # test TCP protocol
template = self._set_template(template, protocol='TCP') template = self._set_template(template, protocol='TCP')
expected = self._set_expected(expected, protocol='TCP') expected = self._set_expected(expected, protocol='TCP')
rsrc, fake_loadbalancer = self._mock_loadbalancer(template, rsrc, fake_loadbalancer = self._mock_loadbalancer(template,
@ -474,7 +474,7 @@ class LoadBalancerTest(common.HeatTestCase):
expected) expected)
self.assertIsNone(rsrc.validate()) self.assertIsNone(rsrc.validate())
#test TCP_CLIENT_FIRST protocol # test TCP_CLIENT_FIRST protocol
template = self._set_template(template, template = self._set_template(template,
protocol='TCP_CLIENT_FIRST') protocol='TCP_CLIENT_FIRST')
expected = self._set_expected(expected, expected = self._set_expected(expected,
@ -485,7 +485,7 @@ class LoadBalancerTest(common.HeatTestCase):
self.assertIsNone(rsrc.validate()) self.assertIsNone(rsrc.validate())
def test_validate_health_monitor(self): def test_validate_health_monitor(self):
#test connect success # test connect success
health_monitor = { health_monitor = {
'type': 'CONNECT', 'type': 'CONNECT',
'attemptsBeforeDeactivation': 1, 'attemptsBeforeDeactivation': 1,
@ -502,8 +502,8 @@ class LoadBalancerTest(common.HeatTestCase):
self.assertIsNone(rsrc.validate()) self.assertIsNone(rsrc.validate())
#test connect failure # test connect failure
#bodyRegex is only valid for type 'HTTP(S)' # bodyRegex is only valid for type 'HTTP(S)'
health_monitor['bodyRegex'] = 'dfawefawe' health_monitor['bodyRegex'] = 'dfawefawe'
template = self._set_template(template, template = self._set_template(template,
healthMonitor=health_monitor) healthMonitor=health_monitor)
@ -516,7 +516,7 @@ class LoadBalancerTest(common.HeatTestCase):
rsrc.validate) rsrc.validate)
self.assertIn('Unknown Property bodyRegex', str(exc)) self.assertIn('Unknown Property bodyRegex', str(exc))
#test http fields # test http fields
health_monitor['type'] = 'HTTP' health_monitor['type'] = 'HTTP'
health_monitor['bodyRegex'] = 'bodyRegex' health_monitor['bodyRegex'] = 'bodyRegex'
health_monitor['statusRegex'] = 'statusRegex' health_monitor['statusRegex'] = 'statusRegex'
@ -539,7 +539,7 @@ class LoadBalancerTest(common.HeatTestCase):
'secureTrafficOnly': True 'secureTrafficOnly': True
} }
#test ssl termination enabled without required fields failure # test ssl termination enabled without required fields failure
template = self._set_template(self.lb_template, template = self._set_template(self.lb_template,
sslTermination=ssl_termination) sslTermination=ssl_termination)
expected = self._set_expected(self.expected_body, expected = self._set_expected(self.expected_body,

View File

@ -53,7 +53,7 @@ def format_stack(req, stack, keys=None, tenant_safe=True):
yield (key, '_'.join((stack[rpc_api.STACK_ACTION], value))) yield (key, '_'.join((stack[rpc_api.STACK_ACTION], value)))
else: else:
# TODO(zaneb): ensure parameters can be formatted for XML # TODO(zaneb): ensure parameters can be formatted for XML
#elif key == rpc_api.STACK_PARAMETERS: # elif key == rpc_api.STACK_PARAMETERS:
# return key, json.dumps(value) # return key, json.dumps(value)
yield (key, value) yield (key, value)

View File

@ -1,4 +1,4 @@
#part-handler # part-handler
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain

View File

@ -111,8 +111,8 @@ class HeatException(Exception):
self.message = self.msg_fmt % kwargs self.message = self.msg_fmt % kwargs
except KeyError: except KeyError:
exc_info = sys.exc_info() exc_info = sys.exc_info()
#kwargs doesn't match a variable in the message # kwargs doesn't match a variable in the message
#log the issue and the kwargs # log the issue and the kwargs
LOG.exception(_LE('Exception in string format operation')) LOG.exception(_LE('Exception in string format operation'))
for name, value in six.iteritems(kwargs): for name, value in six.iteritems(kwargs):
LOG.error("%s: %s" % (name, value)) # noqa LOG.error("%s: %s" % (name, value)) # noqa
@ -159,7 +159,7 @@ class Forbidden(HeatException):
msg_fmt = _("You are not authorized to complete this action.") msg_fmt = _("You are not authorized to complete this action.")
#NOTE(bcwaldon): here for backwards-compatibility, need to deprecate. # NOTE(bcwaldon): here for backwards-compatibility, need to deprecate.
class NotAuthorized(Forbidden): class NotAuthorized(Forbidden):
msg_fmt = _("You are not authorized to complete this action.") msg_fmt = _("You are not authorized to complete this action.")

View File

@ -318,7 +318,7 @@ class KeystoneClientV3(object):
if(len(username) > 64): if(len(username) > 64):
LOG.warn(_LW("Truncating the username %s to the last 64 " LOG.warn(_LW("Truncating the username %s to the last 64 "
"characters."), username) "characters."), username)
#get the last 64 characters of the username # get the last 64 characters of the username
return username[-64:] return username[-64:]
def _get_domain_id_from_name(self, domain_name): def _get_domain_id_from_name(self, domain_name):

View File

@ -535,12 +535,12 @@ def is_json_content_type(request):
aws_content_type = request.params.get("ContentType") aws_content_type = request.params.get("ContentType")
except Exception: except Exception:
aws_content_type = None aws_content_type = None
#respect aws_content_type when both available # respect aws_content_type when both available
content_type = aws_content_type or request.content_type content_type = aws_content_type or request.content_type
else: else:
content_type = request.content_type content_type = request.content_type
#bug #1887882 # bug #1887882
#for back compatible for null or plain content type # for back compatible for null or plain content type
if not content_type or content_type.startswith('text/plain'): if not content_type or content_type.startswith('text/plain'):
content_type = 'application/json' content_type = 'application/json'
if content_type in ('JSON', 'application/json')\ if content_type in ('JSON', 'application/json')\

View File

@ -33,5 +33,5 @@ def downgrade(migrate_engine):
try: try:
resource.c.id.alter(sqlalchemy.Integer, primary_key=True) resource.c.id.alter(sqlalchemy.Integer, primary_key=True)
except Exception: except Exception:
#XXX: since there is no way to downgrade just passing # NOTE(sshturm): since there is no way to downgrade just passing
pass pass

View File

@ -98,11 +98,11 @@ def upgrade(migrate_engine):
def upgrade_sqlite(migrate_engine): def upgrade_sqlite(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine) meta = sqlalchemy.MetaData(bind=migrate_engine)
#(pafuent) Here it isn't recommended to import the table from the models, # (pafuent) Here it isn't recommended to import the table from the models,
#because in future migrations the model could change and this migration # because in future migrations the model could change and this migration
#could fail. # could fail.
#I know it is ugly but it's the only way that I found to 'freeze' the model # I know it is ugly but it's the only way that I found to 'freeze'
#state for this migration. # the model state for this migration.
stack_table = sqlalchemy.Table('stack', meta, autoload=True) stack_table = sqlalchemy.Table('stack', meta, autoload=True)
event_table = sqlalchemy.Table( event_table = sqlalchemy.Table(
'new_event', meta, 'new_event', meta,
@ -193,11 +193,11 @@ def downgrade(migrate_engine):
def downgrade_sqlite(migrate_engine): def downgrade_sqlite(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine) meta = sqlalchemy.MetaData(bind=migrate_engine)
#(pafuent) Here it isn't recommended to import the table from the models, # (pafuent) Here it isn't recommended to import the table from the models,
#because in future migrations the model could change and this migration # because in future migrations the model could change and this migration
#could fail. # could fail.
#I know it is ugly but it's the only way that I found to 'freeze' the model # I know it is ugly but it's the only way that I found to 'freeze'
#state for this migration. # the model state for this migration.
stack_table = sqlalchemy.Table('stack', meta, autoload=True) stack_table = sqlalchemy.Table('stack', meta, autoload=True)
event_table = sqlalchemy.Table( event_table = sqlalchemy.Table(
'new_event', meta, 'new_event', meta,

View File

@ -61,7 +61,7 @@ class GetAZs(function.Function):
def result(self): def result(self):
# TODO(therve): Implement region scoping # TODO(therve): Implement region scoping
#region = function.resolve(self.args) # region = function.resolve(self.args)
if self.stack is None: if self.stack is None:
return ['nova'] return ['nova']

View File

@ -73,7 +73,7 @@ class HOTemplate20130523(template.Template):
def __getitem__(self, section): def __getitem__(self, section):
""""Get the relevant section in the template.""" """"Get the relevant section in the template."""
#first translate from CFN into HOT terminology if necessary # first translate from CFN into HOT terminology if necessary
if section not in self.SECTIONS: if section not in self.SECTIONS:
section = HOTemplate20130523._translate( section = HOTemplate20130523._translate(
section, self._CFN_TO_HOT_SECTIONS, section, self._CFN_TO_HOT_SECTIONS,

View File

@ -43,7 +43,7 @@ class ParameterGroups(object):
LOG.debug('Validating Parameter Groups.') LOG.debug('Validating Parameter Groups.')
LOG.debug(self.parameter_names) LOG.debug(self.parameter_names)
if self.parameter_groups is not None: if self.parameter_groups is not None:
#Loop through groups and validate parameters # Loop through groups and validate parameters
grouped_parameters = [] grouped_parameters = []
for group in self.parameter_groups: for group in self.parameter_groups:
parameters = group.get(PARAMETERS) parameters = group.get(PARAMETERS)
@ -54,7 +54,7 @@ class ParameterGroups(object):
'each Parameter Group.')) 'each Parameter Group.'))
for param in parameters: for param in parameters:
#Check if param has been added to a previous group # Check if param has been added to a previous group
if param in grouped_parameters: if param in grouped_parameters:
raise exception.StackValidationFailed(message=_( raise exception.StackValidationFailed(message=_(
'The %s parameter must be assigned to one ' 'The %s parameter must be assigned to one '
@ -62,7 +62,7 @@ class ParameterGroups(object):
else: else:
grouped_parameters.append(param) grouped_parameters.append(param)
#Check that grouped parameter references a valid Parameter # Check that grouped parameter references a valid Parameter
if param not in self.parameter_names: if param not in self.parameter_names:
raise exception.StackValidationFailed(message=_( raise exception.StackValidationFailed(message=_(
'The Parameter name (%s) does not reference ' 'The Parameter name (%s) does not reference '

View File

@ -132,7 +132,7 @@ class SubnetRouteTableAssociation(resource.Resource):
router_id = self.properties.get(self.ROUTE_TABLE_ID) router_id = self.properties.get(self.ROUTE_TABLE_ID)
#remove the default router association for this subnet. # remove the default router association for this subnet.
try: try:
previous_router = self._router_for_subnet(subnet_id) previous_router = self._router_for_subnet(subnet_id)
if previous_router: if previous_router:

View File

@ -169,7 +169,7 @@ class SaharaCluster(resource.Resource):
return res return res
# check if running on neutron and MANAGEMENT_NETWORK missing # check if running on neutron and MANAGEMENT_NETWORK missing
#NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present # NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present
# overall stack validation will fail due to neutron.network constraint, # overall stack validation will fail due to neutron.network constraint,
# although the message will be not really relevant. # although the message will be not really relevant.
if (self.is_using_neutron() and if (self.is_using_neutron() and

View File

@ -24,7 +24,7 @@ from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
#NOTE(pshchelo): copied from sahara/utils/api_validator.py # NOTE(pshchelo): copied from sahara/utils/api_validator.py
SAHARA_NAME_REGEX = (r"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]" SAHARA_NAME_REGEX = (r"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]"
r"*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z]" r"*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z]"
r"[A-Za-z0-9\-]*[A-Za-z0-9])$") r"[A-Za-z0-9\-]*[A-Za-z0-9])$")
@ -213,7 +213,7 @@ class SaharaNodeGroupTemplate(resource.Resource):
res = super(SaharaNodeGroupTemplate, self).validate() res = super(SaharaNodeGroupTemplate, self).validate()
if res: if res:
return res return res
#NOTE(pshchelo): floating ip pool must be set for Neutron # NOTE(pshchelo): floating ip pool must be set for Neutron
if (self.is_using_neutron() and if (self.is_using_neutron() and
not self.properties.get(self.FLOATING_IP_POOL)): not self.properties.get(self.FLOATING_IP_POOL)):
msg = _("%s must be provided.") % self.FLOATING_IP_POOL msg = _("%s must be provided.") % self.FLOATING_IP_POOL
@ -372,7 +372,7 @@ class SaharaClusterTemplate(resource.Resource):
if res: if res:
return res return res
# check if running on neutron and MANAGEMENT_NETWORK missing # check if running on neutron and MANAGEMENT_NETWORK missing
#NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present # NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present
# overall stack validation will fail due to neutron.network constraint, # overall stack validation will fail due to neutron.network constraint,
# although the message will be not really relevant. # although the message will be not really relevant.
if (self.is_using_neutron() and if (self.is_using_neutron() and

View File

@ -19,7 +19,7 @@ def fake_translate_msgid(msgid, domain, desired_locale=None):
i18n.enable_lazy() i18n.enable_lazy()
#To ensure messages don't really get translated while running tests. # To ensure messages don't really get translated while running tests.
#As there are lots of places where matching is expected when comparing # As there are lots of places where matching is expected when comparing
#exception message(translated) with raw message. # exception message(translated) with raw message.
i18n._translate_msgid = fake_translate_msgid i18n._translate_msgid = fake_translate_msgid

View File

@ -139,7 +139,7 @@ class HeatMigrationsCheckers(test_migrations.WalkVersionsMixin,
self.assertColumnExists(engine, 'raw_template', 'files') self.assertColumnExists(engine, 'raw_template', 'files')
def _pre_upgrade_035(self, engine): def _pre_upgrade_035(self, engine):
#The stacks id are for the 33 version migration # The stacks id are for the 33 version migration
event_table = utils.get_table(engine, 'event') event_table = utils.get_table(engine, 'event')
data = [{ data = [{
'id': '22222222-152e-405d-b13a-35d4c816390c', 'id': '22222222-152e-405d-b13a-35d4c816390c',
@ -178,7 +178,7 @@ class HeatMigrationsCheckers(test_migrations.WalkVersionsMixin,
self.assertEqual(last_id, events_in_db[index].id) self.assertEqual(last_id, events_in_db[index].id)
self.assertEqual(event['id'], events_in_db[index].uuid) self.assertEqual(event['id'], events_in_db[index].uuid)
#Check that the autoincremental id is ok # Check that the autoincremental id is ok
data = [{ data = [{
'uuid': '33333333-152e-405d-b13a-35d4c816390c', 'uuid': '33333333-152e-405d-b13a-35d4c816390c',
'stack_id': '967aaefb-152e-405d-b13a-35d4c816390c', 'stack_id': '967aaefb-152e-405d-b13a-35d4c816390c',

View File

@ -195,7 +195,7 @@ class CeilometerAlarmTest(common.HeatTestCase):
Make sure that we can change the update-able properties Make sure that we can change the update-able properties
without replacing the Alarm rsrc. without replacing the Alarm rsrc.
''' '''
#short circuit the alarm's references # short circuit the alarm's references
t = template_format.parse(alarm_template) t = template_format.parse(alarm_template)
properties = t['Resources']['MEMAlarmHigh']['Properties'] properties = t['Resources']['MEMAlarmHigh']['Properties']
properties['alarm_actions'] = ['signal_handler'] properties['alarm_actions'] = ['signal_handler']

View File

@ -71,7 +71,7 @@ class CloudWatchAlarmTest(common.HeatTestCase):
''' '''
t = template_format.parse(alarm_template) t = template_format.parse(alarm_template)
#short circuit the alarm's references # short circuit the alarm's references
properties = t['Resources']['MEMAlarmHigh']['Properties'] properties = t['Resources']['MEMAlarmHigh']['Properties']
properties['AlarmActions'] = ['a'] properties['AlarmActions'] = ['a']
properties['Dimensions'] = [{'a': 'v'}] properties['Dimensions'] = [{'a': 'v'}]
@ -107,7 +107,7 @@ class CloudWatchAlarmTest(common.HeatTestCase):
''' '''
t = template_format.parse(alarm_template) t = template_format.parse(alarm_template)
#short circuit the alarm's references # short circuit the alarm's references
properties = t['Resources']['MEMAlarmHigh']['Properties'] properties = t['Resources']['MEMAlarmHigh']['Properties']
properties['AlarmActions'] = ['a'] properties['AlarmActions'] = ['a']
properties['Dimensions'] = [{'a': 'v'}] properties['Dimensions'] = [{'a': 'v'}]

View File

@ -603,11 +603,11 @@ class HOTemplateTest(common.HeatTestCase):
err_str = "can not be accessed directly" err_str = "can not be accessed directly"
#Hot template test # Hot template test
keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'parameters') keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'parameters')
self.assertIn(err_str, six.text_type(keyError)) self.assertIn(err_str, six.text_type(keyError))
#CFN template test # CFN template test
keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'Parameters') keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'Parameters')
self.assertIn(err_str, six.text_type(keyError)) self.assertIn(err_str, six.text_type(keyError))

View File

@ -164,13 +164,13 @@ class LifecyclePluginUtilsTests(common.HeatTestCase):
return return
def is_iterable(self, obj): def is_iterable(self, obj):
#special case string # special case string
if not object: if not object:
return False return False
if isinstance(obj, str): if isinstance(obj, str):
return False return False
#Test for iterabilityy # Test for iterabilityy
try: try:
for m in obj: for m in obj:
break break

View File

@ -148,10 +148,10 @@ class LoguserdataTest(common.HeatTestCase):
def test_main_fails(self): def test_main_fails(self):
#fail on ci version # fail on ci version
pkg_resources.get_distribution('cloud-init').AndReturn( pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.5.0')) FakeCiVersion('0.5.0'))
#fail on execute cfn-userdata # fail on execute cfn-userdata
pkg_resources.get_distribution('cloud-init').AndReturn( pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0')) FakeCiVersion('0.7.0'))

View File

@ -198,7 +198,7 @@ Resources:
'id': 'aaaa'} 'id': 'aaaa'}
} }
#create script # create script
sg_name = utils.PhysName('test_stack', 'the_sg') sg_name = utils.PhysName('test_stack', 'the_sg')
neutronclient.Client.create_security_group({ neutronclient.Client.create_security_group({
'security_group': { 'security_group': {
@ -540,7 +540,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_exception(self): def test_security_group_exception(self):
#create script # create script
sg_name = utils.PhysName('test_stack', 'the_sg') sg_name = utils.PhysName('test_stack', 'the_sg')
neutronclient.Client.create_security_group({ neutronclient.Client.create_security_group({
'security_group': { 'security_group': {

View File

@ -2211,7 +2211,7 @@ class StackTest(common.HeatTestCase):
def test_update_modify_ok_replace_int(self): def test_update_modify_ok_replace_int(self):
# create # create
#======== # ========
tmpl = {'heat_template_version': '2013-05-23', tmpl = {'heat_template_version': '2013-05-23',
'resources': {'AResource': { 'resources': {'AResource': {
'type': 'ResWithComplexPropsAndAttrs', 'type': 'ResWithComplexPropsAndAttrs',
@ -2242,7 +2242,7 @@ class StackTest(common.HeatTestCase):
self.m.ReplayAll() self.m.ReplayAll()
# update 1 # update 1
#========== # ==========
self.stack = parser.Stack.load(self.ctx, stack_id=stack_id) self.stack = parser.Stack.load(self.ctx, stack_id=stack_id)
tmpl2 = {'heat_template_version': '2013-05-23', tmpl2 = {'heat_template_version': '2013-05-23',
@ -2257,7 +2257,7 @@ class StackTest(common.HeatTestCase):
self.stack.state) self.stack.state)
# update 2 # update 2
#========== # ==========
# reload the previous stack # reload the previous stack
self.stack = parser.Stack.load(self.ctx, stack_id=stack_id) self.stack = parser.Stack.load(self.ctx, stack_id=stack_id)
tmpl3 = {'heat_template_version': '2013-05-23', tmpl3 = {'heat_template_version': '2013-05-23',

View File

@ -532,7 +532,7 @@ class ProviderTemplateTest(common.HeatTestCase):
""" """
env = {'resource_registry': {'http://example.com/test.template': None, env = {'resource_registry': {'http://example.com/test.template': None,
'resources': {}}} 'resources': {}}}
#A KeyError will be thrown prior to this fix. # A KeyError will be thrown prior to this fix.
environment.Environment(env=env) environment.Environment(env=env)
def test_system_template_retrieve_by_file(self): def test_system_template_retrieve_by_file(self):

View File

@ -174,7 +174,7 @@ Resources:
self.assertEqual(metadata, dict(rsrc.metadata_get())) self.assertEqual(metadata, dict(rsrc.metadata_get()))
def stubout_nova_create_security_group(self): def stubout_nova_create_security_group(self):
#create script # create script
self.mock_no_neutron() self.mock_no_neutron()
nova.NovaClientPlugin._create().AndReturn(self.fc) nova.NovaClientPlugin._create().AndReturn(self.fc)
nova_sg.SecurityGroupManager.list().AndReturn([NovaSG( nova_sg.SecurityGroupManager.list().AndReturn([NovaSG(
@ -504,7 +504,7 @@ Resources:
neutronclient.Client.delete_security_group_rule('ffff').AndReturn(None) neutronclient.Client.delete_security_group_rule('ffff').AndReturn(None)
def test_security_group_nova(self): def test_security_group_nova(self):
#create script # create script
sg_name = self.stubout_nova_create_security_group() sg_name = self.stubout_nova_create_security_group()
# delete script # delete script
@ -522,7 +522,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_nova_bad_source_group(self): def test_security_group_nova_bad_source_group(self):
#create script # create script
self.mock_no_neutron() self.mock_no_neutron()
nova.NovaClientPlugin._create().AndReturn(self.fc) nova.NovaClientPlugin._create().AndReturn(self.fc)
nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([NovaSG( nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([NovaSG(
@ -582,7 +582,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_nova_exception(self): def test_security_group_nova_exception(self):
#create script # create script
self.mock_no_neutron() self.mock_no_neutron()
nova.NovaClientPlugin._create().AndReturn(self.fc) nova.NovaClientPlugin._create().AndReturn(self.fc)
sg_name = utils.PhysName('test_stack', 'the_sg') sg_name = utils.PhysName('test_stack', 'the_sg')
@ -700,7 +700,7 @@ Resources:
self.assertRaises(exception.EgressRuleNotAllowed, sg.validate) self.assertRaises(exception.EgressRuleNotAllowed, sg.validate)
def test_security_group_neutron(self): def test_security_group_neutron(self):
#create script # create script
self.stubout_neutron_create_security_group() self.stubout_neutron_create_security_group()
# delete script # delete script
@ -718,7 +718,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_neutron_exception(self): def test_security_group_neutron_exception(self):
#create script # create script
sg_name = utils.PhysName('test_stack', 'the_sg') sg_name = utils.PhysName('test_stack', 'the_sg')
neutronclient.Client.create_security_group({ neutronclient.Client.create_security_group({
'security_group': { 'security_group': {
@ -896,7 +896,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_nova_update(self): def test_security_group_nova_update(self):
#create script # create script
sg_name = self.stubout_nova_create_security_group() sg_name = self.stubout_nova_create_security_group()
# update script # update script
nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([ nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([
@ -955,7 +955,7 @@ Resources:
self.m.VerifyAll() self.m.VerifyAll()
def test_security_group_neutron_update(self): def test_security_group_neutron_update(self):
#create script # create script
self.stubout_neutron_create_security_group() self.stubout_neutron_create_security_group()
# update script # update script

View File

@ -726,8 +726,8 @@ class ServersTest(common.HeatTestCase):
self.m.ReplayAll() self.m.ReplayAll()
scheduler.TaskRunner(server.create)() scheduler.TaskRunner(server.create)()
#self.assertEqual('4567', server.access_key) # self.assertEqual('4567', server.access_key)
#self.assertEqual('8901', server.secret_key) # self.assertEqual('8901', server.secret_key)
self.assertEqual('1234', server._get_user_id()) self.assertEqual('1234', server._get_user_id())
self.assertTrue(stack.access_allowed('1234', 'WebServer')) self.assertTrue(stack.access_allowed('1234', 'WebServer'))
@ -2709,7 +2709,7 @@ class ServersTest(common.HeatTestCase):
update_template = copy.deepcopy(server.t) update_template = copy.deepcopy(server.t)
update_template['Properties']['image'] = 'Update Image' update_template['Properties']['image'] = 'Update Image'
#update # update
updater = scheduler.TaskRunner(server.update, update_template) updater = scheduler.TaskRunner(server.update, update_template)
self.assertRaises(resource.UpdateReplace, updater) self.assertRaises(resource.UpdateReplace, updater)
@ -2735,7 +2735,7 @@ class ServersTest(common.HeatTestCase):
update_template = copy.deepcopy(server.t) update_template = copy.deepcopy(server.t)
update_template['Properties']['image'] = 'Update Image' update_template['Properties']['image'] = 'Update Image'
#update # update
updater = scheduler.TaskRunner(server.update, update_template) updater = scheduler.TaskRunner(server.update, update_template)
err = self.assertRaises(exception.ResourceFailure, updater) err = self.assertRaises(exception.ResourceFailure, updater)
self.assertEqual('StackValidationFailed: Property error : WebServer: ' self.assertEqual('StackValidationFailed: Property error : WebServer: '

View File

@ -170,7 +170,7 @@ class SoftwareComponentValidationTest(common.HeatTestCase):
err_msg='Property configs not assigned') err_msg='Property configs not assigned')
), ),
# do not test until bug #1350840 # do not test until bug #1350840
#( # (
# 'empty_configs', # 'empty_configs',
# dict(snippet=''' # dict(snippet='''
# component: # component:
@ -181,7 +181,7 @@ class SoftwareComponentValidationTest(common.HeatTestCase):
# err=exception.StackValidationFailed, # err=exception.StackValidationFailed,
# err_msg='configs length (0) is out of range ' # err_msg='configs length (0) is out of range '
# '(min: 1, max: None)') # '(min: 1, max: None)')
#), # ),
( (
'invalid_configs', 'invalid_configs',
dict(snippet=''' dict(snippet='''

View File

@ -300,8 +300,8 @@ class SqlAlchemyTest(common.HeatTestCase):
# Test private_key property returns decrypted value # Test private_key property returns decrypted value
self.assertEqual("fake secret", cs.my_secret) self.assertEqual("fake secret", cs.my_secret)
#do this twice to verify that the orm does not commit the unencrypted # do this twice to verify that the orm does not commit the unencrypted
#value. # value.
self.assertEqual("fake secret", cs.my_secret) self.assertEqual("fake secret", cs.my_secret)
scheduler.TaskRunner(cs.destroy)() scheduler.TaskRunner(cs.destroy)()
@ -1331,13 +1331,13 @@ class DBAPIStackTest(common.HeatTestCase):
self.assertRaises(exception.NotFound, db_api.stack_delete, self.assertRaises(exception.NotFound, db_api.stack_delete,
self.ctx, stack_id) self.ctx, stack_id)
#Testing soft delete # Testing soft delete
ret_stack = db_api.stack_get(self.ctx, stack_id, show_deleted=True) ret_stack = db_api.stack_get(self.ctx, stack_id, show_deleted=True)
self.assertIsNotNone(ret_stack) self.assertIsNotNone(ret_stack)
self.assertEqual(stack_id, ret_stack.id) self.assertEqual(stack_id, ret_stack.id)
self.assertEqual('db_test_stack_name', ret_stack.name) self.assertEqual('db_test_stack_name', ret_stack.name)
#Testing child resources deletion # Testing child resources deletion
self.assertRaises(exception.NotFound, db_api.resource_get, self.assertRaises(exception.NotFound, db_api.resource_get,
self.ctx, resource.id) self.ctx, resource.id)
@ -1714,12 +1714,12 @@ class DBAPIResourceDataTest(common.HeatTestCase):
val = db_api.resource_data_get(self.resource, 'test_resource_key') val = db_api.resource_data_get(self.resource, 'test_resource_key')
self.assertEqual('test_value', val) self.assertEqual('test_value', val)
#Updating existing resource data # Updating existing resource data
create_resource_data(self.ctx, self.resource, value='foo') create_resource_data(self.ctx, self.resource, value='foo')
val = db_api.resource_data_get(self.resource, 'test_resource_key') val = db_api.resource_data_get(self.resource, 'test_resource_key')
self.assertEqual('foo', val) self.assertEqual('foo', val)
#Testing with encrypted value # Testing with encrypted value
create_resource_data(self.ctx, self.resource, create_resource_data(self.ctx, self.resource,
key='encryped_resource_key', redact=True) key='encryped_resource_key', redact=True)
val = db_api.resource_data_get(self.resource, 'encryped_resource_key') val = db_api.resource_data_get(self.resource, 'encryped_resource_key')
@ -1945,7 +1945,7 @@ class DBAPIWatchRuleTest(common.HeatTestCase):
self.assertRaises(exception.NotFound, db_api.watch_rule_delete, self.assertRaises(exception.NotFound, db_api.watch_rule_delete,
self.ctx, UUID2) self.ctx, UUID2)
#Testing associated watch data deletion # Testing associated watch data deletion
self.assertEqual([], db_api.watch_data_get_all(self.ctx)) self.assertEqual([], db_api.watch_data_get_all(self.ctx))

View File

@ -54,7 +54,6 @@ commands =
[flake8] [flake8]
# E251 unexpected spaces around keyword / parameter equals # E251 unexpected spaces around keyword / parameter equals
# E265 block comment should start with '# '
# F402 import shadowed by loop variable # F402 import shadowed by loop variable
# F812 list comprehension redefines variable # F812 list comprehension redefines variable
# H202 assertRaises Exception too broad # H202 assertRaises Exception too broad
@ -66,7 +65,7 @@ commands =
# H405 multi line docstring summary not separated with an empty line # H405 multi line docstring summary not separated with an empty line
# H803 no full stop at the end of the commit message # H803 no full stop at the end of the commit message
# H904 Wrap long lines in parentheses instead of a backslash # H904 Wrap long lines in parentheses instead of a backslash
ignore = E251,E265,F402,F812,H202,H233,H305,H307,H402,H404,H405,H803,H904 ignore = E251,F402,F812,H202,H233,H305,H307,H402,H404,H405,H803,H904
show-source = true show-source = true
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build
max-complexity=20 max-complexity=20