mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01: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 ','
|
# E242 Tab after ','
|
||||||
# E273 Tab after keyword
|
# E273 Tab after keyword
|
||||||
# E274 Tab before keyword
|
# E274 Tab before keyword
|
||||||
|
# E713 Test for membership should be 'not in'
|
||||||
# E742 Do not define classes named 'I', 'O', or 'l'
|
# E742 Do not define classes named 'I', 'O', or 'l'
|
||||||
# E743 Do not define functions named 'I', 'O', or 'l'
|
# E743 Do not define functions named 'I', 'O', or 'l'
|
||||||
# E901 SyntaxError or IndentationError
|
# E901 SyntaxError or IndentationError
|
||||||
@ -37,4 +38,4 @@
|
|||||||
exclude =
|
exclude =
|
||||||
.git,
|
.git,
|
||||||
venv
|
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):
|
def exceptionIfNoSuccess(str, errMsg=None):
|
||||||
if not errMsg: errMsg = str
|
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=';'):
|
def successToMap(str, sep=';'):
|
||||||
if not str.startswith("success"): raise Exception(str)
|
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()
|
return execute("xm list | grep " + vm_name + " | awk '{print $2}'").strip()
|
||||||
|
|
||||||
def raiseExceptionIfFail(res):
|
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):
|
def ipToHeartBeatFileName(ip):
|
||||||
return ip.replace('.', '_') + "_HEARTBEAT"
|
return ip.replace('.', '_') + "_HEARTBEAT"
|
||||||
|
|||||||
@ -433,7 +433,7 @@ def setup_agent_config(configfile, host, zone, pod, cluster, guid, pubNic, prvNi
|
|||||||
if guid != None:
|
if guid != None:
|
||||||
confopts['guid'] = guid
|
confopts['guid'] = guid
|
||||||
else:
|
else:
|
||||||
if not "guid" in confopts:
|
if "guid" not in confopts:
|
||||||
stderr("Generating GUID for this Agent")
|
stderr("Generating GUID for this Agent")
|
||||||
confopts['guid'] = uuidgen().stdout.strip()
|
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("#") ])
|
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("#") ])
|
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")
|
stderr("Generating GUID for this Console Proxy")
|
||||||
confopts['guid'] = uuidgen().stdout.strip()
|
confopts['guid'] = uuidgen().stdout.strip()
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ def writeIfNotHere(fileName, texts):
|
|||||||
texts = [ "%s\n" % t for t in texts ]
|
texts = [ "%s\n" % t for t in texts ]
|
||||||
need = False
|
need = False
|
||||||
for t in texts:
|
for t in texts:
|
||||||
if not t in entries:
|
if t not in entries:
|
||||||
entries.append(t)
|
entries.append(t)
|
||||||
need = True
|
need = True
|
||||||
|
|
||||||
|
|||||||
@ -179,7 +179,7 @@ class RRDUpdates:
|
|||||||
(cf, vm_or_host, uuid, param) = col_meta_data.split(':')
|
(cf, vm_or_host, uuid, param) = col_meta_data.split(':')
|
||||||
if vm_or_host == 'vm':
|
if vm_or_host == 'vm':
|
||||||
# Create a report for this VM if it doesn't exist
|
# 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)
|
self.vm_reports[uuid] = VMReport(uuid)
|
||||||
# Update the VMReport with the col data and meta data
|
# Update the VMReport with the col data and meta data
|
||||||
vm_report = self.vm_reports[uuid]
|
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)
|
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)
|
logging.debug("Rules already programmed for vm " + vm_name)
|
||||||
return True
|
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)
|
key_validation = lib.do_cmd(verify_interface_key)
|
||||||
ip_validation = lib.do_cmd(verify_interface_ip)
|
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 " +
|
logging.debug("WARNING: Unexpected output while verifying " +
|
||||||
"interface %s on bridge %s" % (name, bridge))
|
"interface %s on bridge %s" % (name, bridge))
|
||||||
# return "FAILURE:VERIFY_INTERFACE_FAILED"
|
# return "FAILURE:VERIFY_INTERFACE_FAILED"
|
||||||
|
|||||||
@ -2426,7 +2426,7 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
hosts.pop(0)
|
hosts.pop(0)
|
||||||
host_ids = [host.id for host in hosts]
|
host_ids = [host.id for host in hosts]
|
||||||
for id in host_ids:
|
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")
|
self.fail("Not all hosts are available for vm migration")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -221,7 +221,7 @@ class TestScaleVm(cloudstackTestCase):
|
|||||||
result = str(
|
result = str(
|
||||||
sshClient.execute("service vmware-tools status")).lower()
|
sshClient.execute("service vmware-tools status")).lower()
|
||||||
self.debug("and result is: %s" % result)
|
self.debug("and result is: %s" % result)
|
||||||
if not "running" in result:
|
if "running" not in result:
|
||||||
self.skipTest("Skipping scale VM operation because\
|
self.skipTest("Skipping scale VM operation because\
|
||||||
VMware tools are not installed on the VM")
|
VMware tools are not installed on the VM")
|
||||||
res = None
|
res = None
|
||||||
@ -355,7 +355,7 @@ class TestScaleVm(cloudstackTestCase):
|
|||||||
result = str(
|
result = str(
|
||||||
sshClient.execute("service vmware-tools status")).lower()
|
sshClient.execute("service vmware-tools status")).lower()
|
||||||
self.debug("and result is: %s" % result)
|
self.debug("and result is: %s" % result)
|
||||||
if not "running" in result:
|
if "running" not in result:
|
||||||
self.skipTest("Skipping scale VM operation because\
|
self.skipTest("Skipping scale VM operation because\
|
||||||
VMware tools are not installed on the VM")
|
VMware tools are not installed on the VM")
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ class TestScaleVm(cloudstackTestCase):
|
|||||||
result = str(
|
result = str(
|
||||||
sshClient.execute("service vmware-tools status")).lower()
|
sshClient.execute("service vmware-tools status")).lower()
|
||||||
self.debug("and result is: %s" % result)
|
self.debug("and result is: %s" % result)
|
||||||
if not "running" in result:
|
if "running" not in result:
|
||||||
self.skipTest("Skipping scale VM operation because\
|
self.skipTest("Skipping scale VM operation because\
|
||||||
VMware tools are not installed on the VM")
|
VMware tools are not installed on the VM")
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ class TestScaleVm(cloudstackTestCase):
|
|||||||
result = str(
|
result = str(
|
||||||
sshClient.execute("service vmware-tools status")).lower()
|
sshClient.execute("service vmware-tools status")).lower()
|
||||||
self.debug("and result is: %s" % result)
|
self.debug("and result is: %s" % result)
|
||||||
if not "running" in result:
|
if "running" not in result:
|
||||||
self.skipTest("Skipping scale VM operation because\
|
self.skipTest("Skipping scale VM operation because\
|
||||||
VMware tools are not installed on the VM")
|
VMware tools are not installed on the VM")
|
||||||
res = None
|
res = None
|
||||||
@ -700,7 +700,7 @@ class TestScaleVm(cloudstackTestCase):
|
|||||||
result = str(
|
result = str(
|
||||||
sshClient.execute("service vmware-tools status")).lower()
|
sshClient.execute("service vmware-tools status")).lower()
|
||||||
self.debug("and result is: %s" % result)
|
self.debug("and result is: %s" % result)
|
||||||
if not "running" in result:
|
if "running" not in result:
|
||||||
self.skipTest("Skipping scale VM operation because\
|
self.skipTest("Skipping scale VM operation because\
|
||||||
VMware tools are not installed on the VM")
|
VMware tools are not installed on the VM")
|
||||||
res = None
|
res = None
|
||||||
|
|||||||
@ -183,7 +183,7 @@ class cloudstackTestCase(unittest.case.TestCase):
|
|||||||
sshClient.execute("service httpd start")
|
sshClient.execute("service httpd start")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
ssh_response = str(sshClient.execute("service httpd status")).lower()
|
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")
|
raise Exception("Failed to start httpd service")
|
||||||
self.debug("Setup webserver using apache")
|
self.debug("Setup webserver using apache")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user