Enable Flake8 Whitespace Errors
Flake8 currently ignores a number of whitespace related errors: E201: whitespace after '[' E202: whitespace before '}' E203: whitespace before ':' E211: whitespace before '(' E221: multiple spaces before operator E222: multiple spaces after operator E225: missing whitespace around operator E226: missing whitespace around arithmetic operator E231: missing whitespace after ',' E251: unexpected spaces around keyword / parameter equals E261: at least two spaces before inline comment Enable them for more thorough testing of code Change-Id: Id03f36070b8f16694a12f4d36858680b6e00d530 Story: 2004515 Task: 30076 Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
This commit is contained in:
parent
b178e49c43
commit
4a927e0f8a
ceph/ceph-manager/ceph-manager/ceph_manager
tools/engtools/hostdata-collectors/scripts
utilities
logmgmt/logmgmt/logmgmt
platform-util/platform-util/platform_util/license
@ -238,7 +238,7 @@ class Monitor(HandleUpgradesMixin):
|
||||
self.tiers_size = self._get_tiers_size()
|
||||
|
||||
# Make sure any removed tiers have the alarms cleared
|
||||
for t in (set(previous_tiers_size)-set(self.tiers_size)):
|
||||
for t in (set(previous_tiers_size) - set(self.tiers_size)):
|
||||
self._clear_fault(fm_constants.FM_ALARM_ID_STORAGE_CEPH_FREE_SPACE,
|
||||
"{0}.tier={1}".format(
|
||||
self.service.entity_instance_id,
|
||||
@ -378,7 +378,7 @@ class Monitor(HandleUpgradesMixin):
|
||||
return 0
|
||||
else:
|
||||
try:
|
||||
quota_gib = int(quota["output"]["quota_max_bytes"])/(1024**3)
|
||||
quota_gib = int(quota["output"]["quota_max_bytes"]) / (1024**3)
|
||||
return quota_gib
|
||||
except IOError:
|
||||
return 0
|
||||
@ -467,7 +467,7 @@ class Monitor(HandleUpgradesMixin):
|
||||
if (chassis_size == 0 or
|
||||
chassis_size > host['kb']):
|
||||
chassis_size = host['kb']
|
||||
tier_size += chassis_size/(1024 ** 2)
|
||||
tier_size += chassis_size / (1024**2)
|
||||
tier_sizes[tier['name']] = tier_size
|
||||
|
||||
return tier_sizes
|
||||
@ -705,7 +705,7 @@ class Monitor(HandleUpgradesMixin):
|
||||
|
||||
return (
|
||||
msg['head'] +
|
||||
(health['health'] + lbracket + parsed_reasons_text)[:max_size-1] +
|
||||
(health['health'] + lbracket + parsed_reasons_text)[:max_size - 1] +
|
||||
rbracket + msg['tail'])
|
||||
|
||||
def _report_fault(self, health, alarm_id):
|
||||
@ -834,7 +834,7 @@ class Monitor(HandleUpgradesMixin):
|
||||
alarm_list[alarm].entity_instance_id.find("group-"))
|
||||
group_instance_name = (
|
||||
"group-" +
|
||||
alarm_list[alarm].entity_instance_id[group_id+6])
|
||||
alarm_list[alarm].entity_instance_id[group_id + 6])
|
||||
if group_name == group_instance_name:
|
||||
self.service.fm_api.clear_fault(
|
||||
fm_constants.FM_ALARM_ID_STORAGE_CEPH_MAJOR,
|
||||
|
@ -55,17 +55,17 @@ class BuddyInfo(object):
|
||||
buddyhash = defaultdict(list)
|
||||
buddyinfo = open("/proc/buddyinfo").readlines()
|
||||
for line in map(self.parse_line, buddyinfo):
|
||||
numa_node = int(line["numa_node"])
|
||||
numa_node = int(line["numa_node"])
|
||||
zone = line["zone"]
|
||||
free_fragments = [int(nr) for nr in line["nr_free"].split()]
|
||||
max_order = len(free_fragments)
|
||||
fragment_sizes = self.get_order_sizes(max_order)
|
||||
usage_in_bytes = [block[0] * block[1] for block in zip(free_fragments, fragment_sizes)]
|
||||
usage_in_bytes = [block[0] * block[1] for block in zip(free_fragments, fragment_sizes)]
|
||||
buddyhash[numa_node].append({
|
||||
"zone": zone,
|
||||
"nr_free": free_fragments,
|
||||
"sz_fragment": fragment_sizes,
|
||||
"usage": usage_in_bytes })
|
||||
"usage": usage_in_bytes})
|
||||
return buddyhash
|
||||
|
||||
def load_buddyinfo(self):
|
||||
@ -95,9 +95,9 @@ class BuddyInfo(object):
|
||||
ret_string += '\t{order:{align}{width}} {nr:{align}{width}} {usage:{align}{width}}\n'.format(
|
||||
width=width,
|
||||
align="<",
|
||||
order = zoneinfo.get("sz_fragment")[idx],
|
||||
nr = zoneinfo.get("nr_free")[idx],
|
||||
usage = zoneinfo.get("usage")[idx] / 1024.0)
|
||||
order=zoneinfo.get("sz_fragment")[idx],
|
||||
nr=zoneinfo.get("nr_free")[idx],
|
||||
usage=zoneinfo.get("usage")[idx] / 1024.0)
|
||||
|
||||
return ret_string
|
||||
|
||||
@ -105,7 +105,7 @@ def main():
|
||||
"""Main function. Called when this file is a shell script"""
|
||||
usage = "usage: %prog [options]"
|
||||
parser = optparse.OptionParser(usage)
|
||||
parser.add_option("-s", "--size", dest="size", choices=["B","K","M"],
|
||||
parser.add_option("-s", "--size", dest="size", choices=["B", "K", "M"],
|
||||
action="store", type="choice", help="Return results in bytes, kib, mib")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
@ -172,7 +172,7 @@ def collectMemstats(influx_info, node, ci, services, syseng_services, openstack_
|
||||
fields[gsvc]["vsz"] += vsz
|
||||
|
||||
elif svc == "postgres":
|
||||
if (len(line) <= i+2):
|
||||
if (len(line) <= i + 2):
|
||||
# Command line could be "sudo su postgres", skip it
|
||||
break
|
||||
|
||||
@ -293,7 +293,7 @@ def collectSchedtop(influx_info, node, ci, services, syseng_services, openstack_
|
||||
fields[gsvc] += occ
|
||||
|
||||
elif svc == "postgres":
|
||||
if (len(line) <= i+2):
|
||||
if (len(line) <= i + 2):
|
||||
# Command line could be "sudo su postgres", skip it
|
||||
break
|
||||
|
||||
|
@ -25,16 +25,16 @@ from logmgmt import prepostrotate
|
||||
###################
|
||||
# CONSTANTS
|
||||
###################
|
||||
LOG_DIR = '/var/lib/logmgmt'
|
||||
LOG_DIR = '/var/lib/logmgmt'
|
||||
LOG_FILE = LOG_DIR + '/logmgmt.log'
|
||||
PID_FILE = '/var/run/logmgmt.pid'
|
||||
LOG_FILE_MAX_BYTES = 1024*1024
|
||||
LOG_FILE_MAX_BYTES = 1024 * 1024
|
||||
LOG_FILE_BACKUP_COUNT = 5
|
||||
|
||||
PERCENT_FREE_CRITICAL = 10
|
||||
PERCENT_FREE_MAJOR = 20
|
||||
|
||||
LOGROTATE_PERIOD = 600 # Every ten minutes
|
||||
LOGROTATE_PERIOD = 600 # Every ten minutes
|
||||
|
||||
###################
|
||||
# METHODS
|
||||
|
@ -51,7 +51,7 @@ VERSION_LICENSE_ERR = "License file does not support this version"
|
||||
# License limits
|
||||
LICENSE_DATE_TEXT_MAX_CHAR = 32
|
||||
LICENSE_ERR_MSG_MAX_CHAR = 512
|
||||
LICENSE_VENDOR_MAX_CHAR =128
|
||||
LICENSE_VENDOR_MAX_CHAR = 128
|
||||
|
||||
# Package name prefix
|
||||
PACKAGE_PREFIX = "NL_TS"
|
||||
|
@ -191,7 +191,7 @@ def verify_license(license_file):
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) == 2 :
|
||||
if len(sys.argv) == 2:
|
||||
licensefile = sys.argv[1]
|
||||
else:
|
||||
print("Usage: verify-license <license file>")
|
||||
|
Loading…
x
Reference in New Issue
Block a user