Commit Graph

29 Commits

Author SHA1 Message Date
Al Bailey 4a424d77cc Fix zuul pep8 failures related to bugbear
Feb 13 released a new version of bugbear that raises new
error codes.  We are setting an upper limit for bugbear
to be from before that version was released.

bandit is also reporting a hashlib error.  The bandit
job is non-voting, but the error is now being suppressed.

Story: 2010531
Task: 47313
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Iffb790c67e658c7a40c697e364cb34f4c4f9ec6c
2023-02-14 16:47:42 +00:00
Al Bailey 88b1d3b5c6 Update zuul jobs from python2 to python3
- removed the old and unused devstack job.
 - needed to update pylint to python3
 - needed to enable bindep to install the packages
required for installing mysqlclient

No test plan is provided, because the purpose of this
change is to determine if zuul is broken for this repo,
and then fix it.

Story: 2010531
Task: 47313

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I6655792d692644f2c6320b0ef1d66283e17d7bb3
2023-02-07 20:20:57 +00:00
Al Bailey 3608cdb14e 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: I04352e372c8ea2008f7ab0e7cdfa1d8b975e4251
2022-12-26 22:09:27 +00:00
Al Bailey e18364ed2c Fix openstack-tox jobs for ha repo
The Zuul upper-constraints env variable declaration needed
to be added to tox.ini otherwise an older constraints
was being used which does not work with newer
versions of python.

Needed to suppress bugbear error B009 also, due to newer
version of flake8-bugbear.

Partial-Bug: #1997255

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I73f4fbbf51a09f1e4c1a633a7a8b62cf969ff33a
2022-11-22 01:22:52 +00:00
Bernardo Decco acd187ffdb Add pylint py3 portability checks for the ha repo
A lot of work has gone into making sure that StarlingX is python3
compatible. To ensure future compatibility, enable the python3
portability checks. Disable the checks that are raising errors.
Another set of commits will address the offending code.

Story: 2006796
Task: 43269
Signed-off-by: Bernardo Decco <bernardo.deccodesiqueira@windriver.com>
Change-Id: I48d05d5bd8a4820fb02a47023af06411b62fa0a8
2021-09-13 14:38:49 -03:00
albailey 6ab82889af Fix zuul jobs broken due to pip upversion
The install_command for docs, newnote and api-ref
needed to be overridden to not use upper constraints.

The bandit requirement needed to be made python3 only.

The bandit scan was failing, so it is now updated to
allow individual bandit failures to be suppressed in tox.ini

Need to include a py file change in order for bandit to be
triggered by zuul.

Partial-Bug: #1907678
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: Ic73d0ea590ab1b7857f7275fa9c71828b0d343ee
2020-12-17 13:40:42 -06:00
albailey 57225bb34a Use newer flake8 to run on ubuntu-focal Zuul machines
flake8 2.5.5  fails on ubuntu-focal zuul machines running python3.8
with the following error:
AttributeError: 'FlakesChecker' object has no attribute 'CONSTANT'

The update removes the version constraint to use newer flake8.

The linters can be run in python3.
Pylint cannot be run in python3 because mysql-python is not
compatable, so a new zuul job for pylint is now added.

The flake8 errors that the newer version raises are all suppressed,
and some of them should be addressed by someone with familiarity in
this repo.

Change-Id: Ida6447728d4175173c02130cb04a6013e4f966f9
Partial-Bug: 1895054
Signed-off-by: albailey <Al.Bailey@windriver.com>
2020-09-16 13:01:03 -05:00
Sharath Kumar K 3b68098be4 Tox and Zuul job for the python code scan in starlingx/ha
Setting up the bandit tool for the scanning of HIGH severity issues
in the python codes under Starlingx/ha folder.
Expecting this merge will enable zuul job for CI/CD of bandit scan.

Configuration files:
1. tox.ini for adding bandit environment and command.
2. test-requirements.txt for adding bandit version.
3. .zuul.yaml file for adding bandit job and configuring under
   check job to run code scan every time before code commit.

Test:
Run tox -e bandit command inside the fault folder to validate the
bandit scan and result.

Please note:
Changes will be implemented in batches and this is Batch3 change.

Story: 2007541
Task: 39621
Depends-On: https://review.opendev.org/#/c/721294/

Change-Id: I01f81d7c52c12432965106f9603e4db600381971
Signed-off-by: Sharath Kumar K <sharath.kumar@intel.com>
2020-06-05 06:21:44 +00:00
Shuicheng Lin 1781f41eae Fix Zuul linters job failure
"env:UPPER_CONSTRAINTS_FILE" doesn't work with latest Zuul.
Remove it to make sure upper-constraints working.

Closes-Bug: 1880097

Change-Id: Ibc6ab625eda1b5695798d044ef367f375086c87c
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
2020-05-28 18:18:00 +08:00
Don Penney 660e06a982 Update tox.ini files to use stein constraints
This updates the upper-constraints.txt used by tox for
installing python modules to reference the stable/stein
constraints.

