mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
pre-commit: enable Python Flake8 rule E713 (#9016)
Co-authored-by: Vishesh <vishesh92@gmail.com>
This commit is contained in:
parent
1144f5258d
commit
b69cc0272d
3
.github/linters/.flake8
vendored
3
.github/linters/.flake8
vendored
@ -24,6 +24,7 @@
|
||||
# E242 Tab after ','
|
||||
# E273 Tab after keyword
|
||||
# E274 Tab before keyword
|
||||
# E713 Test for membership should be 'not in'
|
||||
# E742 Do not define classes named 'I', 'O', or 'l'
|
||||
# E743 Do not define functions named 'I', 'O', or 'l'
|
||||
# E901 SyntaxError or IndentationError
|
||||
@ -37,4 +38,4 @@
|
||||
exclude =
|
||||
.git,
|
||||
venv
|
||||
select = E112,E113,E133,E223,E224,E227,E242,E273,E274,E742,E743,E901,E902,W291,W292,W293,W391
|
||||
select = E112,E113,E133,E223,E224,E227,E242,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391
|
||||
|
||||
@ -75,7 +75,7 @@ def asciiLoads(jStr):
|
||||
|
||||
def exceptionIfNoSuccess(str, errMsg=None):
|
||||
if not errMsg: errMsg = str
|
||||
if not "success" in str: raise Exception("%s (%s)"%(errMsg, str))
|
||||
if "success" not in str: raise Exception("%s (%s)"%(errMsg, str))
|
||||
|
||||
def successToMap(str, sep=';'):
|
||||
if not str.startswith("success"): raise Exception(str)
|
||||
@ -135,7 +135,7 @@ def getDomId(vm_name):
|
||||
return execute("xm list | grep " + vm_name + " | awk '{print $2}'").strip()
|
||||
|
||||
def raiseExceptionIfFail(res):
|
||||
if not "success" in res and not "SUCC" in res: raise Exception(res)
|
||||
if "success" not in res and "SUCC" not in res: raise Exception(res)
|
||||
|
||||
def ipToHeartBeatFileName(ip):
|
||||
return ip.replace('.', '_') + "_HEARTBEAT"
|
||||
|
||||
@ -433,7 +433,7 @@ def setup_agent_config(configfile, host, zone, pod, cluster, guid, pubNic, prvNi
|
||||
if guid != None:
|
||||
confopts['guid'] = guid
|
||||
else:
|
||||
if not "guid" in confopts:
|
||||
if "guid" not in confopts:
|
||||
stderr("Generating GUID for this Agent")
|
||||
confopts['guid'] = uuidgen().stdout.strip()
|
||||
|
||||
@ -491,7 +491,7 @@ def setup_consoleproxy_config(configfile, host, zone, pod):
|
||||
confopts = dict([ m.split("=",1) for m in lines if "=" in m and not m.startswith("#") ])
|
||||
confposes = dict([ (m.split("=",1)[0],n) for n,m in enumerate(lines) if "=" in m and not m.startswith("#") ])
|
||||
|
||||
if not "guid" in confopts:
|
||||
if "guid" not in confopts:
|
||||
stderr("Generating GUID for this Console Proxy")
|
||||
confopts['guid'] = uuidgen().stdout.strip()
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ def writeIfNotHere(fileName, texts):
|
||||
texts = [ "%s\n" % t for t in texts ]
|
||||
need = False
|
||||
for t in texts:
|
||||
if not t in entries:
|
||||
if t not in entries:
|
||||
entries.append(t)
|
||||
need = True
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ class RRDUpdates:
|
||||
(cf, vm_or_host, uuid, param) = col_meta_data.split(':')
|
||||
if vm_or_host == 'vm':
|
||||
# Create a report for this VM if it doesn't exist
|
||||
if not uuid in self.vm_reports:
|
||||
if uuid not in self.vm_reports:
|
||||
self.vm_reports[uuid] = VMReport(uuid)
|
||||
# Update the VMReport with the col data and meta data
|
||||
vm_report = self.vm_reports[uuid]
|
||||
|
||||
@ -1102,7 +1102,7 @@ def add_network_rules(vm_name, vm_id, vm_ip, vm_ip6, signature, seqno, vmMac, ru
|
||||
|
||||
changes = check_rule_log_for_vm(vmName, vm_id, vm_ip, domId, signature, seqno)
|
||||
|
||||
if not 1 in changes:
|
||||
if 1 not in changes:
|
||||
logging.debug("Rules already programmed for vm " + vm_name)
|
||||
return True
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ def create_tunnel(bridge, remote_ip, key, src_host, dst_host):
|
||||
key_validation = lib.do_cmd(verify_interface_key)
|
||||
ip_validation = lib.do_cmd(verify_interface_ip)
|
||||
|
||||
if not key in str(key_validation) or not remote_ip in str(ip_validation):
|
||||
if key not in str(key_validation) or remote_ip not in str(ip_validation):
|
||||
logging.debug("WARNING: Unexpected output while verifying " +
|
||||
"interface %s on bridge %s" % (name, bridge))
|
||||
# return "FAILURE:VERIFY_INTERFACE_FAILED"
|
||||
|
||||
@ -2426,7 +2426,7 @@ class TestResourceTags(cloudstackTestCase):
|
||||
hosts.pop(0)
|
||||
host_ids = [host.id for host in hosts]
|
||||
for id in host_ids:
|
||||
if not id in host_ids_for_migration:
|
||||
if id not in host_ids_for_migration:
|
||||
self.fail("Not all hosts are available for vm migration")
|
||||
return
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ class TestScaleVm(cloudstackTestCase):
|
||||
result = str(
|
||||
sshClient.execute("service vmware-tools status")).lower()
|
||||
self.debug("and result is: %s" % result)
|
||||
if not "running" in result:
|
||||
if "running" not in result:
|
||||
self.skipTest("Skipping scale VM operation because\
|
||||
VMware tools are not installed on the VM")
|
||||
res = None
|
||||
@ -355,7 +355,7 @@ class TestScaleVm(cloudstackTestCase):
|
||||
result = str(
|
||||
sshClient.execute("service vmware-tools status")).lower()
|
||||
self.debug("and result is: %s" % result)
|
||||
if not "running" in result:
|
||||
if "running" not in result:
|
||||
self.skipTest("Skipping scale VM operation because\
|
||||
VMware tools are not installed on the VM")
|
||||
|
||||
@ -464,7 +464,7 @@ class TestScaleVm(cloudstackTestCase):
|
||||
result = str(
|
||||
sshClient.execute("service vmware-tools status")).lower()
|
||||
self.debug("and result is: %s" % result)
|
||||
if not "running" in result:
|
||||
if "running" not in result:
|
||||
self.skipTest("Skipping scale VM operation because\
|
||||
VMware tools are not installed on the VM")
|
||||
|
||||
@ -555,7 +555,7 @@ class TestScaleVm(cloudstackTestCase):
|
||||
result = str(
|
||||
sshClient.execute("service vmware-tools status")).lower()
|
||||
self.debug("and result is: %s" % result)
|
||||
if not "running" in result:
|
||||
if "running" not in result:
|
||||
self.skipTest("Skipping scale VM operation because\
|
||||
VMware tools are not installed on the VM")
|
||||
res = None
|
||||
@ -700,7 +700,7 @@ class TestScaleVm(cloudstackTestCase):
|
||||
result = str(
|
||||
sshClient.execute("service vmware-tools status")).lower()
|
||||
self.debug("and result is: %s" % result)
|
||||
if not "running" in result:
|
||||
if "running" not in result:
|
||||
self.skipTest("Skipping scale VM operation because\
|
||||
VMware tools are not installed on the VM")
|
||||
res = None
|
||||
|
||||
@ -183,7 +183,7 @@ class cloudstackTestCase(unittest.case.TestCase):
|
||||
sshClient.execute("service httpd start")
|
||||
time.sleep(5)
|
||||
ssh_response = str(sshClient.execute("service httpd status")).lower()
|
||||
if not "running" in ssh_response:
|
||||
if "running" not in ssh_response:
|
||||
raise Exception("Failed to start httpd service")
|
||||
self.debug("Setup webserver using apache")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user