Commit Graph

29 Commits

Author SHA1 Message Date
Al Bailey e5a8ba7ff4 Tox and Zuul cleanup for python3.9
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
2023-03-02 19:32:25 +00:00
Al Bailey bd8857357b Run checkEventYaml as part of zuul linter job
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
2023-02-27 16:16:01 +00:00
Al Bailey 13b24042a1 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

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
2022-12-27 01:38:20 +00:00
Al Bailey cf658fba98 Fix openstack-tox jobs for fault 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.

Partial-Bug: #1997255

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ie912dc7ae3f9f1639311f0c1f5cf62070f44909d
2022-11-22 01:15:40 +00:00
Charles Short 7b127659e5 Add debian package infra for fm-api
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
2021-09-27 12:53:01 -04:00
albailey 90d9eb4161 Attempt to fix zuul jobs from timing out
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
2021-08-10 07:32:57 -05:00
Charles Short 03090ca2bb Fix pep8 gate failures
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
2021-04-26 15:39:52 -04:00
albailey 08130cd625 Fix zuul jobs broken due to pip upversion
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>
2020-12-18 08:41:07 -06:00
Pablo Bovina 8e74a0ee1e Reimplementation logic for trap generation
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>
2020-12-08 18:37:50 -03:00
albailey 42a9cfa882 Use newer flake8 on python3.8 zuul systems
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>
2020-11-16 13:35:31 -06:00
Sharath Kumar K 2f364daa08 Tox and Zuul job for the python code scan in starlingx/fault
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>
2020-04-27 11:14:36 +02:00
albailey ce56ce7ea5 Adding pylint zuul and tox target
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>
2020-03-11 09:05:18 -05:00
chenyan 385f274a8f Create test framework for python with stestr.
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>
2020-01-16 16:45:45 +08:00
Saul Wold a93d482461 Add specfile linter and build templates
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>
2019-08-30 11:21:18 -07:00
Saul Wold 91af45019b Tox: add tox job and requirements to improve specfiles
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>
2019-07-16 13:15:24 -07:00
Eric Barrett 8142803bfd Enable Python3 Compatibility
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>
2019-06-07 13:35:58 +00:00
Zuul d139b39fda Merge "DevStack cleanups" 2019-02-06 14:26:19 +00:00
Dean Troyer 68c99f6f66 DevStack cleanups
* 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>
2019-02-04 13:03:38 -06:00
Al Bailey a40bce19f9 Enable additional flake8 checks
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>
2019-02-01 17:07:53 -06:00
Dean Troyer 95edd7af14 Add fm-rest-api and fm-client to DevStack
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>
2018-10-29 10:54:49 -05:00
Zuul efe3a5bd35 Merge "fix tox python3 overrides" 2018-10-10 14:57:04 +00:00
Dean Troyer e207777eda Add DevStack support for FM dependencies
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>
2018-10-09 11:19:02 -05:00
98k af44ede480 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: I4a4959ab6486405ddc6b3b5bee8142b2afce259f
2018-10-05 10:40:58 +00:00
Abraham Arce e3d4f08eb5 [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
- 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>
2018-09-25 15:55:02 -07:00
Abraham Arce 92e1b2e3bf [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.
* 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>
2018-09-25 15:54:52 -07:00
Abraham Arce 352583420d [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: 26693

Story: 2002813
Task: 26694

Change-Id: I603077bc75bfed4b6032c65dfb308a75cfb0aa76
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2018-09-25 15:54:38 -07:00
Lachlan Plant 647dd28d1c Fix tox linters for zuul
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>
2018-08-23 13:31:24 -05:00
chenyan 7bdf6fd47c add flake8 as pep8 codestyle check.
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>
2018-08-10 11:39:57 +08:00
Dean Troyer 3a4be5f79c Add default test framework
Change-Id: Idbc2f22873edff7a80b5abc5a5110b41b75fa6cc
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-06-09 08:44:12 -05:00