Commit Graph

1660 Commits

Author SHA1 Message Date
LiZekun 29be6e96a6 Update python testing classifier
Yoga testing runtime[1] has been updated to add py39
testing as voting. Unit tests update are handled by the
job template change in openstack-zuul-job

- https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/820286

this commit updates the classifier in setup.cfg file.

[1] https://governance.openstack.org/tc/reference/runtimes/yoga.html

Change-Id: Idb98e3b64528bb5ad12e7292bfb18c159585f87b
2022-04-04 09:20:29 +00:00
Zuul 9ac8a8e930 Merge "Use TOX_CONSTRAINTS_FILE" 2022-03-15 11:00:23 +00:00
OpenStack Release Bot f26337fc04 Add Python3 zed unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for zed.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Idbde83566af37d8c35d71e280a385a16bc9f8843
2022-03-10 17:06:22 +00:00
LiZekun fa8888abf7 Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

Change-Id: Ic64ec2e5b6562de7ea901d62aab446c661d675e8
2022-03-02 11:49:53 +00:00
Jan Zerebecki dbb766218e Remove JMSAppender.class to avoid CVE-2021-4104,
CVE-2022-23302, CVE-2022-23305, and CVE-2022-23307.

Though it does not contain a vulnerable configuration of log4j, to avoid
needing to prove that and false positives of security scanners, this
commit is the result of running the following commands:

zip -q -d monasca_agent/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar org/apache/logging/log4j/core/lookup/JndiLookup.class org/apache/log4j/net/JMSAppender.class org/apache/log4j/jdbc/JDBCAppender.class org/apache/log4j/net/JMSSink.class org/apache/log4j/chainsaw"*"
unzip monasca_agent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar WORLDS-INF/lib/log4j.jar
zip -q -d WORLDS-INF/lib/log4j.jar org/apache/logging/log4j/core/lookup/JndiLookup.class org/apache/log4j/net/JMSAppender.class org/apache/log4j/jdbc/JDBCAppender.class org/apache/log4j/net/JMSSink.class org/apache/log4j/chainsaw"*"
zip monasca_agent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar WORLDS-INF/lib/log4j.jar

Change-Id: Id47ba9397e7fef1ac8622abb2a1691a260f4bc9c
2022-01-27 09:05:15 +00:00
Martin Chacon Piza 052ab23048 Remove py2-psutil from apk
The lib psutil in monasca-agent collector image is installed by
pip. An extra installation by apk isn't needed.

Change-Id: I580bdb01479522e7243bf3d2ace757edb2eff6db
2022-01-26 19:52:07 +01:00
jayonlau 8c8a85a1d8 Clean up extra spaces
Although these errors are not important, they affect the code specification.

Change-Id: I906cf1ad1530de750c71cd622317d849347786ca
2021-09-26 22:52:47 -04:00
root a8be13bdeb Add a condition for systemd service detection in monasca_setup
Skip agent service detection if only installing plugins.
This will make it possible to use monasca-setup on the environments
 where monasca-agent is not running as systemd service.
Typical usecase is running agent on kubernetes.

Change-Id: I232506e19f593b43cc011c6499242847c9bbc108
2021-09-20 21:06:27 +02:00
OpenStack Release Bot d30e12fde8 Add Python3 yoga unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for yoga.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I2931acfa82af41b63d2e9a0e7a257a983cbeb707
2021-09-16 07:59:13 +00:00
Zuul 170afab952 Merge "Revert "Replace fnmatch with oslo.utils.fnmatch"" 2021-07-13 13:22:13 +00:00
Takashi Kajinami ad45a1bb77 Revert "Replace fnmatch with oslo.utils.fnmatch"
This reverts commit 9ff337881b.

Reason for revert:
The oslo_utils.fnmatch module was added to solve an issue in py2.7 but
it is no longer required because py2.7 is no longer supported.
The module was deprecated since oslo.utils 4.9.1[1] and the stdlib's
fnmatch module should be used instead.

[1] 4c893c92f551c9dd2a7cfbe7ae8171ad8139df0b

Change-Id: I84c0d2b2705e34b9853d42d03a398ecbe4f95330
2021-07-06 12:25:27 +00:00
kpdev f6d1170b9b vmware: Use oslo.vmware's get_moref_value()
With switching the SOAP library backing oslo.vmware [1], the internal
representation of ManagedObjectReference's attributes changes. To be able
to make the switch without interruption, we introduced helper functions
in oslo.vmware. This commit uses one of those - get_moref_value()
- to make the access to the "value" attribute compatible with both
backing libraries.

[1] https://specs.openstack.org/openstack/oslo-specs/specs/victoria/oslo-vmware-soap-library-switch.html

