yaml.load will report a warning in pyyaml 5 and an error
in pyyaml 6 if it is called without a Loader argument.
The no-member pylint error was being suppressed due to
legacy http code, so now that is un-suppressed globally
and the yaml.load is replaced with yaml.safe_load
Test Plan:
PASS: tox
PASS: yaml.load('events.yaml') returns the same content
as yaml.safe_load('events.yaml')
Story: 2010642
Task: 48157
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: Ibac118cd9555f3334251b10a6b3e0a5986285854
This commit complements the previous commit with
same topic:
https://review.opendev.org/c/starlingx/fault/+/815381
This particular commit improves the log inside the
python script, considering others possible fails.
Also, some verifications are added in fmDbUtils class
wich calls the script.
Test Plan:
Log in (/var/log/platform.log):
PASS: Log arguments error calling script.
PASS: Log new database connection problems.
PASS: Log Session commit problems.
PASS: Log problems opening "/etc/fm/events.yaml" file.
Log (in /var/log/fm-manager.log):
PASS: Log Problems opening fm_db_sync_event_suppression.py file.
PASS: Log problems running fm_db_sync_event_suppression.py.
PASS: build and install package.
Closes-bug: 1932324
Signed-off-by: fperez <fabrizio.perez@windriver.com>
Change-Id: I913d6d1282bea346f87f73179f0738c0c17d7446
This commit changes the log when FmManager
calls fm_db_sync_event_suppression.py python script.
The logInfo function is not used anymore to write
on /var/log/platform.log. Instead, fm_log.py is used.
This solves the permissions issues between the python
script and platform.log
Besides, others possible fails are logged.
Test Plan:
PASS: Log on platform.log from the python script.
PASS: Log differents log levels.
PASS: Log arguments error.
PASS: Log database connection problems.
PASS: build and install rpm package
Closes-bug: 1932324
Signed-off-by: fperez <fabrizio.perez@windriver.com>
Change-Id: I07c6340e7e9b61fc0f8f8d62e5d5cd7565f265cd
1. change python2 rpms to python3 version.
2. update Cpython code to use new API in python3
Test:
Could pass rpm package build for fm-common
Story: 2007065
Task: 37942
Change-Id: Ie0490118bcc891c2e994b3eeb6efab24ac7951cb
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit a2af71b867)
Fixed a typo for accessing a configuration resource.
Fixed a python3 script called by fmManager on initialization. It was
modifying a dictionary while parsing it using an iterator, which doesn't
guarantee all initial elements are visited. The fm database
event_suppression table was left in a bad state, thus alarm list and
alarm summary were empty.
Tests:
- build and deploy from iso
- tested with the fm_api_test.py provided in the repo
- tested some of the commands by raising a config out of date and
targeting the raised alarm
- fm alarm-list, alarm-delete, alarm-show, alarm-summary, event-list,
event-show, event-suppress-list, event-suppress, event-unsuppress,
event-unsuppress-all produce relevant output
Story: 2008454
Task: 42632
Depends-On: I2d0f4c2c85ea8057258d56632a102b2eac7db388
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: Ib3d5276c4a669a3f3f123470c31edf7a07751eaa
(cherry picked from commit c18a7865c6)
The dependency resolver for RPM relies on the shebang to have the
interperter that will be used in order to get things right, so
change shebang to /usr/bin/python.
In other cases, the shebang is not needed at all as these are not
really executable python files, they are part of the python package.
RPMLINT finds these and complains that a non-executable has a shebang.
Change-Id: Ie90a846d6addffca1225e59fd8b6f3753d2991a4
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Create fault management REST API service
Create fault management client and CLI shell
Add a python extension for fault management application APIs
Update fault management python APIs to use the python extension
Update fault manager to retrieve the SNMP configuration from the config file
Story: 2002828
Task: 22747
Depends-On: https://review.openstack.org/#/c/592176/
Change-Id: I888d8d23edf75d05d51594ccca55570ae366c848
Signed-off-by: Tao Liu <tao.liu@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>
In Python 3 print is a function.
Especially for multiple string print, need to import
print_function from __future__.
Story: 2003310
Task: 24265
Change-Id: I1e8f80527f9ba97093a8e753f3460110e160d1b9
Signed-off-by: chenyan <yan.chen@intel.com>
The built-in named 'file' has been removed since Python 3.0 [1]
This patch replaces it by 'open' which is the same under Python 2 and 3.
[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins
Change-Id: Ib2abbd0f6aea4423acae0c7dceccf1ef67c1caae
Doing filesystem resizes is blocked when a node is degraded and
going over 90% filesystem utilization degrades the node.
This prevents the user from clearing the alarm by resizing and
adding more space to a certain filesystem.
To fix this, we check add a new field to every alarm marking
which alarm causes a degrade.
In case of a filesystem resize, we poll all alarms and filter
them for those that are causing a degrade. If the only alarm
that causes a degrade is the filesystem usage alarm, then
it is safe to proceed with the resize.
Change-Id: I9b4a9c34f625ef2669725d489460b15e637c1efc
Signed-off-by: Jack Ding <jack.ding@windriver.com>