diff --git a/sysinv/sysinv/sysinv/pylint.rc b/sysinv/sysinv/sysinv/pylint.rc index beb80f4673..444e33cc30 100755 --- a/sysinv/sysinv/sysinv/pylint.rc +++ b/sysinv/sysinv/sysinv/pylint.rc @@ -163,22 +163,13 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # W1505: deprecated-method # W1509: subprocess-popen-preexec-fn # W1618: no-absolute-import -# W1619: old-division -# W1620: dict-iter-method -# W1630: cmp-method -# W1633: round-builtin -# W1641: eq-without-hash -# W1645: exception-message-attribute -# W1655: dict-keys-not-iterating - # All these errors should be fixed: # E1101: no-member # E1111: assignment-from-no-return disable=C, R, fixme, W0101, W0105, W0106, W0107, W0108, W0110, W0123, W0150, W0201, W0211, W0212, W0221, W0223, W0231, W0235, W0311, W0402, W0403, W0404, W0603, W0612, W0613, W0621, W0622, W0631, W0632, W0701, W0703, - W0706, W1113, W1201, W1401, W1505, W1509, W1618, W1619, W1620, W1630, - W1633, W1641, W1645, W1655, + W0706, W1113, W1201, W1401, W1505, W1509, W1618, E1101, E1111 [REPORTS] diff --git a/sysinv/sysinv/sysinv/sysinv/agent/lldp/plugin.py b/sysinv/sysinv/sysinv/sysinv/agent/lldp/plugin.py index d1b84a8521..e8a2877a37 100644 --- a/sysinv/sysinv/sysinv/sysinv/agent/lldp/plugin.py +++ b/sysinv/sysinv/sysinv/sysinv/agent/lldp/plugin.py @@ -28,11 +28,6 @@ class Key(object): def __hash__(self): return hash((self.chassisid, self.portid, self.portname)) - def __cmp__(self, rhs): - return ((self.chassisid < rhs.chassisid) or - (self.portid < rhs.portid) or - (self.portname < rhs.portname)) - def __eq__(self, rhs): return (self.chassisid == rhs.chassisid and self.portid == rhs.portid and diff --git a/sysinv/sysinv/sysinv/sysinv/agent/node.py b/sysinv/sysinv/sysinv/sysinv/agent/node.py index cc26095d58..4b75a11af7 100644 --- a/sysinv/sysinv/sysinv/sysinv/agent/node.py +++ b/sysinv/sysinv/sysinv/sysinv/agent/node.py @@ -70,6 +70,10 @@ class CPU(object): self.core == rhs.core and self.thread == rhs.thread) + def __hash__(self): + return hash((self.cpu, self.numa_node, self.core, self.thread, + self.cpu_family, self.cpu_model, self.revision)) + def __ne__(self, rhs): return (self.cpu != rhs.cpu or self.numa_node != rhs.numa_node or diff --git a/sysinv/sysinv/sysinv/sysinv/agent/pci.py b/sysinv/sysinv/sysinv/sysinv/agent/pci.py index 4e4e85e466..01075f820b 100644 --- a/sysinv/sysinv/sysinv/sysinv/agent/pci.py +++ b/sysinv/sysinv/sysinv/sysinv/agent/pci.py @@ -103,6 +103,10 @@ class PCI(object): return (self.pvendor == rhs.pvendor and self.pdevice == rhs.pdevice) + def __hash__(self): + return hash((self.pciaddr, self.pclass, self.pvendor, self.pdevice, + self.prevision, self.psvendor, self.psdevice)) + def __ne__(self, rhs): return (self.pvendor != rhs.pvendor or self.pdevice != rhs.pdevice) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/certificate.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/certificate.py index 99f7147d2f..0d0b5eac42 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/certificate.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/certificate.py @@ -22,6 +22,7 @@ import datetime import os import pecan +import six import ssl import wsme import wsmeext.pecan as wsme_pecan @@ -439,7 +440,7 @@ class CertificateController(rest.RestController): if domain: msg = _check_cert_dns_name(cert, domain) if msg is not True: - return dict(success="", error=msg.message) + return dict(success="", error=six.text_type(msg)) elif msg: return dict(success="", error=msg) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/ethernet_port.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/ethernet_port.py index ea285cb136..2f0da4e634 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/ethernet_port.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/ethernet_port.py @@ -159,7 +159,7 @@ class EthernetPort(base.APIBase): "Represent a list containing a self link and associated port links" def __init__(self, **kwargs): - self.fields = objects.ethernet_port.fields.keys() + self.fields = objects.ethernet_port.fields for k in self.fields: setattr(self, k, kwargs.get(k)) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index fd1b8b33e4..c33802b532 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -4295,7 +4295,7 @@ class HostController(rest.RestController): if (active_controller_used > standby_controller_allocated_space): # Round up the needed space from float to integer - needed_space = math.ceil(float( + needed_space = math.ceil(float( # pylint: disable=W1619 active_controller_used - standby_controller_allocated_space) / (1024 ** 3)) msg = _("Standby controller does not have enough space allocated to " diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py index c6ee972729..d6c11cda0c 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py @@ -283,7 +283,7 @@ class KubeAppController(rest.RestController): if directive == 'apply': if not values: mode = None - elif name not in constants.HELM_APP_APPLY_MODES.keys(): + elif name not in constants.HELM_APP_APPLY_MODES: raise wsme.exc.ClientSideError(_( "Application-apply rejected: Mode is not supported " "for app {}.".format(name))) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_rootca_update.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_rootca_update.py index c1b243247a..13e60d0c4c 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_rootca_update.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_rootca_update.py @@ -76,7 +76,7 @@ class KubeRootCAGenerateController(rest.RestController): "format of 'C= ST= " "L= O= OU= " "CN=")) - if 'CN' not in subject_dict.keys(): + if 'CN' not in list(subject_dict.keys()): raise wsme.exc.ClientSideError(_("The CN= parameter is required to be " "specified in subject argument")) return subject_dict @@ -172,7 +172,7 @@ class KubeRootCAUpdate(base.APIBase): "A list containing a self link and associated kubernetes rootca update links" def __init__(self, **kwargs): - self.fields = objects.kube_rootca_update.fields.keys() + self.fields = list(objects.kube_rootca_update.fields.keys()) for k in self.fields: if not hasattr(self, k): continue @@ -229,7 +229,7 @@ class KubeRootCAHostUpdate(base.APIBase): "update links" def __init__(self, **kwargs): - self.fields = objects.kube_rootca_host_update.fields.keys() + self.fields = list(objects.kube_rootca_host_update.fields.keys()) for k in self.fields: if not hasattr(self, k): continue diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/memory.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/memory.py index fc35dd02ff..b8972ab996 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/memory.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/memory.py @@ -460,7 +460,7 @@ class MemoryController(rest.RestController): except wsme.exc.ClientSideError as e: inode = pecan.request.dbapi.inode_get(inode_id=rpc_port.forinodeid) numa_node = inode.numa_node - msg = _('Processor {0}:'.format(numa_node)) + e.message + msg = _('Processor {0}:'.format(numa_node)) + six.text_type(e) raise wsme.exc.ClientSideError(msg) else: # Standard/system controller or storage node diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py index bb010c4590..b1f46203cf 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py @@ -387,7 +387,7 @@ def _partition_pre_patch_checks(partition_obj, patch_obj, host_obj): raise wsme.exc.ClientSideError( _("Requested partition size must be larger than current " "size: %s GiB <= %s GiB") % (int(p['value']) // 1024, - math.floor(float(partition_obj.size_mib) / 1024 * 1000) / 1000.0)) + math.floor(float(partition_obj.size_mib) / 1024 * 1000) / 1000.0)) # pylint: disable=W1619 def _is_user_created_partition(guid): @@ -512,7 +512,8 @@ def _semantic_checks(operation, partition): raise wsme.exc.ClientSideError( _("Requested size %s GiB is larger than the %s GiB " "available.") % (partition['size_mib'] // 1024, - math.floor(float(idisk.available_mib) / 1024 * 1000) / 1000.0)) + math.floor(float(idisk.available_mib) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0)) _are_partition_operations_simultaneous(ihost, partition, constants.PARTITION_CMD_CREATE) @@ -592,7 +593,8 @@ def _semantic_checks(operation, partition): raise wsme.exc.ClientSideError( _("Requested extra size %s GiB is larger than the %s GiB " "available.") % (extra_size // 1024, - math.floor(float(idisk.available_mib) / 1024 * 1000) / 1000.0)) + math.floor(float(idisk.available_mib) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0)) elif operation == constants.PARTITION_CMD_DELETE: ############ diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py index ab5dbfd676..2680a51f12 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py @@ -1112,7 +1112,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the cinder pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['cinder_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 elif ceph_pool['name'] == constants.CEPH_POOL_KUBE_NAME: if (int(storceph['kube_pool_gib']) > 0 and (int(ceph_pool['stats']['bytes_used']) > @@ -1121,7 +1121,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the kube pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['kube_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 elif ceph_pool['name'] == constants.CEPH_POOL_EPHEMERAL_NAME: if (int(storceph['ephemeral_pool_gib']) > 0 and (int(ceph_pool['stats']['bytes_used']) > @@ -1130,7 +1130,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the ephemeral pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['ephemeral_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 elif ceph_pool['name'] == constants.CEPH_POOL_IMAGES_NAME: if (int(storceph['glance_pool_gib']) > 0 and (int(ceph_pool['stats']['bytes_used']) > @@ -1139,7 +1139,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the glance pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['glance_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 elif ceph_pool['name'] in constants.CEPH_POOL_OBJECT_GATEWAY_NAME: if (int(storceph['object_pool_gib']) > 0 and (int(ceph_pool['stats']['bytes_used']) > @@ -1148,7 +1148,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the object pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['object_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 else: if storceph['tier_name'] in ceph_pool['name']: if constants.CEPH_POOL_VOLUMES_NAME in ceph_pool['name']: @@ -1159,7 +1159,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the cinder pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['cinder_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 elif K8RbdProvisioner.get_pool(storceph) == ceph_pool['name']: if (int(storceph['kube_pool_gib']) > 0 and (int(ceph_pool['stats']['bytes_used']) > @@ -1168,7 +1168,7 @@ def _check_pool_quotas_data(ostorceph, storceph): _("The configured quota for the kube pool (%s GiB) " "must be greater than the already occupied space (%s GiB)") % (storceph['kube_pool_gib'], - float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) + float(ceph_pool['stats']['bytes_used']) / (1024 ** 3))) # pylint: disable=W1619 # sanity check the quota total_quota_gib = 0 diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py index 343b916805..ee6e571780 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py @@ -384,8 +384,10 @@ def _discover_and_validate_cinder_hiera_data(caps_dict): 'while for %s is %s GiB.') % (constants.LVG_CINDER_VOLUMES, constants.CINDER_LVM_MINIMUM_DEVICE_SIZE_GIB, - pv_sizes[0]['host'], math.floor(float(pv_sizes[0]['size']) / 1024 * 1000) / 1000.0, - pv_sizes[1]['host'], math.floor(float(pv_sizes[1]['size']) / 1024 * 1000) / 1000.0)) + pv_sizes[0]['host'], math.floor(float(pv_sizes[0]['size']) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0, + pv_sizes[1]['host'], math.floor(float(pv_sizes[1]['size']) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0)) raise wsme.exc.ClientSideError(msg) if pv_sizes[0]['size'] < (constants.CINDER_LVM_MINIMUM_DEVICE_SIZE_GIB * 1024): @@ -393,7 +395,7 @@ def _discover_and_validate_cinder_hiera_data(caps_dict): 'Current allocation is: %s GiB.') % (constants.LVG_CINDER_VOLUMES, constants.CINDER_LVM_MINIMUM_DEVICE_SIZE_GIB, - math.floor(float(pv_sizes[0]['size']) / 1024 * 1000) / 1000.0)) + math.floor(float(pv_sizes[0]['size']) / 1024 * 1000) / 1000.0)) # pylint: disable=W1619 raise wsme.exc.ClientSideError(msg) # Log all the LVM parameters diff --git a/sysinv/sysinv/sysinv/sysinv/common/device.py b/sysinv/sysinv/sysinv/sysinv/common/device.py index 9a4cea3fb6..9cca93ce24 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/device.py +++ b/sysinv/sysinv/sysinv/sysinv/common/device.py @@ -17,6 +17,9 @@ class pci_device_class_acclr(object): def __eq__(self, other): return (other in self.pci_class_ids) + def __hash__(self): + return hash(''.join(self.pci_class_ids)) + def __ne__(self, other): return (other not in self.pci_class_ids) diff --git a/sysinv/sysinv/sysinv/sysinv/common/exception.py b/sysinv/sysinv/sysinv/sysinv/common/exception.py index 1a26b87447..de3bea6f5a 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/exception.py +++ b/sysinv/sysinv/sysinv/sysinv/common/exception.py @@ -94,7 +94,7 @@ class SysinvException(Exception): if not message: try: - message = self.message % kwargs + message = self.message % kwargs # pylint: disable=W1645 except Exception as e: # kwargs doesn't match a variable in the message @@ -107,7 +107,7 @@ class SysinvException(Exception): raise e else: # at least get the core message out if something happened - message = self.message + message = self.message # pylint: disable=W1645 super(SysinvException, self).__init__(message) @@ -1207,7 +1207,7 @@ class OpenStackException(PickleableException): """ Return a tuple so that we can properly pickle the exception """ - return OpenStackException, (self.message, self._reason) + return OpenStackException, (self.message, self._reason) # pylint: disable=W1645 @property def message(self): @@ -1228,6 +1228,8 @@ class OpenStackRestAPIException(PickleableException): """ OpenStack Rest-API Exception """ + message = _("An unknown exception occurred.") + def __init__(self, message, http_status_code, reason): """ Create an OpenStack Rest-API exception @@ -1235,6 +1237,7 @@ class OpenStackRestAPIException(PickleableException): super(OpenStackRestAPIException, self).__init__(message) self._http_status_code = http_status_code # as defined in RFC 2616 self._reason = reason # a message string or another exception + self._message = message def __str__(self): """ @@ -1253,7 +1256,7 @@ class OpenStackRestAPIException(PickleableException): """ Return a tuple so that we can properly pickle the exception """ - return OpenStackRestAPIException, (self.message, + return OpenStackRestAPIException, (self.message, # pylint: disable=W1645 self._http_status_code, self._reason) diff --git a/sysinv/sysinv/sysinv/sysinv/common/retrying.py b/sysinv/sysinv/sysinv/sysinv/common/retrying.py index 15efc3d8ca..5b1aa3b078 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/retrying.py +++ b/sysinv/sysinv/sysinv/sysinv/common/retrying.py @@ -193,7 +193,7 @@ class Retrying(object): return reject def call(self, fn, *args, **kwargs): - start_time = int(round(time.time() * 1000)) + start_time = int(round(time.time() * 1000)) # pylint: disable=W1633 attempt_number = 1 while True: try: @@ -205,7 +205,7 @@ class Retrying(object): if not self.should_reject(attempt): return attempt.get(self._wrap_exception) - delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time + delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time # pylint: disable=W1633 if self.stop(attempt_number, delay_since_first_attempt_ms): if not self._wrap_exception and attempt.has_exception: # get() on an attempt with an exception should cause it to be raised, but raise just in case diff --git a/sysinv/sysinv/sysinv/sysinv/common/utils.py b/sysinv/sysinv/sysinv/sysinv/common/utils.py index 794cce7787..69b588af73 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/common/utils.py @@ -1303,11 +1303,11 @@ def output_to_dict(output): def bytes_to_GiB(bytes_number): - return bytes_number / float(1024 ** 3) + return bytes_number / float(1024 ** 3) # pylint: disable=W1619 def bytes_to_MiB(bytes_number): - return bytes_number / float(1024 ** 2) + return bytes_number / float(1024 ** 2) # pylint: disable=W1619 def check_lock_path(): diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py index 5b632f8bd3..9265377e17 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py @@ -1452,7 +1452,8 @@ class AppOperator(object): adjust)) tadjust = 0 - percent = round((float(num) / (charts_count - tadjust)) * 100) + percent = round((float(num) / # pylint: disable=W1619 + (charts_count - tadjust)) * 100) progress_str = "processing chart: {}, overall completion: {}%".\ format(last, percent) diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index 906b91c3d0..7a50475d27 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -4142,7 +4142,7 @@ class ConductorManager(service.PeriodicService): partitions = self.dbapi.partition_get_by_ihost(host.id) partition4 = next((p for p in partitions if p.device_node == pv4_name), None) - part_size_mib = float(pv_cgts_vg.lvm_pv_size) / (1024 ** 2) - int(partition4.size_mib) + part_size_mib = float(pv_cgts_vg.lvm_pv_size) / (1024 ** 2) - int(partition4.size_mib) # pylint: disable=W1619 if part_size_mib > 0: LOG.info("%s is not enough for R4 cgts-vg" % pv4_name) else: @@ -11666,7 +11666,7 @@ class ConductorManager(service.PeriodicService): constants.PARTITION_TABLE_SIZE # Convert bytes to GiB and round to be sure. - partition_size = int(round( + partition_size = int(round( # pylint: disable=W1633 cutils.bytes_to_GiB(partition_size))) return partition_size diff --git a/sysinv/sysinv/sysinv/sysinv/objects/base.py b/sysinv/sysinv/sysinv/sysinv/objects/base.py index 5b0013ab44..ac2f5f3c36 100644 --- a/sysinv/sysinv/sysinv/sysinv/objects/base.py +++ b/sysinv/sysinv/sysinv/sysinv/objects/base.py @@ -412,7 +412,7 @@ class SysinvObject(object): yield name, getattr(self, name) def items(self): - return list(self.iteritems()) + return list(self.iteritems()) # pylint: disable=dict-iter-method def __getitem__(self, name): """For backwards-compatibility with dict-based objects. diff --git a/sysinv/sysinv/sysinv/sysinv/openstack/common/rpc/common.py b/sysinv/sysinv/sysinv/sysinv/openstack/common/rpc/common.py index d88d1b1d05..c8086b68ae 100644 --- a/sysinv/sysinv/sysinv/sysinv/openstack/common/rpc/common.py +++ b/sysinv/sysinv/sysinv/sysinv/openstack/common/rpc/common.py @@ -77,7 +77,7 @@ class RPCException(Exception): if not message: try: - message = self.message % kwargs + message = self.message % kwargs # pylint: disable=W1645 except Exception: # kwargs doesn't match a variable in the message @@ -86,7 +86,7 @@ class RPCException(Exception): for name, value in kwargs.items(): LOG.error("%s: %s" % (name, value)) # at least get the core message out if something happened - message = self.message + message = self.message # pylint: disable=W1645 super(RPCException, self).__init__(message) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py index bf81626c8d..fd503e8e16 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py @@ -1895,7 +1895,7 @@ class ManagerTestCase(base.DbTestCase): iface_db_list = self.dbapi.iinterface_get_by_ihost(ihost['uuid']) self.assertEqual(len(iface_db_list), len(inic_dict_array)) for iface in iface_db_list: - self.assertIn(iface.imac, inic_mac_dict.keys()) + self.assertIn(iface.imac, inic_mac_dict) self.assertEqual(inic_mac_dict[iface.imac]['pname'], iface.ifname) self.assertEqual(inic_mac_dict[iface.imac]['mac'], iface.imac) @@ -1905,7 +1905,7 @@ class ManagerTestCase(base.DbTestCase): port_db_list = self.dbapi.port_get_by_host(ihost['uuid']) self.assertEqual(len(port_db_list), len(inic_dict_array)) for port in port_db_list: - self.assertIn(port.pciaddr, inic_pciaddr_dict.keys()) + self.assertIn(port.pciaddr, inic_pciaddr_dict) self.assertEqual(inic_pciaddr_dict[port.pciaddr]['pciaddr'], port.pciaddr) self.assertEqual(inic_pciaddr_dict[port.pciaddr]['pname'], port.name) self.assertEqual(inic_pciaddr_dict[port.pciaddr]['numa_node'], port.numa_node)