Change-Id: I50f0aa5d8865323515d15d1c1c5f10683bbac090
2021-06-15 15:14:44 +00:00
Martin Chacon Piza ead3e8d90b Fix Monasca-Setup Keystone detection
- In RHOSP16.1 (TripleO based) the Keystone process name is
`keystone`. In previous RHOSP10 the process name was
`keystone-admin` and `keystone-main`.

Change-Id: I58882af66979f324cb372696febda65a33eb81b6
2021-06-13 18:50:37 +02:00
Martin Chacon Piza 679f09a3a8 Fix PY3 issue
- In PY3 the output of subprocess.Popen is a type bytes, but
strip() method requires a type str.

Story: 2008017
Task: 40669

Change-Id: I297c30044df9a94baa645a1a27de10bb49038440
2021-06-10 16:25:06 +02:00
Pierre Riteau 478a438654 Fix typo in log message
Change-Id: I4d6801b2d162b2acd00d0cf07aee109ebe652718
2021-06-09 09:49:31 +00:00
Pierre Riteau 7d21e505e8 Fix Docker builds
The default nodeset was just changed to focal [1], which in the absence
of the python-is-python3 package doesn't provide a python binary.

[1] https://review.opendev.org/c/opendev/base-jobs/+/789098

Change-Id: I70984db7af7ce5f7028077db4debcd2cd9bd7c45
2021-05-20 17:11:37 +02:00
OpenStack Release Bot cefab7f3e8 Add Python3 xena unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for xena.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I18b3489f9b40eeda11dc57381d2ab1d84912b2fd
2021-03-26 10:55:39 +00:00
Zuul bc03bc9875 Merge "Remove incorrect plugins configuration for docker image." 2021-03-24 17:07:20 +00:00
Adrian Czarnecki d702f9c2e0 Remove incorrect plugins configuration for docker image.
These plugins are not working with docker image because of docker architecture, 
this kind of metrics are collected by cadvisor plugin. 

Change-Id: I67c47ddfc26a30f6e48bcf4102c750812970be97
2021-03-24 15:25:24 +00:00
Adrian Czarnecki 4047310277 Fix small issue in dokcer plugin.
Change-Id: I7dda293fde999407a1bca7684b2ee777bfc7eddf
2021-03-24 08:12:33 -07:00
Adrian Czarnecki 9fd6d1ffc9 Fix zuul publish docker image job
Change-Id: I7447531d539bced473a6671d5b048eb5130881e4
2021-03-18 09:45:44 -07:00
Zuul abc8f5982e Merge "Use importlib to take place of imp module" 2020-11-23 23:45:21 +00:00
Zuul 132cd5b126 Merge "Replace assertItemsEqual with assertCountEqual" 2020-11-23 23:38:30 +00:00
Zuul 39131405ad Merge "Remove six" 2020-11-13 17:07:14 +00:00
likui c84e98d6b6 Remove six
Replace the following items with Python 3 style code.

- six.PY2
- six.add_metaclass
- six.string_types
- six.text_type
- six.moves
- six.StringIO
- six.wraps
- six.integer_types

Story: 2008305
Task: 41191

Change-Id: I68710421b69d4049c9e990451da491dc14251fb5
2020-11-13 16:16:58 +01:00
Yanos Angelopoulos 085f64578f Set 'libvirt_type' and 'libvirt_uri' options in the 'libvirt' plugin to be defined in conf.d/libvirt.yaml
The 'libvirt_type' and 'libvirt_uri' options are currently set by oslo configuration library.
However, in 'monasca_agent/collector/virt/libvirt/inspector.py' file these options cannot be
provided by a configuration file. Changing this to retrieve both options from
'conf.d/libvirt.yaml' file.

Change-Id: I1918fda471e951f42db0d302e371108b664e936c
2020-11-11 02:40:33 +02:00
likui 38c6f3af51 Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: I1b269b5c06a99e8f62f7c5a33b2314de06389041
2020-11-10 14:48:15 +08:00
Zuul b7179b7dc2 Merge "bump py37 to py38 in tox.ini" 2020-11-02 14:51:47 +00:00
Zuul 089b176fd2 Merge "bump py37 to py38 in tox.ini" 2020-11-02 11:02:17 +00:00
Zuul b6996a9f95 Merge "Add Python3 wallaby unit tests" 2020-10-14 08:56:57 +00:00
likui a58ef361ac bump py37 to py38 in tox.ini
in 'victoria' cycle, we should test py38 by default.

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html

Change-Id: Iec7a658061c30f9e445ba27bfab584c93d0355bd
2020-10-14 09:13:04 +08:00
jiasirui 2845584998 add py38 metedata
Change-Id: I9b7626d05b15e2f17304de0c917eea655cf5d047
2020-10-13 14:29:36 +00:00
OpenStack Release Bot a4fc86338d Add Python3 wallaby unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for wallaby.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I4138e42d6d76a8fc22513ff797ba6cd22ee4556a
2020-10-12 13:56:12 +00:00
zhangchun 6eefefffdc bump py37 to py38 in tox.ini
in 'victoria' cycle, we should test py38 by default.