Change-Id: Ia875f05d807bd7404ae8ad12f852bce092202ee8
Partial-Bug: 1834216
Signed-off-by: Don Penney <don.penney@windriver.com>
2019-06-25 13:04:56 -04:00
Zuul c6748557ef Merge "Fix Flake8 Bugbear Errors" 2019-04-23 18:42:01 +00:00
Dean Troyer 08bff2798f Followup opendev cleanup and test jobs
Depends-On: https://review.opendev.org/653964
Depends-On: https://review.opendev.org/653961
Depends-On: https://review.opendev.org/654013
Depends-On: https://review.opendev.org/654024
Depends-On: https://review.opendev.org/654255
Depends-On: https://review.opendev.org/654256
Change-Id: Ie110350e44b0dd333f3b3969773e4ef21674381c
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-04-21 14:31:33 -05:00
Eric Barrett 24c42133f8 Fix Flake8 Bugbear Errors
Flake8 is failing due to bugbear updating with new error codes:
B009: Do not call getattr with a constant attribute value
B010: Do not call setattr with a constant attribute value
Fix these errors by using normal property access instead

Change-Id: Ib857d229ae86e88cb5dbf69e826b25d6018c8547
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-04-15 17:06:14 -04:00
Eric Barrett 687ed8c747 Enable Do not use Mutable Default Args Error
Flake8 currently ignores do not use mutable default arguments error
Enable B006 for more thorough testing of code

Change-Id: I5b08a56f945158c3b3c23574c048363e59da6001
Story: 2004515
Task: 30172
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-04-15 12:53:36 -04:00
Dean Troyer 0c8ca24e5b Add DevStack support
This builds, installs and cleans some of the SM components, plus adds
a DevStack job and a build.sh script to build components outside DevStack.

It uses the 'new' DevStack base job flock-devstack-base directly.

Also some interesting work-arounds were required to build sm-common and sm-db,
need to sort out the differences between CentOS 7.5 and Ubuntu Xenial.

Fixed a couple of occurrances of this error:
  sm_db_service_domain_neighbors.c:311:25: error: ISO C++ forbids
  comparison between pointer and integer [-Werror=permissive]
     if( '\0' != record->orchestration )
                        ^~~~~~~~~~~~~

02Apr2019 - Add new skips for flake8 after upstream release
03Apr2019 - Merge with https://review.openstack.org/#/c/647490/2, at this point
            there is not much reason to do this in two steps.

Change-Id: I33c44a764295e8e0a7ae4771ea02e950f06bf2a2
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-04-04 15:43:20 -05:00
Eric Barrett b4fd53a15e Ignore New Flake8 Bugbear Errors
Flake8 is failing due to bugbear updating with new error codes:
B009: Do not call getattr with a constant attribute value
B010: Do not call setattr with a constant attribute value
Ignore them for now
Lock down bugbear version to prevent further Zuul issues

Change-Id: Idf4f60b51a3362608917dfaf443b0444e6aa685c
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-04-03 16:12:05 -04:00
Sun Austin da53f143ee Fix flake8 errors and disable ignore case
below issures are removed from ignore cases:
    E114 indentation is not a multiple of four (comment)
    E116 unexpected indentation (comment)
    E121 continuation line under-indented for hanging indent
    E122 continuation line missing indentation or outdented
    E123 closing bracket does not match indentation of opening bracket's line
    E124 closing bracket does not match visual indentation
    E125 continuation line with same indent as next logical line
    E126 continuation line over-indented for hanging indent
    E127 continuation line over-indented for visual indent
    E128 continuation line under-indented for visual indent
    E129 visually indented line with same indent as next logical line
    E131 continuation line unaligned for hanging indent
    E201 whitespace after '('
    E228 missing whitespace around modulo operator
    E231 missing whitespace after ','
    E241 multiple spaces after ':'
    E251 unexpected spaces around keyword / parameter equals
    E265 block comment should start with '#'
    E271 multiple spaces after keyword
    E302 expected 2 blank lines, found 1
    E303 too many blank lines
    E305 expected 2 blank lines after class or function definition, found 1
    E704 multiple statements on one line (def)
    E713 test for membership should be 'not in'
    E714 test for object identity should be 'is not'
    E722 do not use bare except'
    E731 do not assign a lambda expression, use a def
    E999 SyntaxError: invalid syntax (this is likely python3)
    F401 <foo> imported but unused
    F841 local variable 'foo' is assigned to but never used
    H201: no 'except:'
    H233: Python 3.x incompatible use of print operator
    B001 Do not use bare `except:`
    B004 Using `hasattr(x, '__call__')` to test
         if `x` is callable is unreliable.
    B305 `.next()` is not a thing on Python 3. Use the `next()` builtin.
    B306 `BaseException.message` has been deprecated as of Python 2.6
          and is removed in Python 3.
    B007 Loop control variable 'key' not used within the loop body.
