From 7312b1bf1de72e47bdea9d628f070afa1f4df8a1 Mon Sep 17 00:00:00 2001 From: albailey Date: Thu, 10 Dec 2020 18:25:11 -0600 Subject: [PATCH] Turn off the legacy pip resolver for sysinv The requirements that had conflicts have been updated. The local upper-constraints is no longer being used by tox since two constraints files with different values for the same requirements are not supported. Additional pylint error codes are being suppressed as pylint is now running in python3 and has some newer checks. Cleans up some linter warnings related to yaml. Change-Id: I9b5158d59b0791e49c3037a8e823b67fb30c8292 Related-Bug: #1907678 Signed-off-by: albailey --- playbooks/tox-puppet-lint/pre.yaml | 81 ------------------- sysinv/sysinv/sysinv/pylint.rc | 10 ++- sysinv/sysinv/sysinv/requirements.txt | 6 +- .../sysinv/sysinv/sysinv/common/exception.py | 2 +- .../conductor/data/chart_values_sample.yaml | 1 + .../sysinv/tests/objects/test_objects.py | 6 +- sysinv/sysinv/sysinv/test-requirements.txt | 15 ++-- sysinv/sysinv/sysinv/tox.ini | 24 +++--- 8 files changed, 31 insertions(+), 114 deletions(-) delete mode 100644 playbooks/tox-puppet-lint/pre.yaml diff --git a/playbooks/tox-puppet-lint/pre.yaml b/playbooks/tox-puppet-lint/pre.yaml deleted file mode 100644 index 1681dc7e95..0000000000 --- a/playbooks/tox-puppet-lint/pre.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# Job cloned from: -# https://opendev.org/openstack/openstack-zuul-jobs/src/branch/master/playbooks/legacy/puppet-lint/run.yaml -# to install gem and puppet-lint in Zuul operating enviroment, -# before running puppet-lint within the tox.ini file. The only -# modification to this job is to not run puppet-lint here. -# Rather, it's left to the tox.ini to control what files are -# checked and what options are used (ie. to skip certain checks) -# -- hosts: all - name: Setup gem and puppet-lint for availability within tox - roles: - - bindep - - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - if [ -f /usr/bin/yum ]; then - sudo yum -y remove rdo-release "centos-release-openstack-*" "centos-release-ceph-*" - sudo yum -y install libxml2-devel libxslt-devel ruby-devel zlib-devel - sudo yum -y groupinstall "Development Tools" - # Uninstall python-requests from pip, since we install it in - # system-config/install_puppet.sh - sudo pip uninstall requests -y || true - elif [ -f /usr/bin/apt-get ]; then - sudo apt-get update - sudo apt-get install -y libxml2-dev libxslt-dev ruby-dev zlib1g-dev - fi - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -x - sudo rm -f /etc/sudoers.d/zuul - # Prove that general sudo access is actually revoked - ! sudo -n true - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - if [ -f Modulefile -o -f metadata.json ]; then - if [ -f Modulefile ]; then - MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\') - elif [ -f metadata.json ]; then - MODULE=$(python -c 'import json;print json.load(open("metadata.json"))["name"]') - fi - if [ -z "$MODULE" ]; then - echo "Module name not defined in Modulefile or metadata.json" - else - mkdir -p "$MODULE" - rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE" - cd "$MODULE" - fi - fi - mkdir .bundled_gems - export GEM_HOME=`pwd`/.bundled_gems - if [ -f Gemfile ]; then - gem install bundler --no-rdoc --no-ri --verbose --version '<2.0.0' - $GEM_HOME/bin/bundle install --without system_tests - # We'll run puppet-lint from tox - #$GEM_HOME/bin/bundle exec rake lint 2>&1 - else - gem install rake -n ./.bundled_gems/ - gem install puppet-lint - gem install puppetlabs_spec_helper - # We'll run puppet-lint from tox - #./.bundled_gems/rake lint 2>&1 - fi - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' diff --git a/sysinv/sysinv/sysinv/pylint.rc b/sysinv/sysinv/sysinv/pylint.rc index 1640288c78..ef96a0a1da 100755 --- a/sysinv/sysinv/sysinv/pylint.rc +++ b/sysinv/sysinv/sysinv/pylint.rc @@ -74,19 +74,23 @@ extension-pkg-whitelist=lxml.etree,greenlet # W0622: redefined-builtin # W0631: undefined-loop-variable # W0632: unbalanced-tuple-unpacking -# W0701: bad-except-order # W0703: broad-except +# W0706: try-except-raise # W1113: keyword-arg-before-vararg # W1201: logging-not-lazy # W1401: anomalous-backslash-in-string +# W1501: subprocess-popen-preexec-fn # W1505: deprecated-method +# W1509: subprocess-popen-preexec-fn # All these errors should be fixed: # E0633: unpacking-non-sequence +# E1101: no-member +# E1111: assignment-from-no-return disable=C, R, fixme, W0101, W0105, W0106, W0107, W0108, W0110, W0123, W0150, W0201, W0211, W0212, W0221, W0223, W0231, W0235, W0311, W0402, W0403, W0404, W0603, W0612, W0613, W0621, W0622, W0631, W0632, W0701, W0703, - W1113, W1201, W1401, W1505, - E0633 + W0706, W1113, W1201, W1401, W1505, W1509, + E0633, E1101, E1111 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs diff --git a/sysinv/sysinv/sysinv/requirements.txt b/sysinv/sysinv/sysinv/requirements.txt index 741b45e04c..5eeb128e1f 100644 --- a/sysinv/sysinv/sysinv/requirements.txt +++ b/sysinv/sysinv/sysinv/requirements.txt @@ -3,9 +3,9 @@ SQLAlchemy amqplib>=0.6.1 argparse boto3 -botocore>=1.11.0 +botocore cryptography!=2.0 # BSD/Apache-2.0 -eventlet==0.20.0 +eventlet greenlet>=0.3.2 # MIT keyring kombu>=2.4.8 @@ -44,4 +44,4 @@ rpm ruamel.yaml>=0.13.14 # MIT docker # Apache-2.0 kubernetes # Apache-2.0 -Django<2,>=1.11.20 # BSD +Django diff --git a/sysinv/sysinv/sysinv/sysinv/common/exception.py b/sysinv/sysinv/sysinv/sysinv/common/exception.py index 3f1ce04bf4..576092f964 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/exception.py +++ b/sysinv/sysinv/sysinv/sysinv/common/exception.py @@ -113,7 +113,7 @@ class SysinvException(Exception): def format_message(self): if self.__class__.__name__.endswith('_Remote'): - return self.args[0] + return self.args[0] # pylint: disable=unsubscriptable-object else: return six.text_type(self) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/conductor/data/chart_values_sample.yaml b/sysinv/sysinv/sysinv/sysinv/tests/conductor/data/chart_values_sample.yaml index 094c3e8295..55054afd6b 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/conductor/data/chart_values_sample.yaml +++ b/sysinv/sysinv/sysinv/sysinv/tests/conductor/data/chart_values_sample.yaml @@ -1,3 +1,4 @@ +--- labels: api: node_selector_key: openstack-control-plane diff --git a/sysinv/sysinv/sysinv/sysinv/tests/objects/test_objects.py b/sysinv/sysinv/sysinv/sysinv/tests/objects/test_objects.py index 51a3b492fd..9a5429e7bd 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/objects/test_objects.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/objects/test_objects.py @@ -71,7 +71,7 @@ class MyObj(base.SysinvObject): @base.remotable def modify_save_modify(self, context): self.bar = 'meow' - self.save() + self.save() # pylint: disable=no-value-for-parameter self.foo = 42 @@ -395,7 +395,7 @@ class _TestObjectMixin(object): ctxt = context.get_admin_context() obj = MyObj.get(ctxt) self.assertEqual(obj.bar, 'bar') - result = obj.marco() + result = obj.marco() # pylint: disable=no-value-for-parameter self.assertEqual(result, 'polo') self.assertRemotes() @@ -403,7 +403,7 @@ class _TestObjectMixin(object): ctxt = context.get_admin_context() obj = MyObj.get(ctxt) self.assertEqual(obj.foo, 1) - obj.update_test() + obj.update_test() # pylint: disable=no-value-for-parameter self.assertEqual(obj.bar, 'updated') self.assertRemotes() diff --git a/sysinv/sysinv/sysinv/test-requirements.txt b/sysinv/sysinv/sysinv/test-requirements.txt index 65209c804f..caa1705d86 100644 --- a/sysinv/sysinv/sysinv/test-requirements.txt +++ b/sysinv/sysinv/sysinv/test-requirements.txt @@ -1,26 +1,25 @@ # 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. -flake8<3.8.0 -pycodestyle<2.6.0 # MIT License hacking>=1.1.0,<=2.0.0 # Apache-2.0 +bandit;python_version>="3.0" coverage>=3.6 -discover fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD passlib>=1.7.0 psycopg2-binary -python-barbicanclient<3.1.0,>=3.0.1 +python-barbicanclient python-subunit>=0.0.18 requests-mock>=0.6.0 # Apache-2.0 -sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 -oslosphinx<2.6.0,>=2.5.0 # Apache-2.0 +sphinx +oslosphinx oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testrepository>=0.0.18 testtools!=1.2.0,>=0.9.36 -tempest-lib<0.5.0,>=0.4.0 -ipaddr +isort<5;python_version>="3.0" +pylint<2.1.0;python_version<"3.0" # GPLv2 +pylint<2.4.0;python_version>="3.0" # GPLv2 pytest pyudev migrate diff --git a/sysinv/sysinv/sysinv/tox.ini b/sysinv/sysinv/sysinv/tox.ini index 212e0e9b9b..95c9916938 100644 --- a/sysinv/sysinv/sysinv/tox.ini +++ b/sysinv/sysinv/sysinv/tox.ini @@ -11,19 +11,17 @@ distshare={toxworkdir}/.tox/distshare [testenv] # usedevelop = True -# enabling usedevelop results in py27 develop-inst: +# enabling usedevelop results in py27 develop-inst: # Exception: Versioning for this project requires either an sdist tarball, # or access to an upstream git repository. -# Note. site-packages is true and rpm-python must be yum installed on your dev machine. -sitepackages = True +sitepackages = False +basepython = python3 # tox is silly... these need to be separated by a newline.... whitelist_externals = bash find -install_command = pip install --use-deprecated legacy-resolver \ - -v -v -v \ - -c{toxinidir}/upper-constraints.txt \ +install_command = pip install -v -v -v \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ {opts} {packages} @@ -31,6 +29,7 @@ install_command = pip install --use-deprecated legacy-resolver \ # random hash seed successfully. setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 + PIP_RESOLVER_DEBUG=1 PYTHONDONTWRITEBYTECODE=1 OS_TEST_PATH=./sysinv/tests LANG=en_US.UTF-8 @@ -78,7 +77,7 @@ commands = # B012 return/continue/break inside finally blocks cause exceptions to be silenced # B014 Redundant exception types # B301 Python 3 does not include `.iter*` methods on dictionaries. (this should be suppressed on a per line basis) -# B306 `BaseException.message` has been deprecated. Needs to be FIXED +# B306 `BaseException.message` has been deprecated. Needs to be FIXED # W series are warnings # W503 line break before binary operator @@ -103,7 +102,6 @@ max-line-length=120 [testenv:flake8] basepython = python3 deps = -r{toxinidir}/test-requirements.txt - commands = flake8 {posargs} . \ scripts/manage-partitions \ @@ -125,8 +123,8 @@ commands = [testenv:pep8] # testenv:flake8 clone -basepython = {[testenv:flake8]basepython} -deps = {[testenv:flake8]deps} +basepython = python3 +deps = -r{toxinidir}/test-requirements.txt commands = {[testenv:flake8]commands} [testenv:venv] @@ -167,14 +165,10 @@ exclude = tests [testenv:bandit] basepython = python3 deps = -r{toxinidir}/test-requirements.txt - bandit commands = bandit --ini tox.ini -n 5 -r sysinv [testenv:pylint] -basepython = python2.7 -sitepackages = False -deps = {[testenv]deps} - pylint +basepython = python3 commands = pylint {posargs} sysinv --rcfile=./pylint.rc