Commit Graph

29 Commits

Author SHA1 Message Date
Al Bailey 70f9755c1f Update patch-alarm tox for python3
- Removed the old python2 entries
- Replaced mock with unittest.mock
- Unsuppressed most flake8 and pylint checks
- Added the startup script to flake8 checking and fixed
a python3 syntax issue in the error handling.
- Regenerated an updated /  modern pylint.rc
- Updated the upper-constraints to be Debian and python3

Test Plan:
  Pass: Build / Install / Unlock
  Pass: trigger a patch alarm

Story: 2010642
Task: 47815
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Id8c612a677253dfc53931719af7823572d1536ef
2023-04-12 18:28:07 +00:00
Al Bailey 2559375005 Update debian package versions to use git commits
The Debian packaging has been changed to reflect all the
git commits under the directory, and not just the commits
to the metadata folder.

This ensures that any new code submissions under those
directories will increment the versions.

Test Plan:
  PASS: build-pkgs -p enable-dev-patch
  PASS: build-pkgs -p python3-patch-alarm
  PASS: build-pkgs -p cgcs-patch

Story: 201055
Task: 47225
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ieb02cbdd8234338bb8712096b7cccd2027582983
2023-02-09 17:26:41 +00:00
Al Bailey 7b0ecddf20 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

Remove the deprecated cgcs-patch(CentOS) jobs from zuul
sw-patch directory contains the Debian support.

Move from xenial to bionic for patch-alarm zuul job.

Partial-Bug: #2000399

Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ia0dcf61fc4a2c7911434158dd2e8bca7a787249a
2022-12-23 16:01:02 +00:00
Al Bailey be09ccc584 Fork cgcs-patch package as sw-patch for Debian
The original cgcs-patch is rpm based which requires a
complete re-write to work on ostree/dpkg systems like Debian.

The code has been forked, since the older Centos env and
python2.7 are end-of-life.

Forking the code allows all new development to not
require re-testing on Centos.

The debian folder under cgcs-patch has been moved
under sw-patch

Renaming and refactoring will be done in later commits.

pylint is un-clamped in order to work on python3.9
Some minor pylint suppressions have been added.

Test Plan:
 Verify that this builds on Debian
 Verify that the ISO installs the new content on Debian without
breaking packages that import cgcs_patch.
 Verify patching service runs on Debian

Co-Authored-By: Jessica Castelino <jessica.castelino@windriver.com>
Story: 2009101
Task: 43076
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I3f1bca749404053bae63d4bcc9fb2477cf909fcd
2022-03-29 20:35:14 +00:00
Yue Tao 1fabc3b456 patch-alarm: remove dl_hook
Replace dl_hook with "src_path" and "src_files"

Test Plan:

Pass: successfully build patch-alarm
Pass: No difference comparing with the result of dl_hook

Story: 2009101
Task: 43897

Signed-off-by: Yue Tao <Yue.Tao@windriver.com>
Change-Id: I7f7a59271d5f290b6f6a8778984bc5d3176536cd
2022-01-17 10:56:07 +08:00
Tracey Bogue 0131cd569c Add Debian packaging for patch packages
Create Debian packages for patch-alarm and enable-dev-patch.

Story: 2009101
Task: 43897

Signed-off-by: Tracey Bogue <tracey.bogue@windriver.com>
Change-Id: Iaa0958cc857d914a99c69e063b46ded59b4af285
2021-12-02 10:19:42 -06:00
Charles Short b05192c800 Fix unit tests
Due to a recent change in fm-api's directory structure, unit tests would
fail since the virtualenv would not be able to find fm-api/setup.py.
Adjust the tox.ini to point to the correct directory. Tested locally
by running tox.ini.

Depends-On: https://review.opendev.org/c/starlingx/fault/+/806046

Story: 2009101
Task: 43091

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: If55a6d92dc861b23516637fcb90c52852c3fd92a
2021-09-28 14:24:59 -04:00
Ricardo Alvim 8141deff72 Add pylint py3 portability checks for the update 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.

Add following suppress warnings in cgcs-patch/pylint.rc:
- W1618: no-absolute-import
- W1619: old-division
- W1630: cmp-method

Add following suppress warnings in patch-alarm/pylint.rc:
- W1618: no-absolute-import

Story: 2006796
Task: 43198

Signed-off-by: Ricardo Alvim <Ricardo.AlvimNetto@windriver.com>
Change-Id: I0cbe384a72792cf123976f0de2020ae6f3fcd208
2021-09-13 09:55:50 +00:00
Zuul 688faee942 Merge "py3: Add support for python3.9" 2021-08-31 13:45:23 +00:00
Charles Short 418deca242 py3: Add support for python3.9
Enable python3.9 in tox.ini and zuul gate. Tested locally
by running tox and running in the zuul gate.

