[MIG] nsca_client: Migration to 16.0

pull/2922/head
Luis Rodriguez 2024-04-24 13:25:56 +02:00
parent 7cecd3c6cf
commit 62f1b2b207
4 changed files with 23 additions and 23 deletions

View File

@ -7,7 +7,7 @@ NSCA Client
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:47fbb5fab8a9f77d36ec3e4b1006bf5742914bc05c9c94da0e341655d2b06fbb
!! source digest: sha256:04a3c96ea4630fd8abd0b531436b95c8eb4ab07c3c8efcee9a5f5343c2477d36
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@ -17,13 +17,13 @@ NSCA Client
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/14.0/nsca_client
:target: https://github.com/OCA/server-tools/tree/16.0/nsca_client
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-nsca_client
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-nsca_client
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -57,12 +57,12 @@ To configure this module, you need to:
* Declare your NSCA server in the menu Configuration / Technical / NSCA Client / Servers
.. image:: https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/server.png
.. image:: https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/server.png
:width: 400 px
* Create NSCA checks in the menu Configuration / Technical / NSCA Client / Checks
.. image:: https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/check.png
.. image:: https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/check.png
:width: 400 px
* Code the methods which will be called by the NSCA checks.
@ -113,7 +113,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20nsca_client%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20nsca_client%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -145,6 +145,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/14.0/nsca_client>`_ project on GitHub.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/nsca_client>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -3,7 +3,7 @@
{
"name": "NSCA Client",
"summary": "Send passive alerts to monitor your Odoo application.",
"version": "14.0.1.0.2",
"version": "16.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
"author": "ABF OSIELL, Odoo Community Association (OCA)",

View File

@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:47fbb5fab8a9f77d36ec3e4b1006bf5742914bc05c9c94da0e341655d2b06fbb
!! source digest: sha256:04a3c96ea4630fd8abd0b531436b95c8eb4ab07c3c8efcee9a5f5343c2477d36
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/14.0/nsca_client"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-nsca_client"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/nsca_client"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-nsca_client"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This is a technical module to send passive alerts to your favorite NSCA daemon
(Nagios, Shinken…).
This module is based on the Odoo cron system and requires a NSCA client
@ -404,11 +404,11 @@ $ sudo apt-get install nsca-client
(e.g service <tt class="docutils literal">Odoo Mail Queue</tt> on host <tt class="docutils literal"><span class="pre">MY-SERVER</span></tt>).</li>
<li>Declare your NSCA server in the menu Configuration / Technical / NSCA Client / Servers</li>
</ul>
<img alt="https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/server.png" src="https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/server.png" style="width: 400px;" />
<img alt="https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/server.png" src="https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/server.png" style="width: 400px;" />
<ul class="simple">
<li>Create NSCA checks in the menu Configuration / Technical / NSCA Client / Checks</li>
</ul>
<img alt="https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/check.png" src="https://raw.githubusercontent.com/OCA/server-tools/14.0/nsca_client/nsca_client/static/description/check.png" style="width: 400px;" />
<img alt="https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/check.png" src="https://raw.githubusercontent.com/OCA/server-tools/16.0/nsca_client/nsca_client/static/description/check.png" style="width: 400px;" />
<ul class="simple">
<li>Code the methods which will be called by the NSCA checks.</li>
</ul>
@ -454,7 +454,7 @@ value will be the number of exception of mails.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20nsca_client%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20nsca_client%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -480,7 +480,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/14.0/nsca_client">OCA/server-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/nsca_client">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -1,7 +1,7 @@
# Copyright 2018 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import mock
from unittest.mock import patch
from odoo.tests.common import TransactionCase
from odoo.tools import mute_logger
@ -17,8 +17,8 @@ class Popen:
self.stderr = stderr
# flake8: noqa: B902
# def communicate(input):
# return ["test"]
def communicate(_input):
return ["test"]
class TestNsca(TransactionCase):
@ -32,7 +32,7 @@ class TestNsca(TransactionCase):
}
)
self.assertTrue(server.config_file_path)
with mock.patch("subprocess.Popen") as post:
with patch("subprocess.Popen") as post:
post.return_value = Popen
check = self.env["nsca.check"].create(
{
@ -87,7 +87,7 @@ class TestNsca(TransactionCase):
"nsca_function": "_check_send_nsca_command",
}
)
with mock.patch("subprocess.Popen") as post:
with patch("subprocess.Popen") as post:
post.return_value = Popen
with mute_logger("odoo.addons.nsca_client.models.nsca_check"):
self.env["nsca.check"]._cron_check(check.id)
@ -116,7 +116,7 @@ class TestNsca(TransactionCase):
action = server.show_checks()
self.assertEqual(check, self.env["nsca.check"].browse(action["res_id"]))
self.assertEqual(check, self.env["nsca.check"].search(action["domain"]))
with mock.patch("subprocess.Popen") as post:
with patch("subprocess.Popen") as post:
post.return_value = Popen
self.env["nsca.check"]._cron_check(check.id)
post.assert_not_called()
@ -139,9 +139,9 @@ class TestNsca(TransactionCase):
"nsca_function": "_check_send_nsca_command",
}
)
with mock.patch("subprocess.Popen") as post:
with patch("subprocess.Popen") as post:
post.return_value = Popen
with mock.patch.object(NscaServer, "_check_send_nsca_command") as func:
with patch.object(NscaServer, "_check_send_nsca_command") as func:
func.return_value = ("OK", "RESULT")
self.env["nsca.check"]._cron_check(check.id)
func.assert_called()