Fix indentation issues and use python3 when running pycodestyle checker

This commit is contained in:
Gabriel Brascher 2021-02-25 03:49:27 -03:00 committed by Daan Hoogland
parent 28ff962462
commit 23472e8d1c
4 changed files with 10 additions and 10 deletions

View File

@ -28,7 +28,7 @@ class CsChain(object):
self.count = {}
def add(self, table, chain):
if table not in list(self.chain.keys()):
if table not in list(self.chain.keys()):
self.chain.setdefault(table, []).append(chain)
else:
self.chain[table].append(chain)

View File

@ -28,7 +28,7 @@ def main():
data = entries[0]
if "maxMemoryUsage" not in data:
print("Missing maxMemoryUsage in health_checks_data " + \
print("Missing maxMemoryUsage in health_checks_data " +
"systemThresholds, skipping")
exit(0)
@ -39,10 +39,10 @@ def main():
if pout.wait() == 0:
currentUsage = float(pout.communicate()[0].strip())
if currentUsage > maxMemoryUsage:
print("Memory Usage " + str(currentUsage) + \
print("Memory Usage " + str(currentUsage) +
"% has crossed threshold of " + str(maxMemoryUsage) + "%")
exit(1)
print("Memory Usage within limits with current at " + \
print("Memory Usage within limits with current at " +
str(currentUsage) + "%")
exit(0)
else:

View File

@ -53,10 +53,10 @@ def main():
releaseFile = "/etc/cloudstack-release"
found = getFirstLine(releaseFile)
if found is None:
print("Release version not yet setup at " + releaseFile +\
print("Release version not yet setup at " + releaseFile +
", skipping.")
elif expected != found:
print("Template Version mismatch. Expected: " + \
print("Template Version mismatch. Expected: " +
expected + ", found: " + found)
templateVersionMatches = False
@ -65,10 +65,10 @@ def main():
sigFile = "/var/cache/cloud/cloud-scripts-signature"
found = getFirstLine(sigFile)
if found is None:
print("Scripts signature is not yet setup at " + sigFile +\
print("Scripts signature is not yet setup at " + sigFile +
", skipping")
if expected != found:
print("Scripts Version mismatch. Expected: " + \
print("Scripts Version mismatch. Expected: " +
expected + ", found: " + found)
scriptVersionMatches = False

View File

@ -22,8 +22,8 @@ export PYTHONPATH="../debian/opt/cloud/bin/"
export PYTHONDONTWRITEBYTECODE=False
echo "Running pycodestyle to check systemvm/python code for errors"
python -m pycodestyle --max-line-length=179 *py
python -m pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
python3 -m pycodestyle --max-line-length=179 *py
python3 -m pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
if [ $? -gt 0 ]
then
echo "pycodestyle failed, please check your code"