summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-11-05 16:17:42 +0100
committerRoman Gorshunov <roman.gorshunov@att.com>2018-11-05 18:35:36 +0100
commitd5c54eab68ee8c594518cbab20fac6e1c238af2f (patch)
tree160f836e7b386014c2cf534e54427dbd31f86479
parent756a063c3074ddd847af1dd02c9b576b541cedbd (diff)
Fix: pep8 airship-drydock-omni-test fix
Fixes for pep8 test. Change-Id: Id2b7a187ffe56a47a184314d1a19507a78f7d88a
Notes
Notes (review): Code-Review+1: Aaron Sheffield <ajs@sheffieldfamily.net> Code-Review+2: Matt McEuen <matt.mceuen@att.com> Code-Review+2: Felipe Monteiro <felipe.monteiro@att.com> Workflow+1: Scott Hussey <sthussey@att.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 06 Nov 2018 19:33:13 +0000 Reviewed-on: https://review.openstack.org/615584 Project: openstack/airship-drydock Branch: refs/heads/master
-rw-r--r--python/drydock_provisioner/control/health.py4
-rw-r--r--python/drydock_provisioner/control/tasks.py2
-rw-r--r--python/drydock_provisioner/drivers/node/maasdriver/actions/node.py30
-rw-r--r--python/drydock_provisioner/drivers/node/maasdriver/api_client.py2
-rw-r--r--python/drydock_provisioner/drivers/node/maasdriver/models/base.py4
-rw-r--r--python/drydock_provisioner/drivers/node/maasdriver/models/machine.py4
-rw-r--r--python/drydock_provisioner/drivers/node/maasdriver/models/node_results.py2
-rw-r--r--python/drydock_provisioner/objects/builddata.py2
-rw-r--r--python/drydock_provisioner/objects/node.py8
-rw-r--r--python/drydock_provisioner/orchestrator/actions/orchestrator.py4
-rw-r--r--python/drydock_provisioner/orchestrator/orchestrator.py2
-rw-r--r--python/drydock_provisioner/orchestrator/util.py2
-rw-r--r--python/drydock_provisioner/orchestrator/validations/boot_storage_rational.py4
-rw-r--r--python/drydock_provisioner/orchestrator/validations/bootaction_validity.py2
-rw-r--r--python/drydock_provisioner/orchestrator/validations/network_trunking_rational.py4
-rw-r--r--python/drydock_provisioner/statemgmt/design/resolver.py2
-rw-r--r--python/drydock_provisioner/statemgmt/state.py12
-rw-r--r--python/tests/unit/test_api_tasks_unit.py14
-rw-r--r--python/tests/unit/test_validation_rule_mtu_rational.py2
-rw-r--r--python/tests/unit/test_validation_rule_network_bond.py4
-rw-r--r--python/tests/unit/test_validation_rule_unique_network.py4
21 files changed, 58 insertions, 56 deletions
diff --git a/python/drydock_provisioner/control/health.py b/python/drydock_provisioner/control/health.py
index d653a6e..4c1894a 100644
--- a/python/drydock_provisioner/control/health.py
+++ b/python/drydock_provisioner/control/health.py
@@ -96,7 +96,7 @@ class HealthCheckCombined(object):
96 now = self.state_manager.get_now() 96 now = self.state_manager.get_now()
97 if now is None: 97 if now is None:
98 raise Exception('None received from database for now()') 98 raise Exception('None received from database for now()')
99 except Exception as ex: 99 except Exception:
100 hcm = HealthCheckMessage( 100 hcm = HealthCheckMessage(
101 msg='Unable to connect to database', error=True) 101 msg='Unable to connect to database', error=True)
102 health_check.add_detail_msg(msg=hcm) 102 health_check.add_detail_msg(msg=hcm)
@@ -110,7 +110,7 @@ class HealthCheckCombined(object):
110 maas_validation.start() 110 maas_validation.start()
111 if maas_validation.task.get_status() == ActionResult.Failure: 111 if maas_validation.task.get_status() == ActionResult.Failure:
112 raise Exception('MaaS task failure') 112 raise Exception('MaaS task failure')
113 except Exception as ex: 113 except Exception:
114 hcm = HealthCheckMessage( 114 hcm = HealthCheckMessage(
115 msg='Unable to connect to MaaS', error=True) 115 msg='Unable to connect to MaaS', error=True)
116 health_check.add_detail_msg(msg=hcm) 116 health_check.add_detail_msg(msg=hcm)
diff --git a/python/drydock_provisioner/control/tasks.py b/python/drydock_provisioner/control/tasks.py
index 1f70550..92eaf30 100644
--- a/python/drydock_provisioner/control/tasks.py
+++ b/python/drydock_provisioner/control/tasks.py
@@ -328,7 +328,7 @@ class TaskResource(StatefulResource):
328 subtask_errors = req.get_param_as_bool('subtaskerrors') 328 subtask_errors = req.get_param_as_bool('subtaskerrors')
329 try: 329 try:
330 layers = int(req.params.get('layers', '0')) 330 layers = int(req.params.get('layers', '0'))
331 except Exception as ex: 331 except Exception:
332 layers = 0 332 layers = 0
333 333
334 first_task = self.get_task(req, resp, task_id, builddata) 334 first_task = self.get_task(req, resp, task_id, builddata)
diff --git a/python/drydock_provisioner/drivers/node/maasdriver/actions/node.py b/python/drydock_provisioner/drivers/node/maasdriver/actions/node.py
index 66c6d3d..74adec4 100644
--- a/python/drydock_provisioner/drivers/node/maasdriver/actions/node.py
+++ b/python/drydock_provisioner/drivers/node/maasdriver/actions/node.py
@@ -320,12 +320,13 @@ class DestroyNode(BaseMaasAction):
320 # node release with erase disk will take sometime monitor it 320 # node release with erase disk will take sometime monitor it
321 attempts = 0 321 attempts = 0
322 max_attempts = ( 322 max_attempts = (
323 config.config_mgr.conf.timeouts.destroy_node * 323 config.config_mgr.conf.timeouts.destroy_node
324 60) // config.config_mgr.conf.maasdriver.poll_interval 324 * 60) // config.config_mgr.conf.maasdriver.poll_interval
325 325
326 while (attempts < max_attempts and 326 while (attempts < max_attempts
327 (not machine.status_name.startswith('Ready') 327 and (not machine.status_name.startswith('Ready')
328 and not machine.status_name.startswith('Failed'))): 328 and not
329 machine.status_name.startswith('Failed'))):
329 attempts = attempts + 1 330 attempts = attempts + 1
330 time.sleep( 331 time.sleep(
331 config.config_mgr.conf.maasdriver.poll_interval) 332 config.config_mgr.conf.maasdriver.poll_interval)
@@ -373,7 +374,7 @@ class DestroyNode(BaseMaasAction):
373 # setting power type attibutes to empty string 374 # setting power type attibutes to empty string
374 # will remove them from maas BMC table 375 # will remove them from maas BMC table
375 machine.reset_power_parameters() 376 machine.reset_power_parameters()
376 except AttributeError as attr_er: 377 except AttributeError:
377 pass 378 pass
378 379
379 machine.delete() 380 machine.delete()
@@ -778,7 +779,7 @@ class CreateNetworkTemplate(BaseMaasAction):
778 ctx_type='network') 779 ctx_type='network')
779 vlan.update() 780 vlan.update()
780 dhcp_config_set = True 781 dhcp_config_set = True
781 except RackControllerConflict as rack_ex: 782 except RackControllerConflict:
782 msg = ( 783 msg = (
783 "More than two rack controllers on vlan %s, " 784 "More than two rack controllers on vlan %s, "
784 "skipping enabling %s." % 785 "skipping enabling %s." %
@@ -1207,9 +1208,10 @@ class ConfigureHardware(BaseMaasAction):
1207 * 60 1208 * 60
1208 ) // config.config_mgr.conf.maasdriver.poll_interval 1209 ) // config.config_mgr.conf.maasdriver.poll_interval
1209 1210
1210 while (attempts < max_attempts and 1211 while (attempts < max_attempts
1211 (machine.status_name != 'Ready' and 1212 and (machine.status_name != 'Ready'
1212 not machine.status_name.startswith('Failed'))): 1213 and not
1214 machine.status_name.startswith('Failed'))):
1213 attempts = attempts + 1 1215 attempts = attempts + 1
1214 time.sleep(config.config_mgr.conf.maasdriver. 1216 time.sleep(config.config_mgr.conf.maasdriver.
1215 poll_interval) 1217 poll_interval)
@@ -1397,7 +1399,7 @@ class ApplyNodeNetworking(BaseMaasAction):
1397 try: 1399 try:
1398 machine.release() 1400 machine.release()
1399 machine.refresh() 1401 machine.refresh()
1400 except errors.DriverError as ex: 1402 except errors.DriverError:
1401 msg = ( 1403 msg = (
1402 "Node %s could not be released, skipping deployment." 1404 "Node %s could not be released, skipping deployment."
1403 % n.name) 1405 % n.name)
@@ -2203,7 +2205,7 @@ class ApplyNodeStorage(BaseMaasAction):
2203 size_str is interpreted in the context of this device 2205 size_str is interpreted in the context of this device
2204 :return size: The calculated size in bytes 2206 :return size: The calculated size in bytes
2205 """ 2207 """
2206 pattern = '(>?)(\d+)([mMbBgGtT%]{1,2})' 2208 pattern = r'(>?)(\d+)([mMbBgGtT%]{1,2})'
2207 regex = re.compile(pattern) 2209 regex = re.compile(pattern)
2208 match = regex.match(size_str) 2210 match = regex.match(size_str)
2209 2211
@@ -2400,8 +2402,8 @@ class DeployNode(BaseMaasAction):
2400 2402
2401 attempts = 0 2403 attempts = 0
2402 max_attempts = ( 2404 max_attempts = (
2403 config.config_mgr.conf.timeouts.deploy_node * 2405 config.config_mgr.conf.timeouts.deploy_node
2404 60) // config.config_mgr.conf.maasdriver.poll_interval 2406 * 60) // config.config_mgr.conf.maasdriver.poll_interval
2405 2407
2406 while (attempts < max_attempts 2408 while (attempts < max_attempts
2407 and (not machine.status_name.startswith('Deployed') 2409 and (not machine.status_name.startswith('Deployed')
diff --git a/python/drydock_provisioner/drivers/node/maasdriver/api_client.py b/python/drydock_provisioner/drivers/node/maasdriver/api_client.py
index 949c790..a5c48e3 100644
--- a/python/drydock_provisioner/drivers/node/maasdriver/api_client.py
+++ b/python/drydock_provisioner/drivers/node/maasdriver/api_client.py
@@ -93,7 +93,7 @@ class MaasRequestFactory(object):
93 def test_authentication(self): 93 def test_authentication(self):
94 try: 94 try:
95 resp = self.get('account/', op='list_authorisation_tokens') 95 resp = self.get('account/', op='list_authorisation_tokens')
96 except requests.Timeout as ex: 96 except requests.Timeout:
97 raise errors.TransientDriverError("Timeout connection to MaaS") 97 raise errors.TransientDriverError("Timeout connection to MaaS")
98 except Exception as ex: 98 except Exception as ex:
99 raise errors.PersistentDriverError( 99 raise errors.PersistentDriverError(
diff --git a/python/drydock_provisioner/drivers/node/maasdriver/models/base.py b/python/drydock_provisioner/drivers/node/maasdriver/models/base.py
index 883472b..21cfcc5 100644
--- a/python/drydock_provisioner/drivers/node/maasdriver/models/base.py
+++ b/python/drydock_provisioner/drivers/node/maasdriver/models/base.py
@@ -66,7 +66,7 @@ class ResourceBase(object):
66 """ 66 """
67 67
68 def interpolate_url(self): 68 def interpolate_url(self):
69 pattern = '\{([a-z_]+)\}' 69 pattern = r'\{([a-z_]+)\}'
70 regex = re.compile(pattern) 70 regex = re.compile(pattern)
71 start = 0 71 start = 0
72 new_url = self.resource_url 72 new_url = self.resource_url
@@ -184,7 +184,7 @@ class ResourceCollectionBase(object):
184 184
185 def interpolate_url(self): 185 def interpolate_url(self):
186 """Parse URL for placeholders and replace them with current instance values.""" 186 """Parse URL for placeholders and replace them with current instance values."""
187 pattern = '\{([a-z_]+)\}' 187 pattern = r'\{([a-z_]+)\}'
188 regex = re.compile(pattern) 188 regex = re.compile(pattern)
189 start = 0 189 start = 0
190 new_url = self.collection_url 190 new_url = self.collection_url
diff --git a/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py b/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py
index 2abb41d..aa1d6b7 100644
--- a/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py
+++ b/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py
@@ -624,8 +624,8 @@ class Machines(model_base.ResourceCollectionBase):
624 field = k[13:] 624 field = k[13:]
625 result = [ 625 result = [
626 i for i in result if str( 626 i for i in result if str(
627 getattr(i, 'power_parameters', {}).get(field, None)) == 627 getattr(i, 'power_parameters', {}).
628 str(v) 628 get(field, None)) == str(v)
629 ] 629 ]
630 else: 630 else:
631 result = [ 631 result = [
diff --git a/python/drydock_provisioner/drivers/node/maasdriver/models/node_results.py b/python/drydock_provisioner/drivers/node/maasdriver/models/node_results.py
index 2dd0ef1..87dc9ba 100644
--- a/python/drydock_provisioner/drivers/node/maasdriver/models/node_results.py
+++ b/python/drydock_provisioner/drivers/node/maasdriver/models/node_results.py
@@ -54,7 +54,7 @@ class NodeResult(model_base.ResourceBase):
54 """Decode the result data from base64.""" 54 """Decode the result data from base64."""
55 try: 55 try:
56 return base64.b64decode(self.data) 56 return base64.b64decode(self.data)
57 except binascii.Error as e: 57 except binascii.Error:
58 return None 58 return None
59 59
60 def get_type_desc(self): 60 def get_type_desc(self):
diff --git a/python/drydock_provisioner/objects/builddata.py b/python/drydock_provisioner/objects/builddata.py
index 174b8c3..1d71f70 100644
--- a/python/drydock_provisioner/objects/builddata.py
+++ b/python/drydock_provisioner/objects/builddata.py
@@ -48,7 +48,7 @@ class BuildData(object):
48 data_element = data_element.decode('utf-8') 48 data_element = data_element.decode('utf-8')
49 elif not isinstance(data_element, str): 49 elif not isinstance(data_element, str):
50 data_element = str(data_element) 50 data_element = str(data_element)
51 except Exception as ex: 51 except Exception:
52 raise errors.BuildDataError( 52 raise errors.BuildDataError(
53 "Error saving build data - data_element type %s could" 53 "Error saving build data - data_element type %s could"
54 "not be cast to string." % str(type(data_element))) 54 "not be cast to string." % str(type(data_element)))
diff --git a/python/drydock_provisioner/objects/node.py b/python/drydock_provisioner/objects/node.py
index dc8cae0..9b89125 100644
--- a/python/drydock_provisioner/objects/node.py
+++ b/python/drydock_provisioner/objects/node.py
@@ -107,10 +107,10 @@ class BaremetalNode(drydock_provisioner.objects.hostprofile.HostProfile):
107 try: 107 try:
108 pn = site_design.get_network(self.primary_network) 108 pn = site_design.get_network(self.primary_network)
109 domain = pn.dns_domain or "local" 109 domain = pn.dns_domain or "local"
110 except errors.DesignError as dex: 110 except errors.DesignError:
111 self.logger.debug("Primary network not found, use domain 'local'.") 111 self.logger.debug("Primary network not found, use domain 'local'.")
112 domain = "local" 112 domain = "local"
113 except AttributeError as aex: 113 except AttributeError:
114 self.logger.debug( 114 self.logger.debug(
115 "Primary network does not define a domain, use domain 'local'." 115 "Primary network does not define a domain, use domain 'local'."
116 ) 116 )
@@ -255,8 +255,8 @@ class BaremetalNode(drydock_provisioner.objects.hostprofile.HostProfile):
255 :param address: String value that is used to find the logicalname. 255 :param address: String value that is used to find the logicalname.
256 :return: String value of the logicalname or the alias_name if logicalname is not found. 256 :return: String value of the logicalname or the alias_name if logicalname is not found.
257 """ 257 """
258 nodes = xml_root.findall(".//node[businfo='" + bus_type + "@" + 258 nodes = xml_root.findall(".//node[businfo='" + bus_type + "@"
259 address + "'].logicalname") 259 + address + "'].logicalname")
260 if len(nodes) >= 1 and nodes[0].text: 260 if len(nodes) >= 1 and nodes[0].text:
261 if (len(nodes) > 1): 261 if (len(nodes) > 1):
262 self.logger.info("Multiple nodes found for businfo=%s@%s" % 262 self.logger.info("Multiple nodes found for businfo=%s@%s" %
diff --git a/python/drydock_provisioner/orchestrator/actions/orchestrator.py b/python/drydock_provisioner/orchestrator/actions/orchestrator.py
index 26fbdd8..c487fe7 100644
--- a/python/drydock_provisioner/orchestrator/actions/orchestrator.py
+++ b/python/drydock_provisioner/orchestrator/actions/orchestrator.py
@@ -1118,8 +1118,8 @@ class BootactionReport(BaseAction):
1118 bas = self.state_manager.get_boot_actions_for_node(n) 1118 bas = self.state_manager.get_boot_actions_for_node(n)
1119 running_bas = { 1119 running_bas = {
1120 k: v 1120 k: v
1121 for (k, v) in bas.items() if v.get('action_status') == 1121 for (k, v) in bas.items() if v.
1122 hd_fields.ActionResult.Incomplete 1122 get('action_status') == hd_fields.ActionResult.Incomplete
1123 } 1123 }
1124 if len(running_bas) > 0: 1124 if len(running_bas) > 0:
1125 still_running = True 1125 still_running = True
diff --git a/python/drydock_provisioner/orchestrator/orchestrator.py b/python/drydock_provisioner/orchestrator/orchestrator.py
index 44f23e5..85e1834 100644
--- a/python/drydock_provisioner/orchestrator/orchestrator.py
+++ b/python/drydock_provisioner/orchestrator/orchestrator.py
@@ -269,7 +269,7 @@ class Orchestrator(object):
269 site_design, 269 site_design,
270 state_manager=self.state_manager, 270 state_manager=self.state_manager,
271 resolve_aliases=resolve_aliases) 271 resolve_aliases=resolve_aliases)
272 except Exception as ex: 272 except Exception:
273 node_failed.append(n) 273 node_failed.append(n)
274 self.logger.error( 274 self.logger.error(
275 "Failed to build applied model for node %s." % n.name) 275 "Failed to build applied model for node %s." % n.name)
diff --git a/python/drydock_provisioner/orchestrator/util.py b/python/drydock_provisioner/orchestrator/util.py
index 7b257cb..eb0aca7 100644
--- a/python/drydock_provisioner/orchestrator/util.py
+++ b/python/drydock_provisioner/orchestrator/util.py
@@ -29,7 +29,7 @@ class SimpleBytes():
29 :param size_str: A string representing the desired size 29 :param size_str: A string representing the desired size
30 :return size: The calculated size in bytes 30 :return size: The calculated size in bytes
31 """ 31 """
32 pattern = '(\d+)([mMbBgGtT]{1,2})' 32 pattern = r'(\d+)([mMbBgGtT]{1,2})'
33 regex = re.compile(pattern) 33 regex = re.compile(pattern)
34 match = regex.match(size_str) 34 match = regex.match(size_str)
35 35
diff --git a/python/drydock_provisioner/orchestrator/validations/boot_storage_rational.py b/python/drydock_provisioner/orchestrator/validations/boot_storage_rational.py
index 84a4600..186079d 100644
--- a/python/drydock_provisioner/orchestrator/validations/boot_storage_rational.py
+++ b/python/drydock_provisioner/orchestrator/validations/boot_storage_rational.py
@@ -51,7 +51,7 @@ class BootStorageRational(Validators):
51 self.report_error( 51 self.report_error(
52 msg, [baremetal_node.doc_ref], 52 msg, [baremetal_node.doc_ref],
53 "Configure a larger root volume") 53 "Configure a larger root volume")
54 except errors.InvalidSizeFormat as e: 54 except errors.InvalidSizeFormat:
55 msg = ( 55 msg = (
56 'Root volume has an invalid size format on BaremetalNode' 56 'Root volume has an invalid size format on BaremetalNode'
57 '%s.' % baremetal_node.name) 57 '%s.' % baremetal_node.name)
@@ -74,7 +74,7 @@ class BootStorageRational(Validators):
74 self.report_error( 74 self.report_error(
75 msg, [baremetal_node.doc_ref], 75 msg, [baremetal_node.doc_ref],
76 "Configure a larger boot volume.") 76 "Configure a larger boot volume.")
77 except errors.InvalidSizeFormat as e: 77 except errors.InvalidSizeFormat:
78 msg = ( 78 msg = (
79 'Boot volume has an invalid size format on BaremetalNode ' 79 'Boot volume has an invalid size format on BaremetalNode '
80 '%s.' % baremetal_node.name) 80 '%s.' % baremetal_node.name)
diff --git a/python/drydock_provisioner/orchestrator/validations/bootaction_validity.py b/python/drydock_provisioner/orchestrator/validations/bootaction_validity.py
index e11e6dc..76644a9 100644
--- a/python/drydock_provisioner/orchestrator/validations/bootaction_validity.py
+++ b/python/drydock_provisioner/orchestrator/validations/bootaction_validity.py
@@ -45,7 +45,7 @@ class BootactionPackageListValid(Validators):
45 45
46 def __init__(self): 46 def __init__(self):
47 super().__init__('Bootaction pkg_list Validation', 'DD4002') 47 super().__init__('Bootaction pkg_list Validation', 'DD4002')
48 version_fields = '(\d+:)?([a-zA-Z0-9.+~-]+)(-[a-zA-Z0-9.+~]+)' 48 version_fields = r'(\d+:)?([a-zA-Z0-9.+~-]+)(-[a-zA-Z0-9.+~]+)'
49 self.version_fields = re.compile(version_fields) 49 self.version_fields = re.compile(version_fields)
50 50
51 def run_validation(self, site_design, orchestrator=None): 51 def run_validation(self, site_design, orchestrator=None):
diff --git a/python/drydock_provisioner/orchestrator/validations/network_trunking_rational.py b/python/drydock_provisioner/orchestrator/validations/network_trunking_rational.py
index bc2f30d..481feb1 100644
--- a/python/drydock_provisioner/orchestrator/validations/network_trunking_rational.py
+++ b/python/drydock_provisioner/orchestrator/validations/network_trunking_rational.py
@@ -30,8 +30,8 @@ class NetworkTrunkingRational(Validators):
30 for network_link in network_link_list: 30 for network_link in network_link_list:
31 allowed_networks = network_link.allowed_networks 31 allowed_networks = network_link.allowed_networks
32 # if allowed networks > 1 trunking must be enabled 32 # if allowed networks > 1 trunking must be enabled
33 if (len(allowed_networks) > 1 and network_link.trunk_mode == 33 if (len(allowed_networks) > 1 and network_link.
34 hd_fields.NetworkLinkTrunkingMode.Disabled): 34 trunk_mode == hd_fields.NetworkLinkTrunkingMode.Disabled):
35 msg = ('If there is more than 1 allowed network,' 35 msg = ('If there is more than 1 allowed network,'
36 'trunking mode must be enabled') 36 'trunking mode must be enabled')
37 self.report_error( 37 self.report_error(
diff --git a/python/drydock_provisioner/statemgmt/design/resolver.py b/python/drydock_provisioner/statemgmt/design/resolver.py
index dcde8e6..639cdba 100644
--- a/python/drydock_provisioner/statemgmt/design/resolver.py
+++ b/python/drydock_provisioner/statemgmt/design/resolver.py
@@ -117,7 +117,7 @@ class ReferenceResolver(object):
117 :param design_uri: Tuple as returned by urllib.parse for the design reference 117 :param design_uri: Tuple as returned by urllib.parse for the design reference
118 """ 118 """
119 ks_sess = KeystoneUtils.get_session() 119 ks_sess = KeystoneUtils.get_session()
120 (new_scheme, foo) = re.subn('^[^+]+\+', '', design_uri.scheme) 120 (new_scheme, foo) = re.subn(r'^[^+]+\+', '', design_uri.scheme)
121 url = urllib.parse.urlunparse( 121 url = urllib.parse.urlunparse(
122 (new_scheme, design_uri.netloc, design_uri.path, design_uri.params, 122 (new_scheme, design_uri.netloc, design_uri.path, design_uri.params,
123 design_uri.query, design_uri.fragment)) 123 design_uri.query, design_uri.fragment))
diff --git a/python/drydock_provisioner/statemgmt/state.py b/python/drydock_provisioner/statemgmt/state.py
index 0055681..060ce6f 100644
--- a/python/drydock_provisioner/statemgmt/state.py
+++ b/python/drydock_provisioner/statemgmt/state.py
@@ -110,9 +110,9 @@ class DrydockState(object):
110 """ 110 """
111 query_text = sql.text( 111 query_text = sql.text(
112 "SELECT * FROM tasks WHERE " # nosec no strings are user-sourced 112 "SELECT * FROM tasks WHERE " # nosec no strings are user-sourced
113 "parent_task_id = :parent_task_id AND " 113 "parent_task_id = :parent_task_id AND status "
114 "status IN ('" + hd_fields.TaskStatus.Terminated + "','" + 114 "IN ('" + hd_fields.TaskStatus.Terminated + "','"
115 hd_fields.TaskStatus.Complete + "')") 115 + hd_fields.TaskStatus.Complete + "')")
116 return self._query_subtasks(task_id, query_text, 116 return self._query_subtasks(task_id, query_text,
117 "Error querying complete subtask: %s") 117 "Error querying complete subtask: %s")
118 118
@@ -126,9 +126,9 @@ class DrydockState(object):
126 """ 126 """
127 query_text = sql.text( 127 query_text = sql.text(
128 "SELECT * FROM tasks WHERE " # nosec no strings are user-sourced 128 "SELECT * FROM tasks WHERE " # nosec no strings are user-sourced
129 "parent_task_id = :parent_task_id AND " 129 "parent_task_id = :parent_task_id AND status "
130 "status NOT IN ['" + hd_fields.TaskStatus.Terminated + "','" + 130 "NOT IN ['" + hd_fields.TaskStatus.Terminated + "','"
131 hd_fields.TaskStatus.Complete + "']") 131 + hd_fields.TaskStatus.Complete + "']")
132 return self._query_subtasks(task_id, query_text, 132 return self._query_subtasks(task_id, query_text,
133 "Error querying active subtask: %s") 133 "Error querying active subtask: %s")
134 134
diff --git a/python/tests/unit/test_api_tasks_unit.py b/python/tests/unit/test_api_tasks_unit.py
index 794919d..5c8209d 100644
--- a/python/tests/unit/test_api_tasks_unit.py
+++ b/python/tests/unit/test_api_tasks_unit.py
@@ -43,13 +43,13 @@ class TestTasksApiUnit(object):
43 try: 43 try:
44 response_json['build_data'] 44 response_json['build_data']
45 key_error = False 45 key_error = False
46 except KeyError as ex: 46 except KeyError:
47 key_error = True 47 key_error = True
48 assert key_error 48 assert key_error
49 try: 49 try:
50 response_json['subtask_errors'] 50 response_json['subtask_errors']
51 key_error = False 51 key_error = False
52 except KeyError as ex: 52 except KeyError:
53 key_error = True 53 key_error = True
54 assert key_error 54 assert key_error
55 55
@@ -95,7 +95,7 @@ class TestTasksApiUnit(object):
95 try: 95 try:
96 response_json['subtask_errors'] 96 response_json['subtask_errors']
97 key_error = False 97 key_error = False
98 except KeyError as ex: 98 except KeyError:
99 key_error = True 99 key_error = True
100 assert key_error 100 assert key_error
101 101
@@ -132,7 +132,7 @@ class TestTasksApiUnit(object):
132 try: 132 try:
133 response_json['11111111-1111-1111-1111-111111111116'] 133 response_json['11111111-1111-1111-1111-111111111116']
134 key_error = False 134 key_error = False
135 except KeyError as ex: 135 except KeyError:
136 key_error = True 136 key_error = True
137 assert key_error 137 assert key_error
138 138
@@ -156,13 +156,13 @@ class TestTasksApiUnit(object):
156 try: 156 try:
157 response_json['11111111-1111-1111-1111-111111111116'] 157 response_json['11111111-1111-1111-1111-111111111116']
158 key_error = False 158 key_error = False
159 except KeyError as ex: 159 except KeyError:
160 key_error = True 160 key_error = True
161 assert key_error is False 161 assert key_error is False
162 try: 162 try:
163 response_json['subtask_errors'] 163 response_json['subtask_errors']
164 key_error = False 164 key_error = False
165 except KeyError as ex: 165 except KeyError:
166 key_error = True 166 key_error = True
167 assert key_error 167 assert key_error
168 168
@@ -186,7 +186,7 @@ class TestTasksApiUnit(object):
186 try: 186 try:
187 response_json['11111111-1111-1111-1111-111111111116'] 187 response_json['11111111-1111-1111-1111-111111111116']
188 key_error = False 188 key_error = False
189 except KeyError as ex: 189 except KeyError:
190 key_error = True 190 key_error = True
191 assert key_error is False 191 assert key_error is False
192 assert response_json['subtask_errors'][ 192 assert response_json['subtask_errors'][
diff --git a/python/tests/unit/test_validation_rule_mtu_rational.py b/python/tests/unit/test_validation_rule_mtu_rational.py
index 2928c80..a1b8415 100644
--- a/python/tests/unit/test_validation_rule_mtu_rational.py
+++ b/python/tests/unit/test_validation_rule_mtu_rational.py
@@ -54,7 +54,7 @@ class TestMtu(object):
54 validator = MtuRational() 54 validator = MtuRational()
55 message_list = validator.execute(site_design, orchestrator=orch) 55 message_list = validator.execute(site_design, orchestrator=orch)
56 56
57 regex = re.compile('MTU must be between \d+ and \d+') 57 regex = re.compile(r'MTU must be between \d+ and \d+')
58 regex_1 = re.compile('MTU must be <= the parent Network Link') 58 regex_1 = re.compile('MTU must be <= the parent Network Link')
59 59
60 for msg in message_list: 60 for msg in message_list:
diff --git a/python/tests/unit/test_validation_rule_network_bond.py b/python/tests/unit/test_validation_rule_network_bond.py
index fce2c2a..32fc17b 100644
--- a/python/tests/unit/test_validation_rule_network_bond.py
+++ b/python/tests/unit/test_validation_rule_network_bond.py
@@ -55,8 +55,8 @@ class TestRationalNetworkLinkBond(object):
55 validator = RationalNetworkBond() 55 validator = RationalNetworkBond()
56 message_list = validator.execute(site_design, orchestrator=orch) 56 message_list = validator.execute(site_design, orchestrator=orch)
57 57
58 regex = re.compile('Down delay \S+ is less than mon rate \S+') 58 regex = re.compile(r'Down delay \S+ is less than mon rate \S+')
59 regex_1 = re.compile('Up delay \S+ is less than mon rate \S+') 59 regex_1 = re.compile(r'Up delay \S+ is less than mon rate \S+')
60 60
61 for msg in message_list: 61 for msg in message_list:
62 msg = msg.to_dict() 62 msg = msg.to_dict()
diff --git a/python/tests/unit/test_validation_rule_unique_network.py b/python/tests/unit/test_validation_rule_unique_network.py
index 65dd888..26ea0df 100644
--- a/python/tests/unit/test_validation_rule_unique_network.py
+++ b/python/tests/unit/test_validation_rule_unique_network.py
@@ -56,10 +56,10 @@ class TestUniqueNetwork(object):
56 message_list = validator.execute(site_design, orchestrator=orch) 56 message_list = validator.execute(site_design, orchestrator=orch)
57 57
58 regex = re.compile( 58 regex = re.compile(
59 'Allowed network .+ duplicated on NetworkLink .+ and NetworkLink .+' 59 r'Allowed network .+ duplicated on NetworkLink .+ and NetworkLink .+'
60 ) 60 )
61 regex_1 = re.compile( 61 regex_1 = re.compile(
62 'Interface \S+ attached to network \S+ not allowed on interface link' 62 r'Interface \S+ attached to network \S+ not allowed on interface link'
63 ) 63 )
64 64
65 assert len(message_list) >= 2 65 assert len(message_list) >= 2