Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
Change-Id: Id857fc63f91d7673a5944637e821466e871990d3
  • Loading branch information
masco committed Oct 14, 2020
1 parent 219a512 commit 91101db
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 30 deletions.
4 changes: 4 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
parseable: true
skip_list:
- '102'
- '106'
- '204' # [E204] Lines should be no longer than 120 chars
- '206' # [E206] Variables should have spaces before and after: {{ var_name }}
- '208' # [E208] File permission unset or incorrect
- '305'
- '306'
- '405'
- '403'
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/ansible/ansible-lint
rev: 49372c5c3822567f36a809b20e0273020f024ed7
rev: v4.3.5
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
exclude: ^(rally/|\.zuul\.yaml)
files: 'ansible/.(yaml|yml)$'
exclude: ^(rally/|\.zuul\.yml)
entry: ansible-lint --force-color -v
4 changes: 2 additions & 2 deletions browbeat/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def post_process(self, cli):
""" Iterate through each workload result, generate ES JSON """
if len(workload_results) > 0:
for workload in workload_results:
if workload is "rally":
if workload == "rally":
rally_workload = rally.Rally(self.config)
for file in workload_results[workload]:
errors, results = rally_workload.file_to_json(file)
if workload is "shaker":
if workload == "shaker":
# Stub for Shaker.
continue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _create_security_group_icmp_ssh(self):
self.assertTrue(security_group, err_msg=msg)
for protocol in ["icmp", "tcp"]:
security_group_rule_args = {}
if protocol is "icmp":
if protocol == "icmp":
security_group_rule_args["protocol"] = "icmp"
security_group_rule_args["remote_ip_prefix"] = "0.0.0.0/0"
else:
Expand Down
10 changes: 5 additions & 5 deletions rally/rally-plugins/workloads/pbench-uperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_guest_pairs(
_clients = []
# Launch Guests
network_name = None
if num_pairs is 1:
if num_pairs == 1:
if zones['server'] != 'None':
kwargs['availability_zone'] = zones['server']
server = self._boot_server(
Expand Down Expand Up @@ -153,7 +153,7 @@ def create_guest_pairs(
LOG.error(
"Console : stdout:{} stderr:{}".format(s1_stdout,s1_stderr))
return False
if s1_exitcode is 0:
if s1_exitcode == 0:
LOG.info("Server: {} ready".format(sip))
ready = True
else:
Expand Down Expand Up @@ -216,11 +216,11 @@ def run(self, image, flavor, user, test_types, protocols, samples, test_name, ex
# Prepare results
cmd = "cat {}/uperf_{}*/result.csv".format(pbench_results, test_name)
exitcode, stdout, stderr = jump_ssh.execute(cmd)
if exitcode is 1:
if exitcode == 1:
return False

if send_results:
if uperf_exitcode is not 1:
if uperf_exitcode != 1:
cmd = "cat {}/uperf_{}*/result.json".format(
pbench_results, test_name)
LOG.info("Running command : {}".format(cmd))
Expand Down Expand Up @@ -252,7 +252,7 @@ def run(self, image, flavor, user, test_types, protocols, samples, test_name, ex
LOG.info("Row: {}".format(row))
if len(row) < 1 :
continue
if row[2] is '' or row[3] is '' :
if row[2] == '' or row[3] == '' :
continue
if len(row) >= 3:
report.append(
Expand Down
34 changes: 17 additions & 17 deletions rally/rally-plugins/workloads/sysbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ def run(self, image, flavor, user, test_name, cpu_max_prime=10000, external=None
cmd = "cd {}".format(sysbench_path)
LOG.info("Running command : {}".format(cmd))
exitcode, stdout, stderr = host_ssh.execute(cmd)
if exitcode is 1:
LOG.error(stderr)
return False
if exitcode == 1:
LOG.error(stderr)
return False
if test_name == "cpu":
sysbench = "sysbench --test=cpu --cpu-max-prime={} run".format(cpu_max_prime)
sysbench += " | grep '{}' | grep -E -o '[0-9]+([.][0-9]+)?'".format("total time: ")
LOG.info("Starting sysbench with CPU test")
LOG.info("Running command : {}".format(sysbench))
test_exitcode, test_stdout, test_stderr = host_ssh.execute(sysbench)
if test_exitcode is not 1:
LOG.info("Result: {}".format(test_stdout))
report = [[cpu_max_prime,float(test_stdout)]]
self.add_output(additive={"title": "Sysbench Stats",
"description": "Sysbench CPU Scenario",
"chart_plugin": "StatsTable",
"data": report})
else:
LOG.error(test_stderr)
sysbench = "sysbench --test=cpu --cpu-max-prime={} run".format(cpu_max_prime)
sysbench += " | grep '{}' | grep -E -o '[0-9]+([.][0-9]+)?'".format("total time: ")
LOG.info("Starting sysbench with CPU test")
LOG.info("Running command : {}".format(sysbench))
test_exitcode, test_stdout, test_stderr = host_ssh.execute(sysbench)
if test_exitcode != 1:
LOG.info("Result: {}".format(test_stdout))
report = [[cpu_max_prime,float(test_stdout)]]
self.add_output(additive={"title": "Sysbench Stats",
"description": "Sysbench CPU Scenario",
"chart_plugin": "StatsTable",
"data": report})
else:
LOG.error(test_stderr)
3 changes: 2 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# of appearance. Changing the order has an impact on the overall integration
# 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
coverage>=3.6
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ commands = {toxinidir}/ci-scripts/molecule/test-molecule.sh
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
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
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible/*,.browbeat-venv,.rally-venv,.shaker-venv,browbeat-containers/*

0 comments on commit 91101db

Please sign in to comment.