Browse Source

Add demo system parameter and some fixes to README. Fix #314.

pull/316/head
Jairo Llopis 9 years ago
parent
commit
dff561a51b
  1. 11
      dead_mans_switch_client/README.rst
  2. 5
      dead_mans_switch_client/__openerp__.py
  3. 5
      dead_mans_switch_client/demo/dead_mans_switch_client_demo.yml
  4. 17
      dead_mans_switch_client/models/dead_mans_switch_client.py

11
dead_mans_switch_client/README.rst

@ -13,15 +13,15 @@ Configuration
=============
After installing this module, you need to fill in the system parameter
`dead_mans_switch_client.url`. This must be the full URL to the server's
controller, usually of the form https://your.server/dead_mans_switch/alive
``dead_mans_switch_client.url``. This must be the full URL to the server's
controller, usually of the form ``https://your.server/dead_mans_switch/alive``.
This module attempts to send CPU and RAM statistics to the server. While this
is not mandatory, it's helpful for assessing a server's health. If you want
this, you need to install `psutil`.
this, you need to install ``psutil``.
You can also have the currently online users logged, but this only works if
the `im_chat` module is installed.
the ``im_chat`` module is installed.
Usage
=====
@ -56,6 +56,7 @@ Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Jairo Llopis <yajo.sk8@gmail.com>
Maintainer
----------
@ -70,4 +71,4 @@ 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.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

5
dead_mans_switch_client/__openerp__.py

@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Dead man's switch (client)",
"version": "8.0.1.0.0",
"version": "8.0.1.0.1",
"author": "Therp BV,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Monitoring",
@ -15,4 +15,7 @@
"data/ir_actions.xml",
"data/ir_cron.xml",
],
"demo": [
"demo/dead_mans_switch_client_demo.yml",
],
}

5
dead_mans_switch_client/demo/dead_mans_switch_client_demo.yml

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- !function {model: dead.mans.switch.client, name: _install_default_url}

17
dead_mans_switch_client/models/dead_mans_switch_client.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
import logging
@ -66,3 +67,19 @@ class DeadMansSwitchClient(models.AbstractModel):
{
'Content-Type': 'application/json',
}))
@api.model
def _install_default_url(self):
"""Set up a default URL."""
conf = self.env["ir.config_parameter"]
name = "dead_mans_switch_client.url"
param = conf.get_param(name)
if not param:
url = "{}/dead_mans_switch/alive".format(
conf.get_param(
"report.url",
conf.get_param(
"web.base.url",
"http://localhost")))
conf.set_param(name, url)
Loading…
Cancel
Save