Commit Graph

22 Commits

Author SHA1 Message Date
Al Bailey d87462c851 Convert yaml.load to yaml.safe_load
yaml.load is considered unsafe. yaml.safe_load is the
recommended method to use.

The yaml.load is only being called from scenario tests,
and from a forensic tool that is unused. Therefore this
code change has no runtime impact.

This allow unsuppressing the following pylint error
 E1120 no-value-for-parameter

This allow unsuppressing the following bandit error
 B506: Test for use of yaml load

Adding a new bandit zuul job, and removing the pinning
of the version of bandit for this repo.

Test Plan:
  PASS: tox -e pylint
  PASS: tox -e bandit
  PASS: build-pkgs -p nfv

Story: 2010531
Task: 47174

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ie60dcf98425c95e103d22e7be4212de1954550bf
2023-01-19 19:57:23 +00:00
Al Bailey e6114addac Cleanup tox.ini and zuul files from older releases
tox changes:
 - remove python2.7 and python3.6 unit test targets
from tox.ini since only python 3.9 is supported
 - remove the (junk) functional target from tox.ini
 - fix yamllint target in tox.ini so it will actually
 process files. Also added a basic yammlint settings file.
 - nova-api-proxy tox jobs are now setup for py39
 - Removed the py27 limitations from requirements files.
 - Removed the upper limits for pylint and astroid.
 - Added additional suppressions for new pylint codes.

Zuul changes:
 - remove py27 job from zuul
 - remove the unused (never working) devstack job
 - set the parent zuul jobs to be the jobs defined under
openstack-zuul-jobs rather than just zuul-jobs
 - Specify debian-bullseye (python3.9) as the nodeset.
  ubuntu-jammy iss python3.10, ubuntu-focal is python3.8
 - override tox constraints file to use the STX constraints
   This means starlingx/root needs to be a required project
 - Removed the nodeset from the pep8 jobs.

Note: these changes do not affect runtime for NFV.

Test Plan:
  Pass tox in nfv directory of (debian) dev env.
  Pass tox in nova-api-proxy directory of (debian) dev env.
  build-pkgs -p nfv

Story: 2010531
Task: 47146

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I6dad77bec40e9b64a9314b237270af046728efb3
2023-01-19 15:42:06 +00:00
Al Bailey a2d39ebd1f Update tox.ini to work with tox 4
This change will allow this repo to pass zuul now
that this has merged:
https://review.opendev.org/c/zuul/zuul-jobs/+/866943

Tox 4 deprecated whitelist_externals.
Replace whitelist_externals with allowlist_externals

Partial-Bug: #2000399

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I2dc26705317a5e6194318991ffad5c9d14f52922
2022-12-26 23:29:09 +00:00
albailey eafee58e62 Not require recreate of tox env when running tox
The upgrade test was written to copy a file required for
the test, but did not handle the file already being processed.
This fix adjusts the setup for the unit test to handle this
and allows the recreate to be removed, thus reducing designer
tox testing time (40 seconds down to 4 when re-running a single test)

This also aligns the version of hacking and pylint as the same as
other starlingx repos. A new pylint was released which was
breaking tox.

The code changes are to fix whitespace (rather than suppressing):
 E305 expected 2 blank lines after class or function definition
 E117 over-indented

Three new hacking warnings are being suppressed:
  W503 line break before binary operator
  W504  line break after binary operator
  W605 invalid escape sequence

Un-suppress these codes which are not broken in the code:
 E123 closing bracket does not match indentation of opening bracket
 E501 line too long (tox sets max length instead to a large val)
 F823 local variable referenced before assignment

yamllint 1.26.1 does not work with py2 or py3 in our env, so clamp it.

Story: 2008137
Task: 42200
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: Ia623315c5f1a690d20f597242b7722601776f26d
2021-04-06 09:48:36 -05:00
junboli 4d6ff3de71 Fix DEPRECATION WARNING for pep8
When we execute pep8 locally, we find there is
DEPRECATION WARNING, This warning will be an error
in tox4 and above, this change is to fix this.

Change-Id: Iaebe8ffe3aa1b92956403c679600fad0098d8329
Partial-Bug: #1835386
Signed-off-by: junboli <junbo85.li@gmail.com>
2019-07-04 10:27:56 -04:00
Dean Troyer 4d8220b2df Updates to DevStack plugin
* Add a basic DevStack job to exercise this
* Clean up plugin to match DevStack conventions