remain below issues in ignores:
    E402 module level import not at top of file
    ./service-mgmt-api/sm-api/sm_api/cmd/__init__.py:25

    Hxxx since which are related with document format

    F811 redefinition of unused '<foo>' from line <x>
    ./service-mgmt-tools/sm-tools/sm_tools/sm_configure.py:18

    F821 undefined name 'e'
    ./service-mgmt-api/sm-api/sm_api/common/utils.py:448

    B006 Do not use mutable data structures for argument defaults.
    ./service-mgmt-api/sm-api/sm_api/common/service.py:59

    B008 Do not perform calls in argument defaults.
    ./service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py:117

Test have been done:Build,Deploy,some smc command,such as smc service-list,
smc service-show, sm-dump, etc

Story: 2003430
Task: 26524

Change-Id: I3e2a4a31f87e3ff66cfce86f54285e830ee1c3dc
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-11-07 08:12:37 +08:00
Sun Austin 6753274b28 Fix: "metaclass" issues for Python 2/3 compatible code.
remove "__metaclass__ = abc.ABCMeta"
and adding decorator "@six.add_metaclass(abc.ABCMeta)" on class

and removing pep8 ignore case

Story: 2003430
Task: 27476

Change-Id: If60b8d5662d9a87b217a9b1d48a2c3e9b037884b
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-26 11:49:16 +08:00
Zuul c3050c7fc1 Merge "force flake8 < 3.6.0 to avoid break current gate" 2018-10-24 16:48:01 +00:00
Sun Austin d8bf005235 force flake8 < 3.6.0 to avoid break current gate
the version flake8 3.6.0 will cause below error
 W504 line break after binary operator
 W605 invalid escape sequence '\w'
 F901 'raise NotImplemented' should be 'raise NotImplementedError'

Change-Id: If9a8c678aa1b573ec7b4e5ad324ba86c5d90b959
Signed-off-by: Sun Austin <austin.sun@intel.com>
Partial-Bug: 1799721
2018-10-24 09:50:33 -05:00
Sun Austin 4fe73f515d Fix: "except" issues for Python 2/3 compatible code.
change "except ValueError, e:"
to "except ValueError as e:"

and remove tox H231 from ignore for pep8 check
Story:2003430
Task: 26522

Change-Id: I06c7646c375ada7f8f06f870a7bdb0d7fc282e5a
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-22 11:49:35 +08:00
98k 959e7e4ea0 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: I98a58d37d067569ad73429ece9f49780bfe73e97
2018-10-11 01:46:45 +00:00
Erich Cordoba 54f4802bb1 Unsupress pylint warnings.
The W291,W292,W391,W503,W601 warnings were fixed and
tox.ini updated accordingly.

Story: 2002803
Task: 26911

Change-Id: I1e5f0b1f72b06ad8b5cac07921e9d14171623ba0
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
2018-10-04 14:19:31 -05:00
Al Bailey 6c5b844111 Adding pylint target to stx-ha
The voting linters job will now run pylint on the python code.
All failing pylint codes are currently suppressed.
Further tasks will be created to cleanup those failing tests.

The only code changes were comments which perform inline suppression
of pylint warnings. Those lines are not meant to be fixed since those
imports cannot succeed in a tox env.

Story: 2002803
Task: 26883
Change-Id: I4a25599fb60f58b168dbec001d3f2d24e0e2c235
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-10-04 09:20:06 -05:00
Al Bailey a6ab2ba896 Turn on pep8 voting
The purpose of this commit is to:
 - make this pep8 zuul job voting
 - convert from pep8 to flake8
 - add the bugbear plugin
 - suppress any tests that are currently failing
 - prevent fixed errors from being re-introduced

Further tasks will be required to un-suppress the
failing tests and make them pass

Story: 2002803
Task: 26833
Change-Id: I0421ebb3ce486c066f968052c38b733b3a145114
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-10-01 13:49:04 -05:00
Abraham Arce a59b5954d1 [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

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

Story: 2002712
Task: 25749

Change-Id: I54d5637c1611c824eac3f3cb45a00559f2a28ab7
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-27 10:14:44 -07:00
Abraham Arce 6a4769ec68 [Doc] Release Notes Management
Baseline changes to comply with Release Notes Management
based in Reno [0] a release notes manager.

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

Story: 2003101
Task: 25748

Change-Id: I7d7fdfe38d6a22c0bb8195e9bc82c2df759d06c7
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-26 11:33:30 -05:00
Abraham Arce 208749ee3b [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
- Adding 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: 25745

Story: 2002813
Task: 25747

Change-Id: Idb2485cfc2e21e2f76d2fa24faefadbf146c4217
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-25 16:14:51 -07:00
Dean Troyer 18aadcc9bf Add default test framework
Change-Id: Ie97032884de0d70dfc57d97ebd2055148fff1e38
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-06-09 08:56:58 -05:00