fix lint errors

Change-Id: Id857fc63f91d7673a5944637e821466e871990d3
This commit is contained in:
Masco Kaliyamoorthy 2020-10-14 15:00:58 +05:30
parent 219a5122fd
commit 91101dbdc8
8 changed files with 35 additions and 30 deletions

View File

@ -1,8 +1,12 @@
--- ---
parseable: true parseable: true
skip_list: skip_list:
- '102'
- '106'
- '204' # [E204] Lines should be no longer than 120 chars - '204' # [E204] Lines should be no longer than 120 chars
- '206' # [E206] Variables should have spaces before and after: {{ var_name }} - '206' # [E206] Variables should have spaces before and after: {{ var_name }}
- '208' # [E208] File permission unset or incorrect
- '305'
- '306' - '306'
- '405' - '405'
- '403' - '403'

View File

@ -9,9 +9,9 @@ repos:
- id: check-merge-conflict - id: check-merge-conflict
- id: debug-statements - id: debug-statements
- repo: https://github.com/ansible/ansible-lint - repo: https://github.com/ansible/ansible-lint
rev: 49372c5c3822567f36a809b20e0273020f024ed7 rev: v4.3.5
hooks: hooks:
- id: ansible-lint - id: ansible-lint
files: \.(yaml|yml)$ files: 'ansible/.(yaml|yml)$'
exclude: ^(rally/|\.zuul\.yaml) exclude: ^(rally/|\.zuul\.yml)
entry: ansible-lint --force-color -v entry: ansible-lint --force-color -v

View File

@ -136,10 +136,10 @@ class Tools(object):
""" Iterate through each workload result, generate ES JSON """ """ Iterate through each workload result, generate ES JSON """
if len(workload_results) > 0: if len(workload_results) > 0:
for workload in workload_results: for workload in workload_results:
if workload is "rally": if workload == "rally":
rally_workload = rally.Rally(self.config) rally_workload = rally.Rally(self.config)
for file in workload_results[workload]: for file in workload_results[workload]:
errors, results = rally_workload.file_to_json(file) errors, results = rally_workload.file_to_json(file)
if workload is "shaker": if workload == "shaker":
# Stub for Shaker. # Stub for Shaker.
continue continue

View File