Change-Id: I5b079eacebf9ddb433b5e831d557afe6a1be6880
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-11-28 09:31:13 -06:00
98k e3254e636a fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: I8fd0c040a8c827d2f3b6f0ae796b1459713d3bf2
2018-10-05 10:57:02 +00:00
Abraham Arce 86dca67786 [Doc] OpenStack API Reference Guide
Baseline changes to comply with OpenStack API documentation
from OpenStack Documentation Contributor Guide [0]:

- [1] How to document your OpenStack API service
- Add SPDX-License-Identifier: Apache-2.0

[0] https://docs.openstack.org/doc-contrib-guide
[1] https://docs.openstack.org/doc-contrib-guide/api-guides.html

Story: 2002712
Task: 26671

Change-Id: Ia16194f531328f2e936b296a489b936b384addb5
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-25 14:01:33 -07:00
Abraham Arce 9de7e2d16e [Doc] Release Notes Management
Baseline changes to comply with Release Notes Management
based in Reno [0]:

* Use build-openstack-releasenotes job for release notes
  (We can't use the OpenStack releasenotes template as it includes
  publish jobs, stx needs its own)
* Add newnote tox environment as convenience for creating new release
  notes, re-using the releasenotes venv.
* Change to SPDX-License-Identifier: Apache-2.0

[0] https://docs.openstack.org/reno/latest/

Story: 2003101
Task: 26667

Change-Id: I33b3083a952faf36168faec4255bec0f25edf9ca
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-25 14:01:18 -07:00
Abraham Arce f71ded2eba [Doc] Building docs following Docs Contrib Guide
Baseline changes to comply with OpenStack Documentation
Contributor Guide [0] starting with the following sections:

- Project guide setup
  - [1] sphinx-quickstart
  - [2] doc/source/ layout
- Building documentation
  - [3] tox -e docs
- Using documentation tools
  - [4] openstackdocstheme
- Use build-openstack-docs-pti job template for docs
- Change to SPDX-License-Identifier: Apache-2.0

[0] https://docs.openstack.org/doc-contrib-guide
[1] http://www.sphinx-doc.org/en/master/usage/quickstart.html
[2] https://docs.openstack.org/doc-contrib-guide/project-guides.html
[3] https://docs.openstack.org/doc-contrib-guide/docs-builds.html
[4] https://docs.openstack.org/openstackdocstheme/

Story: 2002708
Task: 26661

Story: 2002813
Task: 26662

Change-Id: Ib69552d026042572469e1ce4d97e6d42ac1dd49b
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-25 14:00:54 -07:00
Al Bailey cb1b85b13f Add bugbear to flake8 and cleanup some errors
Added a python3 tool called bugbear as part of flake8
Moved the tox.ini for nfv to a new location.
Removed nfv tox calls from the bottom level tox.ini file
Specified the queens upper-constraint. This is because the
kubernetes client from pike is not what is shipped.

Adds a separate tox.ini for nova-api-proxy.

Fix two of the errors flagged by bugbear:
  B006: Do not use mutable data structures for argument defaults.
  B306: BaseException.message has been deprecated as of Python 2.6
       and is removed in Python 3.

Fix unused imports in Flake8
  F401 '<module>' imported but unused

Clean up two pylint errors:
 W0102 dangerous-default-value
 W0631 undefined-loop-variable

Story: 2003499
Task: 26410
Change-Id: I61deb6a002f963cd58fe019bb54a4c3296809391
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-13 14:12:48 -05:00
Al Bailey 6cf70c6c51 Cleanup flake8 warnings related to file comments
The following flake8 errors are no longer suppressed:
 E116 unexpected indentation (comment)
 E261 at least two spaces before inline comment
 E265 block comment should start with '# '

Story: 2003499
Task: 26408
Change-Id: I17d8bbf9c1511a58a7322606f41bfbb01a841953
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-12 11:26:56 -05:00
Al Bailey 19a881ee2d Cleanup whitespace errors suppressed for flake8
These errors are no longer suppressed:
 E225 missing whitespace around operator
 E226 missing whitespace around arithmetic operator
 E231 missing whitespace after ','
 E241 multiple spaces after ','

