From 722d71badf59fc8cdb01b61c5709d6be4d06d58c Mon Sep 17 00:00:00 2001 From: Mathieu Robinson Date: Thu, 9 Aug 2018 14:18:44 -0400 Subject: [PATCH] Fix tox pep8 errors of type E231 in sysinv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the skip clause for E231. Fix the offending errors which are only formatting changes. E231: "missing whitespace after ‘,’, ‘;’, or ‘:’". Story: 2002888 Task: 23161 Change-Id: I533bc4ac72d717b960ed20fbfffafb77c65f91f1 Signed-off-by: Mathieu Robinson --- sysinv/sysinv/sysinv/sysinv/agent/pci.py | 12 +++++------ .../sysinv/sysinv/api/controllers/v1/alarm.py | 3 ++- .../sysinv/api/controllers/v1/license.py | 8 ++++---- .../sysinv/api/controllers/v1/partition.py | 2 +- .../api/controllers/v1/storage_backend.py | 2 +- .../sysinv/api/controllers/v1/storage_ceph.py | 6 +++--- .../controllers/v1/storage_ceph_external.py | 2 +- .../api/controllers/v1/storage_external.py | 4 ++-- .../sysinv/api/controllers/v1/storage_file.py | 4 ++-- .../sysinv/api/controllers/v1/storage_lvm.py | 6 +++--- .../sysinv/sysinv/sysinv/common/constants.py | 8 ++++---- .../sysinv/sysinv/common/service_parameter.py | 4 ++-- sysinv/sysinv/sysinv/sysinv/common/utils.py | 4 ++-- .../sysinv/sysinv/sysinv/conductor/manager.py | 20 +++++++++---------- .../sysinv/sysinv/conductor/openstack.py | 2 +- .../openstack/common/keystone_objects.py | 4 ++-- sysinv/sysinv/sysinv/sysinv/puppet/glance.py | 2 +- sysinv/sysinv/sysinv/sysinv/puppet/ironic.py | 2 +- sysinv/sysinv/sysinv/sysinv/puppet/magnum.py | 2 +- sysinv/sysinv/sysinv/sysinv/puppet/murano.py | 2 +- sysinv/sysinv/sysinv/sysinv/puppet/nova.py | 6 +++--- .../sysinv/tests/api/test_invservers.py | 4 ++-- .../sysinv/tests/api/test_storage_tier.py | 10 +++++----- .../sysinv/tests/conductor/test_ceph.py | 8 ++++---- .../tests/db/sqlalchemy/test_migrations.py | 16 +++++++-------- .../sysinv/sysinv/tests/db/test_sysinv.py | 12 +++++------ sysinv/sysinv/sysinv/sysinv/tests/db/utils.py | 14 ++++++------- .../sysinv/tests/puppet/test_interface.py | 2 +- sysinv/sysinv/sysinv/tox.ini | 2 +- 29 files changed, 87 insertions(+), 86 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/agent/pci.py b/sysinv/sysinv/sysinv/sysinv/agent/pci.py index 6111641b37..78756aeb48 100644 --- a/sysinv/sysinv/sysinv/sysinv/agent/pci.py +++ b/sysinv/sysinv/sysinv/sysinv/agent/pci.py @@ -27,12 +27,12 @@ LOG = logging.getLogger(__name__) ETHERNET_PCI_CLASSES = ['ethernet controller', 'network controller'] # Look for other devices we may want to inventory. -KNOWN_PCI_DEVICES = [{"vendor_id":constants.NOVA_PCI_ALIAS_QAT_PF_VENDOR, - "device_id":constants.NOVA_PCI_ALIAS_QAT_DH895XCC_PF_DEVICE, - "class_id":constants.NOVA_PCI_ALIAS_QAT_CLASS}, - {"vendor_id":constants.NOVA_PCI_ALIAS_QAT_PF_VENDOR, - "device_id":constants.NOVA_PCI_ALIAS_QAT_C62X_PF_DEVICE, - "class_id":constants.NOVA_PCI_ALIAS_QAT_CLASS}, +KNOWN_PCI_DEVICES = [{"vendor_id": constants.NOVA_PCI_ALIAS_QAT_PF_VENDOR, + "device_id": constants.NOVA_PCI_ALIAS_QAT_DH895XCC_PF_DEVICE, + "class_id": constants.NOVA_PCI_ALIAS_QAT_CLASS}, + {"vendor_id": constants.NOVA_PCI_ALIAS_QAT_PF_VENDOR, + "device_id": constants.NOVA_PCI_ALIAS_QAT_C62X_PF_DEVICE, + "class_id": constants.NOVA_PCI_ALIAS_QAT_CLASS}, {"class_id": constants.NOVA_PCI_ALIAS_GPU_CLASS}] # PCI-SIG 0x06 bridge devices to not inventory. diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/alarm.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/alarm.py index 265f2fdbfc..17c6fb8525 100755 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/alarm.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/alarm.py @@ -273,7 +273,8 @@ class AlarmController(rest.RestController): @wsme_pecan.wsexpose(AlarmCollection, [Query], types.uuid, int, wtypes.text, wtypes.text, bool) - def get_all(self, q=[], marker=None, limit=None, sort_key='id', sort_dir='asc',include_suppress=False): + def get_all(self, q=[], marker=None, limit=None, sort_key='id', + sort_dir='asc', include_suppress=False): """Retrieve a list of ialarm. :param marker: pagination marker for large data sets. diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/license.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/license.py index aed2ddf964..8ceac31bac 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/license.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/license.py @@ -63,7 +63,7 @@ class License(base.APIBase): self.fields = [] # they are all an API-only attribute - for fp in ['name','status','expiry_date']: + for fp in ['name', 'status', 'expiry_date']: self.fields.append(fp) setattr(self, fp, kwargs.get(fp, None)) @@ -72,7 +72,7 @@ class License(base.APIBase): license = License(**rpc_license) if not expand: - license.unset_fields_except(['name','status', + license.unset_fields_except(['name', 'status', 'expiry_date']) return license @@ -114,8 +114,8 @@ class LicenseController(rest.RestController): licenses = license.get_licenses_info() return LicenseCollection.convert_with_links( - licenses, limit, url=resource_url,expand=expand, - sort_key=sort_key,sort_dir=sort_dir) + licenses, limit, url=resource_url, expand=expand, + sort_key=sort_key, sort_dir=sort_dir) @wsme_pecan.wsexpose(LicenseCollection, wtypes.text, int, wtypes.text, wtypes.text) def get_all(self, marker=None, limit=None, sort_key='id', sort_dir='asc'): diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py index f6703d485d..75bb8da14d 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/partition.py @@ -351,7 +351,7 @@ def _check_host(partition, ihost, idisk): if ihost['id'] != idisk['forihostid']: raise wsme.exc.ClientSideError(_("The requested disk (%s) for the partition " "is not present on host %s.") % - (idisk.uuid,ihost.hostname)) + (idisk.uuid, ihost.hostname)) def _partition_pre_patch_checks(partition_obj, patch_obj, host_obj): diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_backend.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_backend.py index 32a0a07812..3a01160a21 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_backend.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_backend.py @@ -122,7 +122,7 @@ class StorageBackend(base.APIBase): self.fields.append('confirmed') for k in self.fields: - setattr(self, k, kwargs.get(k,defaults.get(k))) + setattr(self, k, kwargs.get(k, defaults.get(k))) @classmethod def convert_with_links(cls, rpc_storage_backend, expand=True): 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 f177af17a2..698abb7b57 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph.py @@ -179,7 +179,7 @@ class StorageCeph(base.APIBase): v, strict=True) except ValueError as e: raise exception.Invalid(e) - setattr(self, k, kwargs.get(k,defaults.get(k))) + setattr(self, k, kwargs.get(k, defaults.get(k))) @classmethod def convert_with_links(cls, rpc_storage_ceph, expand=True): @@ -351,7 +351,7 @@ def _get_options_string(storage_ceph): if svc_dict and svc in services: svc_str = "" for key in svc_dict: - svc_str += "\t%s: %s\n" % (key, svc_dict.get(key,None)) + svc_str += "\t%s: %s\n" % (key, svc_dict.get(key, None)) if len(svc_str) > 0: opt_str += "%s:\n%s" % (svc.title(), svc_str) @@ -558,7 +558,7 @@ def check_and_update_services(storage_ceph): for k in check_data[s]: cap.pop(k, None) values = {'services': ','.join(services), - 'capabilities': cap,} + 'capabilities': cap, } pecan.request.dbapi.storage_backend_update(sb.uuid, values) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph_external.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph_external.py index e943d0c38c..375babef2f 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph_external.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_ceph_external.py @@ -321,7 +321,7 @@ def _check_and_update_services(storage_ceph_ext): for k in HIERA_DATA[s]: cap.pop(k, None) values = {'services': ','.join(services), - 'capabilities': cap,} + 'capabilities': cap, } pecan.request.dbapi.storage_backend_update(sb.uuid, values) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_external.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_external.py index 0e3fac0904..5065a7fa26 100755 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_external.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_external.py @@ -119,7 +119,7 @@ class StorageExternal(base.APIBase): # Set the value for any of the field for k in self.fields: - setattr(self, k, kwargs.get(k,defaults.get(k))) + setattr(self, k, kwargs.get(k, defaults.get(k))) @classmethod def convert_with_links(cls, rpc_storage_external, expand=True): @@ -280,7 +280,7 @@ def _get_options_string(storage_external): if svc_dict and svc in services: svc_str = "" for key in svc_dict: - svc_str += "\t%s: %s\n" % (key, svc_dict.get(key,None)) + svc_str += "\t%s: %s\n" % (key, svc_dict.get(key, None)) if len(svc_str) > 0: opt_str += "%s:\n%s" % (svc.title(), svc_str) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_file.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_file.py index 4bce8219db..a9e68ac7cc 100755 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_file.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_file.py @@ -117,7 +117,7 @@ class StorageFile(base.APIBase): # Set the value for any of the field for k in self.fields: - setattr(self, k, kwargs.get(k,defaults.get(k))) + setattr(self, k, kwargs.get(k, defaults.get(k))) @classmethod def convert_with_links(cls, rpc_storage_file, expand=True): @@ -278,7 +278,7 @@ def _get_options_string(storage_file): if svc_dict and svc in services: svc_str = "" for key in svc_dict: - svc_str += "\t%s: %s\n" % (key, svc_dict.get(key,None)) + svc_str += "\t%s: %s\n" % (key, svc_dict.get(key, None)) if len(svc_str) > 0: opt_str += "%s:\n%s" % (svc.title(), svc_str) 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 78b2cd2f4a..92a88e5c13 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/storage_lvm.py @@ -121,7 +121,7 @@ class StorageLVM(base.APIBase): # Set the value for any of the field for k in self.fields: - setattr(self, k, kwargs.get(k,defaults.get(k))) + setattr(self, k, kwargs.get(k, defaults.get(k))) @classmethod def convert_with_links(cls, rpc_storage_lvm, expand=True): @@ -282,7 +282,7 @@ def _get_options_string(storage_lvm): if svc_dict and svc in services: svc_str = "" for key in svc_dict: - svc_str += "\t%s: %s\n" % (key, svc_dict.get(key,None)) + svc_str += "\t%s: %s\n" % (key, svc_dict.get(key, None)) if len(svc_str) > 0: opt_str += "%s:\n%s" % (svc.title(), svc_str) @@ -398,7 +398,7 @@ def _discover_and_validate_cinder_hiera_data(caps_dict): raise wsme.exc.ClientSideError(msg) # Log all the LVM parameters - for k,v in caps_dict.iteritems(): + for k, v in caps_dict.iteritems(): LOG.info("Cinder LVM Data %s = %s" % (k, v)) diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py index 6c438cf6e8..9bf4a7e693 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/constants.py +++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py @@ -719,8 +719,8 @@ SB_TIER_CEPH_POOLS = [ # varies greatly in Titanium Cloud and we want to avoid running too low on PGs CEPH_TARGET_PGS_PER_OSD = 200 CEPH_REPLICATION_FACTOR_DEFAULT = 2 -CEPH_REPLICATION_FACTOR_SUPPORTED = [2,3] -CEPH_MIN_REPLICATION_FACTOR_SUPPORTED = [1,2] +CEPH_REPLICATION_FACTOR_SUPPORTED = [2, 3] +CEPH_MIN_REPLICATION_FACTOR_SUPPORTED = [1, 2] CEPH_REPLICATION_MAP_DEFAULT = { # replication: min_replication 2: 1, @@ -1245,8 +1245,8 @@ SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_V1_OPTS = 'nopti nospectre_v2' SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL = 'spectre_meltdown_all' SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL_OPTS = '' SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_OPTS = { - SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_V1:SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_V1_OPTS, - SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL:SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL_OPTS + SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_V1: SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_V1_OPTS, + SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL: SYSTEM_SECURITY_FEATURE_SPECTRE_MELTDOWN_ALL_OPTS } diff --git a/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py b/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py index 405ffc9ddd..90ee80c039 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py +++ b/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py @@ -854,8 +854,8 @@ HORIZON_AUTH_PARAMETER_OPTIONAL = [ ] HORIZON_AUTH_PARAMETER_VALIDATOR = { - constants.SERVICE_PARAM_HORIZON_AUTH_LOCKOUT_PERIOD_SEC:_validate_integer, - constants.SERVICE_PARAM_HORIZON_AUTH_LOCKOUT_RETRIES:_validate_integer, + constants.SERVICE_PARAM_HORIZON_AUTH_LOCKOUT_PERIOD_SEC: _validate_integer, + constants.SERVICE_PARAM_HORIZON_AUTH_LOCKOUT_RETRIES: _validate_integer, } HORIZON_AUTH_PARAMETER_RESOURCE = { diff --git a/sysinv/sysinv/sysinv/sysinv/common/utils.py b/sysinv/sysinv/sysinv/sysinv/common/utils.py index 569ed17320..f5feebba7d 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/common/utils.py @@ -464,7 +464,7 @@ def is_valid_hex(num): def is_valid_pci_device_vendor_id(id): """Check if the provided id is a valid 16 bit hexadecimal.""" - val = id.replace('0x','').strip() + val = id.replace('0x', '').strip() if not is_valid_hex(id): return False if (len(val) > 4): @@ -474,7 +474,7 @@ def is_valid_pci_device_vendor_id(id): def is_valid_pci_class_id(id): """Check if the provided id is a valid 16 bit hexadecimal.""" - val = id.replace('0x','').strip() + val = id.replace('0x', '').strip() if not is_valid_hex(id): return False if (len(val) > 6): diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index fde506e89e..f025df45ae 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -278,7 +278,7 @@ class ConductorManager(service.PeriodicService): # set default storage_backend values.update({'backend': constants.SB_TYPE_FILE, 'name': constants.SB_DEFAULT_NAMES[constants.SB_TYPE_FILE], - 'state':constants.SB_STATE_CONFIGURED, + 'state': constants.SB_STATE_CONFIGURED, 'task': constants.SB_TASK_NONE, 'services': None, 'capabilities': {}}) @@ -1665,7 +1665,7 @@ class ConductorManager(service.PeriodicService): for interface in iinterfaces: if constants.CLONE_ISO_MAC in interface['imac']: LOG.warn("Missing interface [{},{}] on the cloned host" - .format(interface['ifname'],interface['id'])) + .format(interface['ifname'], interface['id'])) raise exception.SysinvException(_( "Missing interface on the cloned host")) @@ -3845,7 +3845,7 @@ class ConductorManager(service.PeriodicService): self.dbapi.ipv_update( pv.uuid, {'pv_state': constants.PROVISIONED, - 'lvm_pv_name':constants.CINDER_DRBD_DEVICE}) + 'lvm_pv_name': constants.CINDER_DRBD_DEVICE}) self.dbapi.ilvg_update( pv.forilvgid, {'vg_state': constants.PROVISIONED}) @@ -4030,7 +4030,7 @@ class ConductorManager(service.PeriodicService): for ipv in ipvs: if ipv['pv_state'] != constants.PROVISIONED: host_id = ipv['forihostid'] - update_hosts_dict(host_id,constants.PV_AUDIT_REQUEST) + update_hosts_dict(host_id, constants.PV_AUDIT_REQUEST) # Make sure we get at least one good report for PVs & LVGs hosts = self.dbapi.ihost_get_list() @@ -4126,7 +4126,7 @@ class ConductorManager(service.PeriodicService): if (iscsi_initiator_name and ihost.iscsi_initiator_name is None): LOG.info("%s updating iscsi initiator=%s" % - (ihost.hostname,iscsi_initiator_name)) + (ihost.hostname, iscsi_initiator_name)) val['iscsi_initiator_name'] = iscsi_initiator_name if val: @@ -4958,7 +4958,7 @@ class ConductorManager(service.PeriodicService): self.dbapi, constants.SB_TYPE_LVM): pools = self._openstack.get_cinder_pools() for pool in pools: - if getattr(pool,'volume_backend_name','') == constants.CINDER_BACKEND_LVM: + if getattr(pool, 'volume_backend_name', '') == constants.CINDER_BACKEND_LVM: return pool.to_dict() return None @@ -5610,7 +5610,7 @@ class ConductorManager(service.PeriodicService): config_dict = {"personalities": personalities, "host_uuids": [ctrl.uuid for ctrl in valid_ctrls], "classes": classes, - puppet_common.REPORT_STATUS_CFG: report_config,} + puppet_common.REPORT_STATUS_CFG: report_config, } # TODO(oponcea) once sm supports in-service config reload always # set reboot=False @@ -5702,7 +5702,7 @@ class ConductorManager(service.PeriodicService): self.dbapi.storage_ceph_update(sb_uuid, {'state': constants.SB_STATE_CONFIGURING, - 'task':str({h.hostname: constants.SB_TASK_APPLY_MANIFESTS for h in valid_ctrls})}) + 'task': str({h.hostname: constants.SB_TASK_APPLY_MANIFESTS for h in valid_ctrls})}) self._config_apply_runtime_manifest(context, config_uuid, config_dict) @@ -8733,7 +8733,7 @@ class ConductorManager(service.PeriodicService): LOG.info("Calling nova cleanup") with open(os.devnull, "w") as fnull: try: - subprocess.check_call(["systemctl","start","nova-cleanup"], + subprocess.check_call(["systemctl", "start", "nova-cleanup"], stdout=fnull, stderr=fnull) except subprocess.CalledProcessError: @@ -9098,7 +9098,7 @@ class ConductorManager(service.PeriodicService): pools = self._openstack.get_cinder_pools() if pools is not None: for pool in pools: - volume_backend = getattr(pool,'volume_backend_name','') + volume_backend = getattr(pool, 'volume_backend_name', '') if volume_backend and volume_backend != constants.CINDER_BACKEND_LVM and \ volume_backend != constants.CINDER_BACKEND_CEPH: return True diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/openstack.py b/sysinv/sysinv/sysinv/sysinv/conductor/openstack.py index 1860c59933..06391edddd 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/openstack.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/openstack.py @@ -855,7 +855,7 @@ class OpenStackOperator(object): ceph_mon_info['ceph-mon-0-ip'] = ceph_mon_ips.get( 'ceph-mon-0-ip', '') ceph_mon_info['ceph-mon-1-ip'] = ceph_mon_ips.get( - 'ceph-mon-1-ip','') + 'ceph-mon-1-ip', '') ceph_mon_info['ceph-mon-2-ip'] = ceph_mon_ips.get( 'ceph-mon-2-ip', '') else: diff --git a/sysinv/sysinv/sysinv/sysinv/openstack/common/keystone_objects.py b/sysinv/sysinv/sysinv/sysinv/openstack/common/keystone_objects.py index 6f2088e96b..45a05fb81e 100644 --- a/sysinv/sysinv/sysinv/sysinv/openstack/common/keystone_objects.py +++ b/sysinv/sysinv/sysinv/sysinv/openstack/common/keystone_objects.py @@ -54,14 +54,14 @@ class Token(object): Search the catalog of a service for the administrative url Returns: admin url or None on failure """ - return self._get_service_url(service_type, service_name,'admin') + return self._get_service_url(service_type, service_name, 'admin') def get_service_internal_url(self, service_type, service_name): """ Search the catalog of a service for the administrative url Returns: admin url or None on failure """ - return self._get_service_url(service_type,service_name, 'internal') + return self._get_service_url(service_type, service_name, 'internal') def get_service_public_url(self, service_type, service_name): """ diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/glance.py b/sysinv/sysinv/sysinv/sysinv/puppet/glance.py index d3e032f354..36e12dbc54 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/glance.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/glance.py @@ -195,7 +195,7 @@ class GlancePuppet(openstack.OpenstackBasePuppet): config.update({'openstack::glance::params::rbd_store_pool': rbd_store_pool, 'openstack::glance::params::rbd_store_ceph_conf': - rbd_store_ceph_conf,}) + rbd_store_ceph_conf, }) # set remote registry auth_url for subcloud if (self._distributed_cloud_role() == diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/ironic.py b/sysinv/sysinv/sysinv/sysinv/puppet/ironic.py index c41fbf05b3..b2e8df0044 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/ironic.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/ironic.py @@ -64,7 +64,7 @@ class IronicPuppet(openstack.OpenstackBasePuppet): 'ironic::neutron::api_endpoint': self._operator.neutron.get_internal_url(), 'ironic::neutron::auth_url': self._keystone_auth_uri(), 'ironic::neutron::project_name': self._get_service_tenant_name(), - 'ironic::neutron::user_domain_name':self._get_service_user_domain_name(), + 'ironic::neutron::user_domain_name': self._get_service_user_domain_name(), 'ironic::neutron::project_domain_name': self._get_service_project_domain_name(), # Populate Glance credentials 'ironic::glance::auth_url': self._keystone_auth_uri(), diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/magnum.py b/sysinv/sysinv/sysinv/sysinv/puppet/magnum.py index cebe2833df..e4ec2ff694 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/magnum.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/magnum.py @@ -74,7 +74,7 @@ class MagnumPuppet(openstack.OpenstackBasePuppet): 'magnum::keystone::authtoken::user_domain_name': self._get_service_user_domain_name(), 'magnum::keystone::authtoken::project_domain_name': - self._get_service_project_domain_name(),}) + self._get_service_project_domain_name(), }) return config def get_secure_system_config(self): diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/murano.py b/sysinv/sysinv/sysinv/sysinv/puppet/murano.py index 24ba6705a7..93a91f792f 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/murano.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/murano.py @@ -55,7 +55,7 @@ class MuranoPuppet(openstack.OpenstackBasePuppet): 'murano::keystone::auth::auth_name': ksuser, 'murano::keystone::auth::region': self._region_name(), 'murano::keystone::auth::tenant': - self._get_service_tenant_name(),}) + self._get_service_tenant_name(), }) return config diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/nova.py b/sysinv/sysinv/sysinv/sysinv/puppet/nova.py index fe9b825db3..d3a018740c 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/nova.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/nova.py @@ -490,7 +490,7 @@ class NovaPuppet(openstack.OpenstackBasePuppet): 'openstack::nova::storage::instances_lv_size': "%sm" % instances_lv_size, 'openstack::nova::storage::concurrent_disk_operations': - concurrent_disk_operations,} + concurrent_disk_operations, } # If NOVA is a service on a ceph-external backend, use the ephemeral_pool # and ceph_conf file that are stored in that DB entry. @@ -510,7 +510,7 @@ class NovaPuppet(openstack.OpenstackBasePuppet): values.update({'openstack::nova::storage::images_rbd_pool': images_rbd_pool, 'openstack::nova::storage::images_rbd_ceph_conf': - images_rbd_ceph_conf,}) + images_rbd_ceph_conf, }) return values # TODO(oponcea): Make lvm global_filter generic @@ -576,7 +576,7 @@ class NovaPuppet(openstack.OpenstackBasePuppet): def _get_shared_pcpu_map(self, host): shared_cpus = self._get_host_cpu_list( host, function=constants.SHARED_FUNCTION, threads=True) - cpu_map = {c.numa_node:c.cpu for c in shared_cpus} + cpu_map = {c.numa_node: c.cpu for c in shared_cpus} return "\"%s\"" % ','.join( "%r:%r" % (node, cpu) for node, cpu in cpu_map.items()) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/api/test_invservers.py b/sysinv/sysinv/sysinv/sysinv/tests/api/test_invservers.py index 6525192263..529a16e746 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/api/test_invservers.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/api/test_invservers.py @@ -149,7 +149,7 @@ class TestListServers(base.FunctionalTest): for id in xrange(1000): # there is a limit of 1000 returned by json ndict = dbutils.get_test_ihost(id=id, hostname=id, mgmt_mac=id, forisystemid=self.system.id, - mgmt_ip="%s.%s.%s.%s" % (id,id,id,id), + mgmt_ip="%s.%s.%s.%s" % (id, id, id, id), uuid=uuidutils.generate_uuid()) s = self.dbapi.ihost_create(ndict) ihosts.append(s['uuid']) @@ -174,7 +174,7 @@ class TestListServers(base.FunctionalTest): for id in xrange(100): ndict = dbutils.get_test_ihost(id=id, hostname=id, mgmt_mac=id, forisystemid=self.system.id, - mgmt_ip="%s.%s.%s.%s" % (id,id,id,id), + mgmt_ip="%s.%s.%s.%s" % (id, id, id, id), uuid=uuidutils.generate_uuid()) ihost = self.dbapi.ihost_create(ndict) ihosts.append(ihost['uuid']) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/api/test_storage_tier.py b/sysinv/sysinv/sysinv/sysinv/tests/api/test_storage_tier.py index f16e2d2ddb..5d5a7b8720 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/api/test_storage_tier.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/api/test_storage_tier.py @@ -625,7 +625,7 @@ class StorageTierDependentTCs(base.FunctionalTest): with nested(mock.patch.object(ceph_utils.CephApiOperator, 'get_monitors_status'), mock.patch.object(StorageBackendConfig, 'has_backend_configured'), - mock.patch.object(rpcapi.ConductorAPI,'configure_osd_istor')) as ( + mock.patch.object(rpcapi.ConductorAPI, 'configure_osd_istor')) as ( mock_mon_status, mock_backend_configured, mock_osd): def fake_configure_osd_istor(context, istor_obj): @@ -691,7 +691,7 @@ class StorageTierDependentTCs(base.FunctionalTest): with nested(mock.patch.object(ceph_utils.CephApiOperator, 'get_monitors_status'), mock.patch.object(StorageBackendConfig, 'has_backend_configured'), - mock.patch.object(rpcapi.ConductorAPI,'configure_osd_istor')) as ( + mock.patch.object(rpcapi.ConductorAPI, 'configure_osd_istor')) as ( mock_mon_status, mock_backend_configured, mock_osd): def fake_configure_osd_istor(context, istor_obj): @@ -715,7 +715,7 @@ class StorageTierDependentTCs(base.FunctionalTest): with nested(mock.patch.object(ceph_utils.CephApiOperator, 'get_monitors_status'), mock.patch.object(StorageBackendConfig, 'has_backend_configured'), - mock.patch.object(rpcapi.ConductorAPI,'configure_osd_istor')) as ( + mock.patch.object(rpcapi.ConductorAPI, 'configure_osd_istor')) as ( mock_mon_status, mock_backend_configured, mock_osd): def fake_configure_osd_istor(context, istor_obj): @@ -788,7 +788,7 @@ class StorageTierDependentTCs(base.FunctionalTest): values = { 'backend': constants.SB_TYPE_CEPH, 'capabilities': {'test_bparam3': 'foo'}, - 'name':'ceph-gold', + 'name': 'ceph-gold', 'confirmed': True } with nested(mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses'), @@ -807,7 +807,7 @@ class StorageTierDependentTCs(base.FunctionalTest): 'capabilities': {'test_bparam3': 'one', 'test_cparam3': 'two'}, 'services': constants.SB_SVC_CINDER, - 'name':'ceph-gold', + 'name': 'ceph-gold', 'tier_uuid': saved_tier_uuid, 'confirmed': True } diff --git a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_ceph.py b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_ceph.py index ca895412ea..eba3e36611 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_ceph.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_ceph.py @@ -266,7 +266,7 @@ class UpdateCephCluster(base.DbTestCase): peers = self.dbapi.peers_get_all_by_cluster(cluster_uuid) self.assertEqual( set([(p.name, tuple(sorted(p.hosts))) for p in peers]), - {('group-0', ('storage-0',)),}) + {('group-0', ('storage-0',)), }) storage_1 = self._create_storage_ihost('storage-1') self.service._ceph.update_ceph_cluster(storage_1) @@ -279,7 +279,7 @@ class UpdateCephCluster(base.DbTestCase): peers = self.dbapi.peers_get_all_by_cluster(cluster_uuid) self.assertEqual( set([(p.name, tuple(sorted(p.hosts))) for p in peers]), - {('group-0', ('storage-0', 'storage-1')),}) + {('group-0', ('storage-0', 'storage-1')), }) storage_2 = self._create_storage_ihost('storage-2') self.service._ceph.update_ceph_cluster(storage_2) @@ -401,7 +401,7 @@ class UpdateCephCluster(base.DbTestCase): peers = self.dbapi.peers_get_all_by_cluster(cluster_uuid) self.assertEqual( set([(p.name, tuple(sorted(p.hosts))) for p in peers]), - {('group-0', ('storage-0',)),}) + {('group-0', ('storage-0',)), }) storage_1 = self._create_storage_ihost('storage-1') self.service._ceph.update_ceph_cluster(storage_1) @@ -414,7 +414,7 @@ class UpdateCephCluster(base.DbTestCase): peers = self.dbapi.peers_get_all_by_cluster(cluster_uuid) self.assertEqual( set([(p.name, tuple(sorted(p.hosts))) for p in peers]), - {('group-0', ('storage-0', 'storage-1')),}) + {('group-0', ('storage-0', 'storage-1')), }) storage_2 = self._create_storage_ihost('storage-2') self.service._ceph.update_ceph_cluster(storage_2) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/db/sqlalchemy/test_migrations.py b/sysinv/sysinv/sysinv/sysinv/tests/db/sqlalchemy/test_migrations.py index 2038d62316..fd59f303c5 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/db/sqlalchemy/test_migrations.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/db/sqlalchemy/test_migrations.py @@ -704,7 +704,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): 'deleted_at': 'DateTime', 'task': 'String', 'location': 'Text', 'created_at': 'DateTime', 'updated_at': 'DateTime', 'uptime': 'Integer', 'capabilities': 'Text', 'config_status': 'String', 'config_applied': 'String', - 'config_target': 'String','forisystemid': 'Integer' + 'config_target': 'String', 'forisystemid': 'Integer' } for col, coltype in servers_col.items(): self.assertTrue(isinstance(servers.c[col].type, @@ -1241,7 +1241,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): sensors_analog = db_utils.get_table(engine, 'i_sensors_analog') sensors_analog_col = { 'id': 'Integer', 'deleted_at': 'DateTime', 'created_at': 'DateTime', - 'updated_at': 'DateTime','unit_base': 'String', 'unit_modifier': 'String', + 'updated_at': 'DateTime', 'unit_base': 'String', 'unit_modifier': 'String', 'unit_rate': 'String', 't_minor_lower': 'String', 't_minor_upper': 'String', 't_major_lower': 'String', 't_major_upper': 'String', 't_critical_lower': 'String', 't_critical_upper': 'String', @@ -1253,7 +1253,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): pci_devices = db_utils.get_table(engine, 'pci_devices') pci_devices_col = { 'id': 'Integer', 'uuid': 'String', 'deleted_at': 'DateTime', - 'created_at': 'DateTime', 'updated_at': 'DateTime','host_id': 'Integer', + 'created_at': 'DateTime', 'updated_at': 'DateTime', 'host_id': 'Integer', 'name': 'String', 'pciaddr': 'String', 'pclass_id': 'String', 'pvendor_id': 'String', 'pdevice_id': 'String', 'pclass': 'String', 'pvendor': 'String', 'pdevice': 'String', 'psvendor': 'String', 'psdevice': 'String', 'numa_node': 'Integer', @@ -1267,7 +1267,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): loads = db_utils.get_table(engine, 'loads') loads_col = { 'id': 'Integer', 'uuid': 'String', 'deleted_at': 'DateTime', - 'created_at': 'DateTime', 'updated_at': 'DateTime','state': 'String', + 'created_at': 'DateTime', 'updated_at': 'DateTime', 'state': 'String', 'software_version': 'String', 'compatible_version': 'String', 'required_patches': 'String', } @@ -1278,7 +1278,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): software_upgrade = db_utils.get_table(engine, 'software_upgrade') software_upgrade_col = { 'id': 'Integer', 'uuid': 'String', 'deleted_at': 'DateTime', - 'created_at': 'DateTime', 'updated_at': 'DateTime','state': 'String', + 'created_at': 'DateTime', 'updated_at': 'DateTime', 'state': 'String', 'from_load': 'Integer', 'to_load': 'Integer', } for col, coltype in software_upgrade_col.items(): @@ -1343,7 +1343,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): self.assertTrue(isinstance(storconfigs.c[col].type, getattr(sqlalchemy.types, coltype))) # make sure the rename worked properly - self.assertColumnNotExists(engine, 'i_storconfig','glance_gib') + self.assertColumnNotExists(engine, 'i_storconfig', 'glance_gib') self.assertColumnExists(engine, 'i_storconfig', 'glance_pool_gib') def _check_032(self, engine, data): @@ -1469,7 +1469,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): # Assert data types for 5 new columns in table "i_storconfig" storconfigs = db_utils.get_table(engine, 'i_storconfig') storconfigs_cols = { - 'state':'String', + 'state': 'String', 'task': 'String', 'ceph_mon_gib': 'Integer', 'ceph_mon_dev_ctrl0': 'String', @@ -1533,7 +1533,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin): # Assert data types for all columns in new table "i_horizon_lockout" horizon_lockout = db_utils.get_table(engine, 'i_horizon_lockout') horizon_lockout_cols = { - 'lockout_time':'Integer', + 'lockout_time': 'Integer', 'lockout_retries': 'Integer', } for col, coltype in horizon_lockout_cols.items(): diff --git a/sysinv/sysinv/sysinv/sysinv/tests/db/test_sysinv.py b/sysinv/sysinv/sysinv/sysinv/tests/db/test_sysinv.py index ec801b6e97..892d21f292 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/db/test_sysinv.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/db/test_sysinv.py @@ -195,7 +195,7 @@ class DbNodeTestCase(base.DbTestCase): f = self._create_test_storage_backend_with_file() ll = self._create_test_storage_backend_with_lvm() res = self.dbapi.storage_backend_get_list(sort_key='backend') - self.assertEqual(len(res),3) + self.assertEqual(len(res), 3) self.assertEqual(c['backend'], res[0]['backend']) self.assertEqual(f['backend'], res[1]['backend']) self.assertEqual(ll['backend'], res[2]['backend']) @@ -206,7 +206,7 @@ class DbNodeTestCase(base.DbTestCase): ll = self._create_test_storage_backend_with_lvm() res = self.dbapi.storage_backend_get_by_isystem(self.system['id'], sort_key='backend') - self.assertEqual(len(res),3) + self.assertEqual(len(res), 3) self.assertEqual(c['backend'], res[0]['backend']) self.assertEqual(f['backend'], res[1]['backend']) self.assertEqual(ll['backend'], res[2]['backend']) @@ -224,7 +224,7 @@ class DbNodeTestCase(base.DbTestCase): f = self._create_test_storage_backend_with_file() ll = self._create_test_storage_backend_with_lvm() res = self.dbapi.storage_backend_get_list(sort_key='backend') - self.assertEqual(len(res),3) + self.assertEqual(len(res), 3) self.assertEqual(c['backend'], res[0]['backend']) self.assertEqual(f['backend'], res[1]['backend']) self.assertEqual(ll['backend'], res[2]['backend']) @@ -281,7 +281,7 @@ class DbNodeTestCase(base.DbTestCase): def test_storage_file_get_list(self): n = self._create_test_storage_backend_file() res = self.dbapi.storage_file_get_list() - self.assertEqual(len(res),1) + self.assertEqual(len(res), 1) self.assertEqual(n['backend'], res[0]['backend']) self.assertEqual(n['uuid'], res[0]['uuid']) @@ -326,7 +326,7 @@ class DbNodeTestCase(base.DbTestCase): def test_storage_lvm_get_list(self): n = self._create_test_storage_backend_lvm() res = self.dbapi.storage_lvm_get_list() - self.assertEqual(len(res),1) + self.assertEqual(len(res), 1) self.assertEqual(n['backend'], res[0]['backend']) self.assertEqual(n['uuid'], res[0]['uuid']) @@ -373,7 +373,7 @@ class DbNodeTestCase(base.DbTestCase): def test_storage_ceph_get_list(self): n = self._create_test_storage_backend_ceph() res = self.dbapi.storage_ceph_get_list() - self.assertEqual(len(res),1) + self.assertEqual(len(res), 1) self.assertEqual(n['backend'], res[0]['backend']) self.assertEqual(n['uuid'], res[0]['uuid']) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py b/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py index c14eec7d16..28c6da7112 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py @@ -435,7 +435,7 @@ def get_test_stor(**kw): stor = { 'id': kw.get('id', 2), 'function': kw.get('function'), - 'idisk_uuid':kw.get('idisk_uuid', 2), + 'idisk_uuid': kw.get('idisk_uuid', 2), 'forihostid': kw.get('forihostid', 2), 'forilvgid': kw.get('forilvgid', 2), } @@ -474,7 +474,7 @@ def get_test_storage_backend(**kw): 'state': kw.get('state', None), 'task': kw.get('task', None), 'services': kw.get('services', None), - 'capabilities': kw.get('capabilities',{}), + 'capabilities': kw.get('capabilities', {}), 'forisystemid': kw.get('forisystemid', None) } return inv @@ -490,13 +490,13 @@ def get_test_ceph_storage_backend(**kw): 'task': kw.get('task', None), 'services': kw.get('services', None), 'tier_id': kw.get('tier_id'), - 'capabilities': kw.get('capabilities',{}), + 'capabilities': kw.get('capabilities', {}), 'forisystemid': kw.get('forisystemid', None), - 'cinder_pool_gib': kw.get('cinder_pool_gib',80), + 'cinder_pool_gib': kw.get('cinder_pool_gib', 80), 'glance_pool_gib': kw.get('glance_pool_gib', 10), 'ephemeral_pool_gib': kw.get('ephemeral_pool_gib', 0), 'object_pool_gib': kw.get('object_pool_gib', 0), - 'object_gateway':kw.get('object_gateway', False) + 'object_gateway': kw.get('object_gateway', False) } return inv @@ -510,7 +510,7 @@ def get_test_file_storage_backend(**kw): 'state': kw.get('state', None), 'task': kw.get('task', None), 'services': kw.get('services', None), - 'capabilities': kw.get('capabilities',{}), + 'capabilities': kw.get('capabilities', {}), 'forisystemid': kw.get('forisystemid', None) } return inv @@ -525,7 +525,7 @@ def get_test_lvm_storage_backend(**kw): 'state': kw.get('state', None), 'task': kw.get('task', None), 'services': kw.get('services', None), - 'capabilities': kw.get('capabilities',{}), + 'capabilities': kw.get('capabilities', {}), 'forisystemid': kw.get('forisystemid', None) } return inv diff --git a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py index f9dd61325d..44197932d6 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py @@ -1352,7 +1352,7 @@ class InterfaceTestCase(BaseTestCase): port0, iface0 = self._create_sriov_cx3_if_test(ifname0, vf_num) port1, iface1 = self._create_sriov_cx3_if_test( - ifname1, vf_num, pciaddr=port0['pciaddr'],dev_id=1) + ifname1, vf_num, pciaddr=port0['pciaddr'], dev_id=1) self._update_context() expected = "%s-%d;0;0" % (port0['pciaddr'], vf_num) diff --git a/sysinv/sysinv/sysinv/tox.ini b/sysinv/sysinv/sysinv/tox.ini index de6292d9aa..4a1ffaa472 100644 --- a/sysinv/sysinv/sysinv/tox.ini +++ b/sysinv/sysinv/sysinv/tox.ini @@ -81,7 +81,7 @@ commands = # H231..H238 are python3 compatability # H401,H403,H404,H405 are docstring and not important [flake8] -ignore = E501,E127,E128,E231,E402,E126,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405 +ignore = E501,E127,E128,E402,E126,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405 builtins = _ [testenv:flake8]