Story: 2009101
Task: 43105

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I44eaeb134d6b7b54788469fa469b04674aeb90c0
2021-08-27 11:36:42 -04:00
Andrei Grosu 6b8988fbba Fix python3 issue in patch-alarm-manager.
Wrap DaemonRunner class from 3rd party python-daemon library which
is not compatible with python3.

The solution was lifted from:
https://review.opendev.org/c/starlingx/utilities/+/786837
as it was the acceptable way to work around python-daemon limitations.
Patching python-daemon was not accepted as per:
https://review.opendev.org/c/starlingx/integ/+/785523

Story: 2008454
Task: 42789
Depends-On: I3c68322603eaaf9a78d101b5b1198e9582497105

Signed-off-by: Andrei Grosu <andrei.grosu@windriver.com>
Change-Id: I66b2ac6825b78228a40869a3721e6853f2bbe83f
(cherry picked from commit fd1717baee)
2021-07-28 09:14:47 -04:00
Andrei Grosu 358b590a4d Update test-requirements
cgts-patch was updated to use pycryptodomex.
patch-alarm has a dependency on cgts-patch.

Need to pull pycryptodomex into the test env.

Story: 2008454
Task: 42789

Signed-off-by: Andrei Grosu <andrei.grosu@windriver.com>
Change-Id: I15728ec80221bf8d473ba91a894d2c272771cc34
(cherry picked from commit 3b62a6e7cb)
2021-07-28 09:13:38 -04:00
Charles Short 49e39fa949 Specify the nodeset zuul jobs
The py2.7 jobs need to specify xenial
The py3.6 jobs need to specify bionic
The focal zuul nodes only have python 3.8 installed in them

Zuul targets that invoke a generic python3 interpreter such
as pep8 is not specified.

Also ignore H216 since we still use py2.7.

The copyright date was updated in order to trigger
the zuul jobs, as a no-delta type of change.

Partial-Bug: 1928978

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I81fd790dfc8a665a4e4e0ff59a013af7921b6e06
Signed-off-by: Charles Short <charles.short@windriver.com>
2021-05-28 11:24:04 -04:00
Don Penney 79dfb60f41 Use PKG_GITREVCOUNT for package versions
This update revises the cgcs-patch and patch-alarm package builds to
drop the old and unneeded custom build_srpm script, in order to use
the PKG_GITREVCOUNT feature for package versions.

Change-Id: If541f55340565cf73213aeac511e69487e53fa11
Story: 2006166
Task: 40137
Signed-off-by: Don Penney <don.penney@windriver.com>
2020-06-22 22:19:34 -04:00
albailey e3be9a2776 Update flake8 to verify patch scripts
To prevent the warning about a newer version of pip
available, the following env setting was added

  PIP_DISABLE_PIP_VERSION_CHECK=1

To prevent sub-calls to tox from using the default pip
cache location, rather than whatever a user may override
using xdg env variables, the following has been added:

  passenv =
      XDG_CACHE_HOME

The python patch scripts are now validated by flake8.
All flake8 tox targets are triggered from a single zuul job.

Story: 2004515
Task: 38581
Change-Id: I105512edbd3da15480355e30c0dd14933584a47b
Signed-off-by: albailey <Al.Bailey@windriver.com>
2020-01-31 09:40:27 -06:00
Don Penney 11d1387020 Add flake8-bugbear and address warnings
This commit adds flake8-bugbear to the patching tox test in order to
identify potential py3 issues and address them now.

Change-Id: I2219e61eff16cc69afa50d554e9f1dd0bb2f1517
Story: 2007050
Task: 38146
Signed-off-by: Don Penney <don.penney@windriver.com>
2020-01-16 13:24:24 -05:00
Al Bailey 5d2da5d041 Fix zuul tox flake8 failures from newer version of hacking
A newer version of hacking was released which enables additional
checks and is breaking flake8 and zuul.

Hacking has now been clamped at 2.0.0 in test-requirements.txt
Added the same for patch-alarm, although it was not failing.

The new checks that are fixed are:
 H106: Don't put vim configuration in source files
 W605 invalid escape sequence
 F632 use ==/!= to compare str, bytes, and int literals
 F841 local variable is assigned to but never used

The following flake8 extension check has been removed:
 H904 Delay string interpolations at logging calls

Closes-Bug: 1856585
Change-Id: I8bdc94539f4a6ce243c4e30efc07eed3bad1ce62
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2019-12-16 09:56:09 -06:00
Al Bailey e45a758a8a Enable tox bandit checks for python in update repo
Bandit gate jobs are used by openstack for security checks.

Adding a zuul job so that any new bandit failures
will be caught.

patch-alarm runs cleanly and does not currently suppress any
bandit checks.

cgcs-patch suppresses several bandit checks which may be
updated and enabled by future commits.

Change-Id: I01414c48266cfb3cb6df9ef400a350a570938189
Story: 2004515
Task: 37697
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2019-12-02 10:30:41 -06:00
Scott Little b0559bc151 Subdirectories 'tsconfig ' relocated to repo 'stx-config'
Story: 2006166
Task: 35687
Depends-On: I6c62895f8dda5b8dc4ff56680c73c49f3f3d7935
Depends-On: I665dc7fabbfffc798ad57843eb74dca16e7647a3
Change-Id: I70b6d52a13836e16139a0ca3f42b9e91e06e43b6
Signed-off-by: Scott Little <scott.little@windriver.com>
Depends-On: I5618547e7e74b76d174f10897b1c747931738cd6
Signed-off-by: Scott Little <scott.little@windriver.com>
2019-09-05 13:04:59 -04:00
Don Penney a5e51f98c8 Add test framework for patch alarm manager
This update sets up the initial testing framework for
the patch-alarm module, with a basic test case.

Additionally, this restructures the tox.ini files. Now
that each python module has its own tox.ini and tests,
the top-level tox.ini can recursively use those. As well,
the Zuul setup can now split the jobs for each module.

Change-Id: I79eed868c5b42e2545ccf0c11dbbbea4336b9b19
Story: 2005939
Task: 34783
Signed-off-by: Don Penney <don.penney@windriver.com>
2019-06-28 17:03:00 -04:00
Saul Wold 3446103e24 cgcs-patch: Fix shebang header to /usr/bin/python
the #!/usr/bin/env is not recommended for ensuring we get the
correct auto-dependency generation.

Change-Id: I87fdf44d38496ba2ff23e2f2f5836943e790f0c2
Signed-off-by: Saul Wold <sgw@linux.intel.com>
2019-06-19 12:29:22 -07:00
Eric Barrett 25dee38f0b Enable Python3 Compatibility
Flake8 currently ignores the following errors:
H237: module is removed in python3
H238: old style class declaration
Enable them for python2/3 compatibility

Change-Id: I4dd66c8ab388119b4abab83fda48a89e108f7821
Story: 2004515
Task: 29303
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-06-06 10:17:52 -04:00
Don Penney 69c9cb0568 Fix bug in patch-alarm-manager start check
The start function of the patch-alarm-manager init script
checks for a valid pidfile to see if the process is
already running. Unfortunately, the code has a couple
of typos that cause the check to fail if the "start"
is called when the process is already running.

This commit fixes the typos.

Change-Id: If46f03a5d042f949db9359d6ddd7f69790ccaf4f
Closes-Bug: 1827326
Signed-off-by: Don Penney <don.penney@windriver.com>
2019-05-03 14:48:20 -04:00
Don Penney 0b5dcff8c6 Add hooks for python wheel generation
This update adds hooks to the spec files for the following packages
to generate wheels for the python modules:
- cgcs-patch
- patch-alarm
- requests-toolbelt
- tsconfig

Change-Id: Ibdae0a338a1af493ac522757b61bbd6df1da941e
Story: 2003907
Task: 27529
Signed-off-by: Don Penney <don.penney@windriver.com>
2018-10-24 17:13:19 +00:00
Sun Austin bae8691911 Fix pep8/flake8 Error
Fix below errors
    E128 continuation line under-indented for visual indent
    E305 expected 2 blank lines after class or function definition, found 1
    E502 the backslash is redundant between brackets
    E722 do not use bare except'
    E741 ambiguous variable name 'xxxxx'
    E999 SyntaxError: invalid token

Change-Id: Ic826a70aed2cda984cbafedae154c4812bfa37b5
Story: 2003429
Task: 24624
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-09-12 08:40:21 +08:00
chenyan 201b94d89f Fix dict related issues for Python 2/3 compatible code.
Story: 2003429
Task: 24621

Change-Id: I71d9aa429abf8abef9b70e84e7437223a1b6719a
Signed-off-by: chenyan <yan.chen@intel.com>
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-09-07 10:49:15 +08:00
Don Penney 2885d09ed2 Add pylint support
This update adds pylint to tox and zuul for stx-updates and resolves
most warnings and errors, with some disabled for future resolution.

Change-Id: Ic853202e4793bf89d687b50cbd740d364db85189
Story: 2003371
Task: 24832
Signed-off-by: Don Penney <don.penney@windriver.com>
2018-08-24 09:19:44 -05:00
Don Penney ae0314279f Resolve bashate and pep8 warnings
This update addresses existing bashate and pep8 warnings in
cgcs-patch, patch-alarm, and tsconfig. The bulk of these updates
are style and spacing changes, such as whitespace style conventions.

Story: 2003371
Task: 24433

Change-Id: I44b26d24788907bac0730a952d70ed4bafb87d90
Signed-off-by: Don Penney <don.penney@windriver.com>
2018-08-08 19:36:58 -05:00
Dean Troyer 527e098821 StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:37:12 -07:00