Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Fix Flakes and lower-constraints errors
Browse files Browse the repository at this point in the history
With the switch to Ubuntu Focal for tox jobs via https://review.opendev.org/#/c/738322/
our 1.1.0 version of hacking pulls in old modules that are not compatible
with python3.8:
https://github.com/openstack/hacking/blob/1.1.0/requirements.txt#L6

Let's upgrade hacking to >= 3.0.1 and < 3.1.0 so that it supports python3.8
correctly. The newer hacking also triggered new errors which are
fixed in this review as well:
./tools/render-ansible-tasks.py:113:25: F841 local variable 'e' is assigned to but never used
./tools/yaml-validate.py:541:19: F999 '...'.format(...) has unused arguments at position(s): 2
./tools/render-ansible-tasks.py:126:1: E305 expected 2 blank lines after class or function definition, found 1
./tools/yaml-validate.py:33:1: E305 expected 2 blank lines after class or function definition, found 1
./container_config_scripts/tests/test_nova_statedir_ownership.py:35:1: E305 expected 2 blank lines after class or function definition, found 0

Also make sure we exclude .tox and __pycache__ from flake8 as well

We also need to change the lower-constraint requirements to make them
py3.8 compatible. See https://bugs.launchpad.net/nova/+bug/1886298
cffi==1.14.0
greenlet==0.4.15
MarkupSafe==1.1.0
paramiko==2.7.1

Suggested-By: Yatin Karel <[email protected]>

Change-Id: Ic280ce9a51f26d165d4e93ba0dc0c47cdf8d7961
Closes-Bug: #1895093
  • Loading branch information
mbaldessari committed Sep 10, 2020
1 parent 0c38199 commit 87b365a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def lgetfilecon(path):
@staticmethod
def lsetfilecon(path, context):
pass


sys.modules["selinux"] = FakeSelinux

from container_config_scripts.nova_statedir_ownership import \
Expand Down
8 changes: 4 additions & 4 deletions lower-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ asn1crypto==0.23.0
Babel==2.3.4
beautifulsoup4==4.6.0
cachetools==2.0.0
cffi==1.7.0
cffi==1.14.0
cliff==2.8.0
cmd2==0.8.0
contextlib2==0.4.0
Expand All @@ -31,7 +31,7 @@ futurist==1.2.0
gitdb==0.6.4
GitPython==1.0.1
gnocchiclient==3.3.1
greenlet==0.4.10
greenlet==0.4.15
httplib2==0.9.1
idna==2.6
imagesize==0.7.1
Expand All @@ -48,7 +48,7 @@ kombu==4.0.0
linecache2==1.0.0
logutils==0.3.5
Mako==0.4.0
MarkupSafe==1.0
MarkupSafe==1.1.0
mistral-lib==0.3.0
mistral==6.0.0
monotonic==0.6
Expand Down Expand Up @@ -78,7 +78,7 @@ oslo.utils==3.33.0
oslosphinx==4.7.0
oslotest==3.2.0
osprofiler==1.4.0
paramiko==2.0.0
paramiko==2.7.1
passlib==1.7.0
Paste==2.0.2
PasteDeploy==1.5.0
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# 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 # Apache-2.0
openstackdocstheme>=1.18.1 # Apache-2.0
PyYAML>=3.12 # MIT
Jinja2>=2.10 # BSD License (3 clause)
Expand Down
3 changes: 2 additions & 1 deletion tools/render-ansible-tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def main():
ansible_tasks = expression.evaluate(data=data_source)
print(ansible_tasks)
role_ansible_tasks = role_ansible_tasks + ansible_tasks
except Exception as e:
except Exception:
print("There are no tasks in the configuration file")
if (role_ansible_tasks != []):
tasks_output_file = os.path.join(output, role + "_" + section_task + ".yml")
Expand All @@ -123,5 +123,6 @@ def main():
save = open(tasks_output_file, 'w+')
yaml.dump(yaml.load(json.dumps(role_ansible_tasks)), save, default_flow_style=False)


if __name__ == '__main__':
main()
3 changes: 2 additions & 1 deletion tools/yaml-validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
def is_string(value):
return isinstance(value, six.string_types)


# Only permit the template alias versions.
# The current template version should be the last element.
# As tripleo-heat-templates is a branched repository, this
Expand Down Expand Up @@ -539,7 +540,7 @@ def validate_with_compute_role_services(role_filename, role_tpl, exclude_service
if 'OS::TripleO::Services::CephOSD' in role_services:
if tpl_us not in (None, 1):
print('ERROR: update_serial in {0} ({1}) '
'is should be 1 as it includes CephOSD'.format(
'is should be 1 as it includes CephOSD {2}'.format(
role_filename,
tpl_us,
cmpt_us))
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ commands =
python ./tools/yaml-validate.py .
bash -c ./tools/roles-data-validation.sh
bash -c ./tools/check-up-to-date.sh
flake8 --exclude releasenotes --ignore {[testenv:flake8]ignore}
flake8 --exclude releasenotes,.tox,__pycache__ --ignore {[testenv:flake8]ignore}

[testenv:flake8]
# E125 is deliberately excluded. See
Expand Down

0 comments on commit 87b365a

Please sign in to comment.