mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Replace msignals.display by logging in monitor.py
This commit is contained in:
parent
b265a08391
commit
173d32134e
1 changed files with 6 additions and 4 deletions
|
@ -38,8 +38,10 @@ import cPickle as pickle
|
||||||
from urllib import urlopen
|
from urllib import urlopen
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
||||||
from moulinette.core import MoulinetteError
|
from moulinette.core import MoulinetteError
|
||||||
|
from moulinette.utils.log import getActionLogger
|
||||||
|
|
||||||
|
logger = getActionLogger('yunohost.monitor')
|
||||||
|
|
||||||
glances_uri = 'http://127.0.0.1:61209'
|
glances_uri = 'http://127.0.0.1:61209'
|
||||||
stats_path = '/var/lib/yunohost/stats'
|
stats_path = '/var/lib/yunohost/stats'
|
||||||
|
@ -419,7 +421,7 @@ def monitor_enable(no_stats=False):
|
||||||
os.system("touch %s" % crontab_path)
|
os.system("touch %s" % crontab_path)
|
||||||
os.system("echo '%s' >%s" % (rules, crontab_path))
|
os.system("echo '%s' >%s" % (rules, crontab_path))
|
||||||
|
|
||||||
msignals.display(m18n.n('monitor_enabled'), 'success')
|
logger.success(m18n.n('monitor_enabled'))
|
||||||
|
|
||||||
|
|
||||||
def monitor_disable():
|
def monitor_disable():
|
||||||
|
@ -437,7 +439,7 @@ def monitor_disable():
|
||||||
try:
|
try:
|
||||||
service_disable('glances')
|
service_disable('glances')
|
||||||
except MoulinetteError as e:
|
except MoulinetteError as e:
|
||||||
msignals.display(e.strerror, 'warning')
|
logger.warning(e.strerror)
|
||||||
|
|
||||||
# Remove crontab
|
# Remove crontab
|
||||||
try:
|
try:
|
||||||
|
@ -445,7 +447,7 @@ def monitor_disable():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
msignals.display(m18n.n('monitor_disabled'), 'success')
|
logger.success(m18n.n('monitor_disabled'))
|
||||||
|
|
||||||
|
|
||||||
def _get_glances_api():
|
def _get_glances_api():
|
||||||
|
|
Loading…
Add table
Reference in a new issue