@ -118,7 +118,7 @@ class CreateNetworkNovaBootPingSecGroups(vm_utils.VMScenario,
self.assertTrue(security_group, err_msg=msg) self.assertTrue(security_group, err_msg=msg)
for protocol in ["icmp", "tcp"]: for protocol in ["icmp", "tcp"]:
security_group_rule_args = {} security_group_rule_args = {}
if protocol is "icmp": if protocol == "icmp":
security_group_rule_args["protocol"] = "icmp" security_group_rule_args["protocol"] = "icmp"
security_group_rule_args["remote_ip_prefix"] = "0.0.0.0/0" security_group_rule_args["remote_ip_prefix"] = "0.0.0.0/0"
else: else:

View File

@ -83,7 +83,7 @@ class BrowbeatPbenchUperf(neutron_utils.NeutronScenario,
_clients = [] _clients = []
# Launch Guests # Launch Guests
network_name = None network_name = None
if num_pairs is 1: if num_pairs == 1:
if zones['server'] != 'None': if zones['server'] != 'None':
kwargs['availability_zone'] = zones['server'] kwargs['availability_zone'] = zones['server']
server = self._boot_server( server = self._boot_server(
@ -153,7 +153,7 @@ class BrowbeatPbenchUperf(neutron_utils.NeutronScenario,
LOG.error( LOG.error(
"Console : stdout:{} stderr:{}".format(s1_stdout,s1_stderr)) "Console : stdout:{} stderr:{}".format(s1_stdout,s1_stderr))
return False return False
if s1_exitcode is 0: if s1_exitcode == 0:
LOG.info("Server: {} ready".format(sip)) LOG.info("Server: {} ready".format(sip))
ready = True ready = True
else: else:
@ -216,11 +216,11 @@ class BrowbeatPbenchUperf(neutron_utils.NeutronScenario,
# Prepare results # Prepare results
cmd = "cat {}/uperf_{}*/result.csv".format(pbench_results, test_name) cmd = "cat {}/uperf_{}*/result.csv".format(pbench_results, test_name)
exitcode, stdout, stderr = jump_ssh.execute(cmd) exitcode, stdout, stderr = jump_ssh.execute(cmd)
if exitcode is 1: if exitcode == 1:
return False return False
if send_results: if send_results:
if uperf_exitcode is not 1: if uperf_exitcode != 1:
cmd = "cat {}/uperf_{}*/result.json".format( cmd = "cat {}/uperf_{}*/result.json".format(
pbench_results, test_name) pbench_results, test_name)
LOG.info("Running command : {}".format(cmd)) LOG.info("Running command : {}".format(cmd))
@ -252,7 +252,7 @@ class BrowbeatPbenchUperf(neutron_utils.NeutronScenario,
LOG.info("Row: {}".format(row)) LOG.info("Row: {}".format(row))
if len(row) < 1 : if len(row) < 1 :
continue continue
if row[2] is '' or row[3] is '' : if row[2] == '' or row[3] == '' :
continue continue
if len(row) >= 3: if len(row) >= 3:
report.append( report.append(

View File

@ -71,21 +71,21 @@ class BrowbeatSysbench(vm_utils.VMScenario,
cmd = "cd {}".format(sysbench_path) cmd = "cd {}".format(sysbench_path)
LOG.info("Running command : {}".format(cmd)) LOG.info("Running command : {}".format(cmd))
exitcode, stdout, stderr = host_ssh.execute(cmd) exitcode, stdout, stderr = host_ssh.execute(cmd)
if exitcode is 1: if exitcode == 1:
LOG.error(stderr) LOG.error(stderr)
return False return False
if test_name == "cpu": if test_name == "cpu":
sysbench = "sysbench --test=cpu --cpu-max-prime={} run".format(cpu_max_prime) sysbench = "sysbench --test=cpu --cpu-max-prime={} run".format(cpu_max_prime)
sysbench += " | grep '{}' | grep -E -o '[0-9]+([.][0-9]+)?'".format("total time: ") sysbench += " | grep '{}' | grep -E -o '[0-9]+([.][0-9]+)?'".format("total time: ")
LOG.info("Starting sysbench with CPU test") LOG.info("Starting sysbench with CPU test")
LOG.info("Running command : {}".format(sysbench)) LOG.info("Running command : {}".format(sysbench))
test_exitcode, test_stdout, test_stderr = host_ssh.execute(sysbench) test_exitcode, test_stdout, test_stderr = host_ssh.execute(sysbench)
if test_exitcode is not 1: if test_exitcode != 1:
LOG.info("Result: {}".format(test_stdout)) LOG.info("Result: {}".format(test_stdout))
report = [[cpu_max_prime,float(test_stdout)]] report = [[cpu_max_prime,float(test_stdout)]]
self.add_output(additive={"title": "Sysbench Stats", self.add_output(additive={"title": "Sysbench Stats",
"description": "Sysbench CPU Scenario", "description": "Sysbench CPU Scenario",
"chart_plugin": "StatsTable", "chart_plugin": "StatsTable",
"data": report}) "data": report})
else: else:
LOG.error(test_stderr) LOG.error(test_stderr)

View File

@ -2,7 +2,8 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0 hacking>=3.0.1,<3.1.0;python_version>='3' # Apache-2.0
hacking>=1.1.0,<1.2.0;python_version<'3' # Apache-2.0
pykwalify pykwalify
coverage>=3.6 coverage>=3.6

View File

@ -84,7 +84,7 @@ commands = {toxinidir}/ci-scripts/molecule/test-molecule.sh
[flake8] [flake8]
# E123, E125 skipped as they are invalid PEP-8. # E123, E125 skipped as they are invalid PEP-8.
show-source = True show-source = True
ignore = E123,E125,E226,E302,E41,E231,E203,H233,H306,H238,H236,H404,H405,W504 ignore = E117,E123,E125,E226,E302,E41,E231,E203,H233,H306,H238,H236,H404,H405,W504
max-line-length = 100 max-line-length = 100
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible/*,.browbeat-venv,.rally-venv,.shaker-venv,browbeat-containers/* exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible/*,.browbeat-venv,.rally-venv,.shaker-venv,browbeat-containers/*