Trivial change

Change-Id: I224a54caa9c73634dd94f05d4a4969f52a9725cb
2020-10-10 20:16:21 +00:00
Martin Chacon Piza 2ebd1a0755 Adding python3-libvirt for Ubuntu-focal
Fix No package matching 'python-libvirt' is available in Ubuntu-focal

Change-Id: Iedeec778348f566a8b6bddbaaaa6d57133ebb059
2020-10-09 15:24:31 +02:00
wangzihao b1db20006f Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: I7ea008e1d1b83b9ad264b6846de8ab16780c9528
2020-09-18 18:21:48 +08:00
gugug 8bf8c8b006 Use importlib to take place of imp module
The imp module is deprecated[1] since version 3.4, use importlib to
instead

[1]: https://docs.python.org/3/library/imp.html

Change-Id: I10f2c8c165aebddc8fd39601a0a23231ff89cdf7
2020-08-30 23:10:04 +08:00
bandorf e021416e60 Update API version of monitored Cinder
When checking response of Cinder API, a pattern match is done.
As of now, it is checked if "version 1" is installed.
This version is not supported any longer since Cinder train release, as mentioned in release notes:
https://docs.openstack.org/releasenotes/python-cinderclient/train.html
Now, http_check of monasca-agent accepts all known API versions: 1-3

Change-Id: I22b32bcc49760a2da38310aed8e04e44f691a974
Story: 2008021
Task: 40673
2020-08-17 16:05:25 +02:00
bandorf caffc7fbcf Avoid single quote in help text
Single quote in help text caused issues on Red Hat.
In order to avoid issues on any platform,
single quote (') has been removed.

Change-Id: Iccab9a225539a1d87a6ad6bfd873a65d36b8a515
Story:2007978
Task: 40601
2020-08-10 17:17:29 +02:00
bandorf 79dd8cad21 Convert byte-stream to 'utf-8'
Change-Id: Id0a2140ceca38e3baf0de9d28d392e6b8929d26a
Story: 2007977
Task: 40599
2020-08-10 12:28:09 +00:00
Martin Chacon Piza d3cc8c1e7d Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Change-Id: Ia3f2c8abc87cf5551d3469d616790e8e9d567bce
2020-08-10 13:41:08 +02:00
jiasirui 3d0f3e2435 Start README.rst with a better title
Change-Id: I004b73ee79b88c426d6dc3e5a967d4b5ef5f5e37
2020-06-16 15:39:04 +08:00
Zuul 84001abf30 Merge "Stop to use the __future__ module." 2020-06-04 12:44:49 +00:00
Hervé Beraud 0d16b32190 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I2471123ec7f3ea0b872f5054d6160bcd88a104b0
2020-06-04 13:05:21 +02:00
Doug Szumski 5af9c5a485 Remove dependency on local hostname
The json_plugin tests read the localhost name in a different way
to how the hostname is fetched in the Monasca Agent check. This can
cause these tests to fail since the hostnames may differ. For example,
only one may contain .home as a suffix. In this change we avoid reading
the hostname from the system running the tests.

Story: 2007743
Task: 39921
Change-Id: Ifddba6aa9350f722a741a28a152ed9bc3e0b7da6
2020-06-01 10:43:47 +01:00
Zuul 7c087801c9 Merge "Add Python3 victoria unit tests" 2020-05-28 13:05:15 +00:00
Zuul 183e1bab8b Merge "Improve error handling in method that creates Monasca client" 2020-05-28 12:52:20 +00:00
Zuul e23bcb1fbc Merge "Remove .testr.conf" 2020-05-27 08:59:46 +00:00
Adrian Czarnecki a44befb061 Improve error handling in method that creates Monasca client
Add error handler that prevent crash of forwarded
when agent is not able to connect to keystone

Story: 2007674
Task: 39781
Change-Id: If6366e5b94f9cbe3f21ce9dbeb26d28e3a36ae88
2020-05-26 16:19:48 -07:00
Doug Szumski a2400fcf12 Fix parsing of StatsD metrics with Py3
When running with Py3 we compare a byte string to a unicode string
when parsing StatsD metrics. This patch adds some unit tests to
reproduce the bug and decodes the bytestring to make the existing
comparisons valid under Py3. When backporting to Train we can use
Oslo encodeutils. Clearly we could have more unit tests, but
this makes a start.

Change-Id: I6341f96f5c186428d2d829cabf618a6f84f40ce2
Story: 2007684
Task: 39796
2020-05-22 21:08:28 +01:00