Edit backslashes for lines continuation
It is preferred to wrap long lines in parentheses and not a backslash for line continuation due to OpenStack Style Guidelines http://docs.openstack.org/developer/hacking/#general, paragraph 2 Change-Id: Ibfc1022f8e4704fe2040e63bb87322404cea35a4
This commit is contained in:
parent
bf20657824
commit
1f6ccf85e3
@ -1447,8 +1447,8 @@ class LoadBalancerTest(common.HeatTestCase):
|
||||
'intermediateCertificate': '', 'secureTrafficOnly': False}
|
||||
ssl_termination_api = copy.deepcopy(ssl_termination_template)
|
||||
lb_name = list(six.iterkeys(template['Resources']))[0]
|
||||
template['Resources'][lb_name]['Properties']['sslTermination'] = \
|
||||
ssl_termination_template
|
||||
template['Resources'][lb_name]['Properties']['sslTermination'] = (
|
||||
ssl_termination_template)
|
||||
# The SSL termination config is done post-creation, so no need
|
||||
# to modify self.expected_body
|
||||
rsrc, fake_lb = self._mock_loadbalancer(template,
|
||||
|
@ -857,8 +857,8 @@ class Resource(object):
|
||||
if self.status == self.FAILED:
|
||||
raise exception.UpdateReplace(self)
|
||||
|
||||
if check_init_complete and \
|
||||
(self.action == self.INIT and self.status == self.COMPLETE):
|
||||
if check_init_complete and (self.action == self.INIT
|
||||
and self.status == self.COMPLETE):
|
||||
raise exception.UpdateReplace(self)
|
||||
|
||||
if prev_resource is not None:
|
||||
@ -897,9 +897,9 @@ class Resource(object):
|
||||
with self.lock(engine_id):
|
||||
new_temp = template.Template.load(self.context, template_id)
|
||||
new_res_def = new_temp.resource_definitions(new_stack)[self.name]
|
||||
if self.stack.action == self.stack.ROLLBACK and \
|
||||
self.stack.status == self.stack.IN_PROGRESS \
|
||||
and self.replaced_by:
|
||||
action_rollback = self.stack.action == self.stack.ROLLBACK
|
||||
status_in_progress = self.stack.status == self.stack.IN_PROGRESS
|
||||
if action_rollback and status_in_progress and self.replaced_by:
|
||||
self.restore_prev_rsrc(convergence=True)
|
||||
runner = scheduler.TaskRunner(self.update, new_res_def)
|
||||
try:
|
||||
@ -1314,9 +1314,9 @@ class Resource(object):
|
||||
def _store(self, metadata=None):
|
||||
"""Create the resource in the database."""
|
||||
|
||||
properties_data_encrypted, properties_data = \
|
||||
properties_data_encrypted, properties_data = (
|
||||
resource_objects.Resource.encrypt_properties_data(
|
||||
self._stored_properties_data)
|
||||
self._stored_properties_data))
|
||||
if not self.root_stack_id:
|
||||
self.root_stack_id = self.stack.root_stack_id()
|
||||
try:
|
||||
@ -1360,9 +1360,9 @@ class Resource(object):
|
||||
self.status = status
|
||||
self.status_reason = reason
|
||||
|
||||
properties_data_encrypted, properties_data = \
|
||||
properties_data_encrypted, properties_data = (
|
||||
resource_objects.Resource.encrypt_properties_data(
|
||||
self._stored_properties_data)
|
||||
self._stored_properties_data))
|
||||
data = {
|
||||
'action': self.action,
|
||||
'status': self.status,
|
||||
|
@ -120,8 +120,8 @@ class ResourceChain(stack_resource.StackResource):
|
||||
# nested_stack.strict_validate = False
|
||||
nested_stack.validate()
|
||||
except Exception as ex:
|
||||
msg = _('Failed to validate nested template: %s') % \
|
||||
six.text_type(ex)
|
||||
msg = (_('Failed to validate nested template: %s')
|
||||
% six.text_type(ex))
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
||||
def handle_create(self):
|
||||
|
@ -495,8 +495,8 @@ class Port(neutron.NeutronResource):
|
||||
def restore_prev_rsrc(self, convergence=False):
|
||||
# In case of convergence, during rollback, the previous rsrc is
|
||||
# already selected and is being acted upon.
|
||||
prev_port = self if convergence else \
|
||||
self.stack._backup_stack().resources.get(self.name)
|
||||
bakup_resources = self.stack._backup_stack().resources
|
||||
prev_port = self if convergence else bakup_resources.get(self.name)
|
||||
fixed_ips = prev_port.data().get('port_fip', [])
|
||||
|
||||
props = {'fixed_ips': []}
|
||||
|
@ -136,8 +136,8 @@ class ServerNetworkMixin(object):
|
||||
is None):
|
||||
del pair[
|
||||
neutron_port.Port.ALLOWED_ADDRESS_PAIR_MAC_ADDRESS]
|
||||
kwargs[neutron_port.Port.ALLOWED_ADDRESS_PAIRS] = \
|
||||
allowed_address_pairs
|
||||
port_address_pairs = neutron_port.Port.ALLOWED_ADDRESS_PAIRS
|
||||
kwargs[port_address_pairs] = allowed_address_pairs
|
||||
|
||||
return kwargs
|
||||
|
||||
@ -393,8 +393,8 @@ class ServerNetworkMixin(object):
|
||||
|
||||
# In case of convergence, during rollback, the previous rsrc is
|
||||
# already selected and is being acted upon.
|
||||
prev_server = self if convergence else \
|
||||
self.stack._backup_stack().resources.get(self.name)
|
||||
backup_res = self.stack._backup_stack().resources.get(self.name)
|
||||
prev_server = self if convergence else backup_res
|
||||
|
||||
if convergence:
|
||||
rsrc, rsrc_owning_stack, stack = resource.Resource.load(
|
||||
|
@ -31,12 +31,11 @@ class SchedulerHintsMixin(object):
|
||||
if cfg.CONF.stack_scheduler_hints:
|
||||
if scheduler_hints is None:
|
||||
scheduler_hints = {}
|
||||
scheduler_hints[self.HEAT_ROOT_STACK_ID] = \
|
||||
self.stack.root_stack_id()
|
||||
scheduler_hints[self.HEAT_STACK_ID] = self.stack.id
|
||||
scheduler_hints[self.HEAT_STACK_NAME] = self.stack.name
|
||||
scheduler_hints[self.HEAT_PATH_IN_STACK] = \
|
||||
self.stack.path_in_stack()
|
||||
stack = self.stack
|
||||
scheduler_hints[self.HEAT_ROOT_STACK_ID] = stack.root_stack_id()
|
||||
scheduler_hints[self.HEAT_STACK_ID] = stack.id
|
||||
scheduler_hints[self.HEAT_STACK_NAME] = stack.name
|
||||
scheduler_hints[self.HEAT_PATH_IN_STACK] = stack.path_in_stack()
|
||||
scheduler_hints[self.HEAT_RESOURCE_NAME] = self.name
|
||||
scheduler_hints[self.HEAT_RESOURCE_UUID] = self.uuid
|
||||
return scheduler_hints
|
||||
|
@ -19,8 +19,8 @@ import mox
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.clients.os import ceilometer
|
||||
from heat.engine.resources.openstack.ceilometer.gnocchi import \
|
||||
alarm as gnocchi
|
||||
from heat.engine.resources.openstack.ceilometer.gnocchi import (
|
||||
alarm as gnocchi)
|
||||
from heat.engine import scheduler
|
||||
from heat.tests import common
|
||||
from heat.tests import utils
|
||||
|
@ -52,8 +52,8 @@ class CinderEncryptedVolumeTypeTest(common.HeatTestCase):
|
||||
self.cinderclient = mock.MagicMock()
|
||||
self.my_encrypted_vol_type.client = cinder
|
||||
cinder.return_value = self.cinderclient
|
||||
self.volume_encryption_types = \
|
||||
self.cinderclient.volume_encryption_types
|
||||
self.volume_encryption_types = (
|
||||
self.cinderclient.volume_encryption_types)
|
||||
|
||||
def test_resource_mapping(self):
|
||||
mapping = encrypted_volume_type.resource_mapping()
|
||||
|
@ -132,8 +132,8 @@ class ResourceChainTests(common.HeatTestCase):
|
||||
|
||||
# Setup
|
||||
tmpl_def = copy.deepcopy(TEMPLATE)
|
||||
res_list = \
|
||||
tmpl_def['resources']['test-chain']['properties']['resources']
|
||||
tmpl_res_prop = tmpl_def['resources']['test-chain']['properties']
|
||||
res_list = tmpl_res_prop['resources']
|
||||
res_list.append('OS::Heat::RandomString')
|
||||
|
||||
# Test
|
||||
@ -148,8 +148,8 @@ class ResourceChainTests(common.HeatTestCase):
|
||||
def test_validate_fake_resource_type(self):
|
||||
# Setup
|
||||
tmpl_def = copy.deepcopy(TEMPLATE)
|
||||
res_list = \
|
||||
tmpl_def['resources']['test-chain']['properties']['resources']
|
||||
tmpl_res_prop = tmpl_def['resources']['test-chain']['properties']
|
||||
res_list = tmpl_res_prop['resources']
|
||||
res_list.append('foo')
|
||||
|
||||
# Test
|
||||
|
@ -347,8 +347,8 @@ class ResourceGroupTest(common.HeatTestCase):
|
||||
}
|
||||
nested = resg._assemble_nested(['0', '1', '2']).t
|
||||
for res in nested['resources']:
|
||||
nested['resources'][res]['properties']['listprop'] = \
|
||||
list(nested['resources'][res]['properties']['listprop'])
|
||||
res_prop = nested['resources'][res]['properties']
|
||||
res_prop['listprop'] = list(res_prop['listprop'])
|
||||
self.assertEqual(expect, nested)
|
||||
|
||||
def test_custom_index_var(self):
|
||||
@ -372,8 +372,8 @@ class ResourceGroupTest(common.HeatTestCase):
|
||||
}
|
||||
}
|
||||
nested = resg._assemble_nested(['0']).t
|
||||
nested['resources']['0']['properties']['listprop'] = \
|
||||
list(nested['resources']['0']['properties']['listprop'])
|
||||
res_prop = nested['resources']['0']['properties']
|
||||
res_prop['listprop'] = list(res_prop['listprop'])
|
||||
self.assertEqual(expect, nested)
|
||||
|
||||
res_def = snip['Properties']['resource_def']
|
||||
@ -397,8 +397,8 @@ class ResourceGroupTest(common.HeatTestCase):
|
||||
}
|
||||
}
|
||||
nested = resg._assemble_nested(['0']).t
|
||||
nested['resources']['0']['properties']['listprop'] = \
|
||||
list(nested['resources']['0']['properties']['listprop'])
|
||||
res_prop = nested['resources']['0']['properties']
|
||||
res_prop['listprop'] = list(res_prop['listprop'])
|
||||
self.assertEqual(expect, nested)
|
||||
|
||||
def test_assemble_no_properties(self):
|
||||
|
@ -411,8 +411,8 @@ class TestMistralWorkflow(common.HeatTestCase):
|
||||
|
||||
def test_attributes(self):
|
||||
wf = self._create_resource('workflow', self.rsrc_defn, self.stack)
|
||||
self.mistral.workflows.get.return_value = \
|
||||
FakeWorkflow('test_stack-workflow-b5fiekfci3yc')
|
||||
self.mistral.workflows.get.return_value = (
|
||||
FakeWorkflow('test_stack-workflow-b5fiekfci3yc'))
|
||||
self.assertEqual({'name': 'test_stack-workflow-b5fiekfci3yc',
|
||||
'input': None}, wf.FnGetAtt('data'))
|
||||
self.assertEqual([], wf.FnGetAtt('executions'))
|
||||
@ -620,8 +620,9 @@ class TestMistralWorkflow(common.HeatTestCase):
|
||||
scheduler.TaskRunner(wf.signal, details)()
|
||||
call_args = self.mistral.executions.create.call_args
|
||||
args, _ = call_args
|
||||
expected_args = '{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", ' \
|
||||
'"name": "create_test_server", "flavor": "3"}'
|
||||
expected_args = (
|
||||
'{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", '
|
||||
'"name": "create_test_server", "flavor": "3"}')
|
||||
self.validate_json_inputs(args[1], expected_args)
|
||||
self.assertEqual({'executions': '12345'}, wf.data())
|
||||
# Updating the workflow changing "use_request_body_as_input" to
|
||||
@ -644,8 +645,9 @@ class TestMistralWorkflow(common.HeatTestCase):
|
||||
scheduler.TaskRunner(wf.signal, details)()
|
||||
call_args = self.mistral.executions.create.call_args
|
||||
args, _ = call_args
|
||||
expected_args = '{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", ' \
|
||||
'"name": "create_test_server", "flavor": "4"}'
|
||||
expected_args = (
|
||||
'{"image": "31d8eeaf-686e-4e95-bb27-765014b9f20b", '
|
||||
'"name": "create_test_server", "flavor": "4"}')
|
||||
self.validate_json_inputs(args[1], expected_args)
|
||||
self.assertEqual({'executions': '54321,12345', 'name':
|
||||
'test_stack-workflow-b5fiekdsa355'}, wf.data())
|
||||
|
@ -928,8 +928,8 @@ class ServersTest(common.HeatTestCase):
|
||||
return metadata_url, server
|
||||
|
||||
def test_server_create_software_config_poll_temp_url(self):
|
||||
metadata_url, server = \
|
||||
self._server_create_software_config_poll_temp_url()
|
||||
metadata_url, server = (
|
||||
self._server_create_software_config_poll_temp_url())
|
||||
|
||||
self.assertEqual({
|
||||
'os-collect-config': {
|
||||
@ -942,8 +942,8 @@ class ServersTest(common.HeatTestCase):
|
||||
|
||||
def test_server_create_software_config_poll_temp_url_metadata(self):
|
||||
md = {'os-collect-config': {'polling_interval': 10}}
|
||||
metadata_url, server = \
|
||||
self._server_create_software_config_poll_temp_url(md=md)
|
||||
metadata_url, server = (
|
||||
self._server_create_software_config_poll_temp_url(md=md))
|
||||
|
||||
self.assertEqual({
|
||||
'os-collect-config': {
|
||||
|
@ -85,8 +85,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
@mock.patch('swiftclient.client.Connection.put_container')
|
||||
def test_create_container_name(self, mock_put):
|
||||
# Setup
|
||||
self.t['Resources']['SwiftContainer']['Properties']['name'] = \
|
||||
'the_name'
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['name'] = 'the_name'
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
# Test
|
||||
@ -310,8 +310,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
mock_delete_container):
|
||||
# Setup
|
||||
container_name = utils.PhysName('test_stack', 'test_resource')
|
||||
self.t['Resources']['SwiftContainer']['Properties']['PurgeOnDelete'] \
|
||||
= True
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['PurgeOnDelete'] = True
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
get_return_values = [
|
||||
@ -344,8 +344,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
mock_delete_container):
|
||||
# Setup
|
||||
container_name = utils.PhysName('test_stack', 'test_resource')
|
||||
self.t['Resources']['SwiftContainer']['Properties']['PurgeOnDelete'] \
|
||||
= True
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['PurgeOnDelete'] = True
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
mock_get.return_value = ({'name': container_name},
|
||||
@ -376,8 +376,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
mock_delete_object):
|
||||
# Setup
|
||||
container_name = utils.PhysName('test_stack', 'test_resource')
|
||||
self.t['Resources']['SwiftContainer']['Properties']['PurgeOnDelete'] \
|
||||
= True
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['PurgeOnDelete'] = True
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
mock_get.return_value = ({'name': container_name},
|
||||
@ -419,8 +419,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
@mock.patch('swiftclient.client.Connection.put_container')
|
||||
def test_check(self, mock_put, mock_get):
|
||||
# Setup
|
||||
self.t['Resources']['SwiftContainer']['Properties']['PurgeOnDelete'] \
|
||||
= True
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['PurgeOnDelete'] = True
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
# Test
|
||||
@ -434,8 +434,8 @@ class SwiftTest(common.HeatTestCase):
|
||||
@mock.patch('swiftclient.client.Connection.put_container')
|
||||
def test_check_fail(self, mock_put, mock_get):
|
||||
# Setup
|
||||
self.t['Resources']['SwiftContainer']['Properties']['PurgeOnDelete'] \
|
||||
= True
|
||||
res_prop = self.t['Resources']['SwiftContainer']['Properties']
|
||||
res_prop['PurgeOnDelete'] = True
|
||||
stack = utils.parse_stack(self.t)
|
||||
|
||||
mock_get.side_effect = Exception('boom')
|
||||
|
@ -16,8 +16,8 @@ from oslo_serialization import jsonutils
|
||||
from heat.common import identifier
|
||||
from heat.common import template_format
|
||||
from heat.engine import environment
|
||||
from heat.engine.resources.aws.cfn.wait_condition_handle \
|
||||
import WaitConditionHandle
|
||||
from heat.engine.resources.aws.cfn.wait_condition_handle import (
|
||||
WaitConditionHandle)
|
||||
from heat.engine.resources.aws.ec2 import instance
|
||||
from heat.engine.resources.openstack.nova.server import Server
|
||||
from heat.engine.scheduler import TaskRunner
|
||||
|
@ -37,7 +37,8 @@ file {'output_result':
|
||||
mode => 0644,
|
||||
content => "The file /tmp/$::bar contains $::foo for server \
|
||||
$::deploy_server_id during $::deploy_action",
|
||||
}'''
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
class SoftwareConfigIntegrationTest(scenario_base.ScenarioTestsBase):
|
||||
|
Loading…
Reference in New Issue
Block a user