Story: 2003499
Task: 26386
Change-Id: Ic97e46b0a3b57456740a2a5935a8a3e6d3b81427
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-11 14:46:30 -05:00
Lachlan Plant edda9455bd Enable voting on py27 tests
Turn on zuul voting for py27 in stx-nfv
Modify tox envlist to reflect check jobs
Add pylint to gate jobs

Story: 2003499
Task: 26217

Change-Id: I1c966ac571d88a4487752ae8bbcdc219e4c2b66c
Signed-off-by: Lachlan Plant <lachlan.plant@windriver.com>
2018-09-06 14:49:59 -05:00
Al Bailey 5539db9dcf Convert pep8 to flake8 for stx-nfv
Flake8 and Hacking offer stricter style checks than pep8.

This submission fixes these codes:
 E305 expected 2 blank lines after class or function definition, found 1
 E722 do not use bare except'
 F841 local variable 'blah' is assigned to but never used
 H101: Use TODO(NAME)
 H201: no 'except:' at least use 'except Exception:'
 H237: module commands is removed in Python 3
 H238: old style class declaration, use new style(inherit from `object`)

This submission enables 2 additional checks that are off by default
 H106 vim config in files
 H203 Use assertIs(Not)None to check for None

8 hacking codes and 2 flake8 types were added to the ignore list
and will be fixed by later updates.

An optional hacking code H904 will be enabled and the code fixed
by a later commit

Story: 2003499
Task: 26195
Change-Id: I48f99fc0dd41addc574c81cee6662600faeb8e75
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-05 17:10:22 -05:00
Al Bailey 3a419fef8d Cleanup several pep8 warnings
The following pep8/flake8 warnings are no longer
being suppressed:

 E101 indentation contains mixed spaces and tabs
 E203 whitespace before ':'
 E211 whitespace before '('
 E228 missing whitespace around modulo operator
 E251 unexpected spaces around keyword / parameter equal
 E302 expected 2 blank lines, found 1
 E303 too many blank lines

Story: 2003499
Task: 26190

Change-Id: I8df57783417e4372a008f876365f9c24d2c0cb4b
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-05 11:45:07 -05:00
Al Bailey b472324664 Enable pylint for nfv as a gating job for stx-nfv
This invokes pylint on all the nfv code.
The pylint.rc file currently suppresses failing lint tests.
In later submissions those suppressed types will be enabled
and their code fixed.

Story: 2003499
TaskId: 24944

Change-Id: I4726927a9e5e76a242dec3f7b25f51b2887e505e
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-09-04 13:58:53 -05:00
Al Bailey 597e7bb29b Adding py27 for nfv
Adds a py27 unit test target for nfv.
The unit tests for nfv were written using nose.

Change-Id: I001995be5f2af1d45242eb3c0e05e0615352b173
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-07-10 10:18:28 -05:00
Dean Troyer 76f5066428 Add voting tox-linters job
Also remove bashate from the linters job and the placeholder shell script
as there are normally no shell scripts in this repo.

Change-Id: I41f86245f5809471f894b18a7fa320c938f9e861
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-07-09 15:13:41 -05:00
Al Bailey 01f3717f86 Fix yamllint and bashate tox warnings
yamllint warnings are fixed.
bashate failure was due to not finding any shell scripts.
Added a generic shell script under the test folder.

Change-Id: If4b8a416422356be318f875a28ae2b1785ef818b
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-07-09 12:06:57 -05:00
Al Bailey b5c61d006c Suppress pep8 warnings that are not fixed yet
The code has over 2000 warnings related to indentation and line length
Suppressing these warnings allow us to fix those warnings in manageable code chunks

In addition to suppressing many of the warnings, this submission fixes
 W191 indentation contains tabs
 W291 trailing whitespace
 W292 no newline at end of file
 W293 blank line contains whitespace
 W391 blank line at end of file
 W503 line break before binary operator

Change-Id: If40f73d7312aec574d8141ea1af2cc6f1b4b8a46
2018-06-15 13:14:52 -05:00
Dean Troyer 37f3cabe55 Add default test framework
Change-Id: I93ad513d5491cc4b3e1cba45ac82fd86a4815b26
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-06-11 18:53:08 -05:00