mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] imports at the beginning of the file
This commit is contained in:
parent
43217c6fb2
commit
17ca60c3a5
1 changed files with 3 additions and 8 deletions
|
@ -41,6 +41,9 @@ from moulinette.core import MoulinetteError
|
||||||
from moulinette.utils.log import getActionLogger
|
from moulinette.utils.log import getActionLogger
|
||||||
|
|
||||||
from yunohost.domain import get_public_ip
|
from yunohost.domain import get_public_ip
|
||||||
|
from yunohost.service import (service_status, service_enable,
|
||||||
|
service_start, service_disable, service_stop)
|
||||||
|
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.monitor')
|
logger = getActionLogger('yunohost.monitor')
|
||||||
|
|
||||||
|
@ -406,9 +409,6 @@ def monitor_enable(no_stats=False):
|
||||||
no_stats -- Disable monitoring statistics
|
no_stats -- Disable monitoring statistics
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.service import (service_status, service_enable,
|
|
||||||
service_start)
|
|
||||||
|
|
||||||
glances = service_status('glances')
|
glances = service_status('glances')
|
||||||
if glances['status'] != 'running':
|
if glances['status'] != 'running':
|
||||||
service_start('glances')
|
service_start('glances')
|
||||||
|
@ -433,9 +433,6 @@ def monitor_disable():
|
||||||
Disable server monitoring
|
Disable server monitoring
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.service import (service_status, service_disable,
|
|
||||||
service_stop)
|
|
||||||
|
|
||||||
glances = service_status('glances')
|
glances = service_status('glances')
|
||||||
if glances['status'] != 'inactive':
|
if glances['status'] != 'inactive':
|
||||||
service_stop('glances')
|
service_stop('glances')
|
||||||
|
@ -467,8 +464,6 @@ def _get_glances_api():
|
||||||
else:
|
else:
|
||||||
return p
|
return p
|
||||||
|
|
||||||
from yunohost.service import service_status
|
|
||||||
|
|
||||||
if service_status('glances')['status'] != 'running':
|
if service_status('glances')['status'] != 'running':
|
||||||
raise MoulinetteError(errno.EPERM, m18n.n('monitor_not_enabled'))
|
raise MoulinetteError(errno.EPERM, m18n.n('monitor_not_enabled'))
|
||||||
raise MoulinetteError(errno.EIO, m18n.n('monitor_glances_con_failed'))
|
raise MoulinetteError(errno.EIO, m18n.n('monitor_glances_con_failed'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue