Fix Flakes and lower-constraints errors

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 <ykarel@redhat.com>

Change-Id: Ic280ce9a51f26d165d4e93ba0dc0c47cdf8d7961
Closes-Bug: #1895093
This commit is contained in:
Michele Baldessari 2020-09-10 09:26:21 +02:00
parent 0c381995ba
commit 87b365afd3
6 changed files with 12 additions and 8 deletions

View File

@ -32,6 +32,8 @@ class FakeSelinux(object):
@staticmethod
def lsetfilecon(path, context):
pass
sys.modules["selinux"] = FakeSelinux
from container_config_scripts.nova_statedir_ownership import \

View File

@ -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
@ -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
@ -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
@ -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

View File

@ -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)

View File

@ -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")
@ -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()

View File

@ -25,6 +25,7 @@ from copy import copy
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
@ -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))

View File

@ -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