Added in the following tox targets for fm-rest-api:
- bandit
- flake8 / pep8
- pylint (suppressing most of the codes)
All the tox targets run on python3
The test-requirements.txt have been updated
The StarlingX Debian upper constraints are utilized.
The spec-lint (rpm) job is removed from Zuul.
Zuul runs pylint for sub directories
Bandit exclusions are updated.
Included a change to a .py file to trigger
the bandit zuul job.
Test Plan (for fm-rest-api)
PASS: tox -e bandit
PASS: tox -e coverage
PASS: tox -e flake8
PASS: tox -e pylint
Story: 2010531
Task: 47575
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I7ecaf1c90495b283c26e02e3b481bfe4c77c3939
The checkEventYaml script verifies if all contents
are properly populated for the events.yaml file.
This change ensures that check is done by zuul, rather
than during the build.
yaml.load after version 5.1 requires a Loader argument.
The yaml.load in fm-doc are now updated to use safe_load
intead
Test Plan:
PASS: tox -e linters
PASS: remove 'context' field from an alarm and observe
that tox -e linters reports a failure.
PASS: build-pkgs -p fm-doc
Story: 2010531
Task: 47549
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I369ffe4c74fcaf5fe4a916822fed18a78ead8ff8
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
Removed the 'build' target from zuul which just invokes
the devstack script which is un-supported.
Partial-Bug: #2000399
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I59bd7c82c297e12969e31b5de9ac02d2a47834a6
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.
Partial-Bug: #1997255
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ie912dc7ae3f9f1639311f0c1f5cf62070f44909d
Add debian packaging infrastructure for fm-api
so we can create a debian packaging for it.
Also update the directory layout due to limitations
of the STX tool. Update the centos build information
to reflect the new layout.
Story: 2009101
Task: 43091
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I5c9784647581f31384d7475f596663adc0d26498
The tox jobs for fault are having problems with a
timeout, which appears to be related to how long it takes
to setup the python requirements.
This update tries to limit the scope for yamllint, and
eliminate some of the sdist related actions.
pylint has been relocated to the test-requirements file.
The usedevelop = False is required for the base tox.ini
because there are no setup files at that directory level.
Several pylint errors had to be suppressed, and will be
restored once py3 changes are merged from centos8 branch.
Story: 2008943
Task: 42967
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: Icc8747226511f0be614df20800813fe4eb9e6b96
Set hacking to < 4.0.1 in test-requirements.txt so that
the pep8 gate passes again.
Test:
Ran tox -e pep8 command to validate the flake8 job and result.
Related-Bug: 1926172
Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I5b27a89d0e078912814ca2999bf28e6602980fd0
python 2.7 zuul jobs such as py27 and pylint could fail
when trying to import bandit using the new pip
since bandit 1.7 was released Dec 12 and is python3 only.
The cpp file header was only changed in this review to
trigger the appropriate zuul jobs.
Partial-Bug: #1907678
Change-Id: Idb1e97d16773d36027d29f4eb100d8b453a8069f
Signed-off-by: albailey <Al.Bailey@windriver.com>
In the current implementation "Fault" is responsible
for the generation and dispatch of traps.
This logic is removed from it, leaving only the
responsibility of sending the metadata of a trap
to a service dedicated to generating and sending them.
The fm.conf file will contain the IP and port values
of the service.
Story: 2008132
Task: 40867
Depends-On: https://review.opendev.org/761217
Change-Id: I575dfa2329f11821404ca4cb1d539e5189444b4e
Signed-off-by: Pablo Bovina <pablo.bovina@windriver.com>
flake8 2.5.5 fails on ubuntu-focal zuul machines running python3.8
with the following error:
AttributeError: 'FlakesChecker' object has no attribute 'CONSTANT'
Fixed:
E117 over-indented
E741 ambiguous variable name
F841 local variable is assigned to but never used
Per-Line-Suppressed:
E402 module level import not at top of file
F632 use ==/!= to compare constant literals
Global Suppress:
W504 line break after binary operator
W605 invalid escape sequence
The suppressed errors can be fixed by later submissions.
Change-Id: I2df3ece427f0c84ce16c1a82f4d9f0c9a5a6982b
Partial-Bug: 1895054
Signed-off-by: albailey <Al.Bailey@windriver.com>
Setting up the bandit tool for the scanning of HIGH severity issues
in the python codes under Starlingx/fault 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 Batch2 change.
Story: 2007541
Task: 39490
Depends-On: https://review.opendev.org/#/c/721294/
Change-Id: I84449691281d9769e9219e6f9f1338c20f518f40
Signed-off-by: Sharath Kumar K <sharath.kumar@intel.com>
Adding a pylint tox target which only suppresses
the error codes that are currently failing.
This will prevent any of the passing checks from being
broken by future submissions.
The currently suppressed codes can be fixed by subsequent
commits.
Adds a zuul pylint target to invoke the new tox target.
Unified the install_command in tox.ini to ensure
the upper constraints are used.
Change-Id: Id2fb8cbb7ce63f844a06403410d461c601822ad6
Story: 2007082
Task: 39020
Signed-off-by: albailey <Al.Bailey@windriver.com>
Add add the first unit test for fm-rest-api/fm/fm/common/timeutils.
Add tox task for py27/35 as zuul checking and gating jobs.
Story: 2007082
Task: 38077
Change-Id: I2f259dcf2178f42546966063c0d724bc17e2a804
Signed-off-by: chenyan <yan.chen@intel.com>
This moves the linters to use the zuul-jobs
Remove the old flock-check-packaging
Depends-On: https://review.opendev.org/#/c/679353
Change-Id: I5abc8dd461e2728d43eddc528f23d940fc45a32a
Signed-off-by: Saul Wold <sgw@linux.intel.com>
This is a tox job to scan the RPM specfiles and do some
initial sanity checks and use the OpenDev Spec-Cleaner tool, this
is not a 'linter' per-se, but will output a diff of recommended
changes for the specfile.
Initial disable cleaning our default CentOS specfiles since we
know they need work, we can enable this later.
This uses the speclint script in starlingx/integ a proposed
by the Depends-On.
The recommended guildline for openSUSE is located here:
https://en.opensuse.org/openSUSE:Specfile_guidelines
Fix up fm-rest-api opensuse specfile
Depends-On: https://review.opendev.org/664995
Change-Id: I46da780a667569a9dccedd551d955c983e9601cd
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Flake8 currently ignores the following errors:
H233: Python 3.x incompatible use of print operator
H236: Python 3.x incompatible __metaclass__
H238: Old style class declaration, use new style
Enable them for python3 compability
Change-Id: I8959f3a78ce683eb93a16234908662189dd7c8a5
Story: 2004515
Task: 29304
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
* Pull binary build steps into separate functions
* Add build.sh to call binary builds without the rest of DevStack
* Add new stx-fault-build job and tox build environment
* Make stx-fault-devstack voting (still only devstack/*)
Change-Id: I6692fc1f75db413860ede2657f4f1501b95c10c0
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
By setting 'hacking' as the dependency, flake8
will include hacking and other checks.
This is the same set used by other openstack
components.
This commit suppresses any of those new checks that
would fail.
H102 Apache 2.0 license header not found
H104 File contains nothing but comments
H105 Don't use author tags
H233 Python 3.x incompatible use of print operator
H236 Python 3.x incompatible __metaclass__
H238 old style class declaration, use new style
H301 one import per line
H306 imports not in alphabetical order
H401 docstring should not start with a space
H403 multi line docstrings should end on a new line
H404 multi line docstring should start without a leading new line
H405 multi line docstring summary not separated with an empty line
H702 Argument to ... must be a string
H903 Windows style line endings not allowed in code
At a later time, additional commits will fix and un-suppress them.
Story: 2004515
Task: 29304
Change-Id: I7f9e36cb605e47338dc5d33c94d1c0b09943a38a
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
At the moment it just installs and partially configures it.
Depends-On: https://review.openstack.org/610756
Change-Id: If74b81841f583ad6d3850cd12ee337c1b4a1a177
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Add a DevStack plugin to build and install the basic Fault dependencies
required by most of the other STX projects. The bulk of this was originally
submitted in https://review.openstack.org/#/c/595865/.
Installing and starting the REST API service will follow in a later review.
Also enable bashate on the devstack plugin and max yaml line length
set to 260
Change-Id: I95009fceee28a81e6d8795e90b259e0e1b175327
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
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: I4a4959ab6486405ddc6b3b5bee8142b2afce259f
Baseline changes to comply with OpenStack API documentation
from OpenStack Documentation Contributor Guide [0]:
- [1] How to document your OpenStack API service
- Adding 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: 26697
Change-Id: I1816a0e6bea3f577689804362da39a617368e7b7
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
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.
* Adding SPDX-License-Identifier: Apache-2.0
[0] https://docs.openstack.org/reno/latest/
Story: 2003101
Task: 26696
Change-Id: I03cd9d9fe6e2d0d4ae1a02210f74a456a2a2839c
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
Fix bashate and yamllint to only run if files are provided
Fix whitespace errors in fm-doc/fm_doc/events.yaml
Relax line length requirement in yamllint
Story: 2003361
Task: 24413
Change-Id: I097beeea4a2e36790ba0de7d9c4fb6dcb55c24a6
Signed-off-by: Lachlan Plant <lachlan.plant@windriver.com>
Enable test for pep8 and use flake8 as check tool.
Story: 2003310
Task: 24446
Change-Id: Idf5cbde46dc1a2a579587438b83f2dcb7b9352bb
Signed-off-by: chenyan <yan.chen@intel.com>