Commit 88f3de11 authored by Lucas's avatar Lucas
Browse files

SCRUM#534: Add feature to enable/disable epoptes

parent 859e91c8
Pipeline #16368 canceled with stages
in 3 minutes and 53 seconds
......@@ -24,7 +24,7 @@ test:
script:
# TODO: find a way to get the dependencies automatically
- apt-get update && apt-get install -y wget
- echo "deb http://repo.c3sl.ufpr.br/le6/ testing main" > /etc/apt/sources.list.d/le6.list
- echo "deb http://repo.c3sl.ufpr.br/le6/ unstable main" > /etc/apt/sources.list.d/le6.list
- wget -O- http://repo.c3sl.ufpr.br/le6/le.c3sl.ufpr.br.key | apt-key add -
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install $(pwd)/build/*.deb language-pack-gnome-pt language-pack-pt-base
dependencies:
......
le-epoptes (0.1.0) unstable; urgency=medium
* Create le-lab attributes to enable/disable epoptes (Closes: #534)
* debian/control: New uploader
-- Lucas Sulzbach <ls17@c3sl.ufpr.br> Fri, 29 Jun 2018 08:57:10 -0300
le-epoptes (0.0.20) testing; urgency=medium
* Add error message when epoptes can not connect with le-lab
......
......@@ -2,7 +2,7 @@ Source: le-epoptes
Section: admin
Priority: extra
Maintainer: C3SL <contato@c3sl.ufpr.br>
Uploaders: Diego Pasqualin <dpasqualin@c3sl.ufpr.br>, Levi Gomes <lhgs15@inf.ufpr.br>, Rafael Sanfelice Castilho <rsc15@inf.ufpr.br>
Uploaders: Diego Pasqualin <dpasqualin@c3sl.ufpr.br>, Levi Gomes <lhgs15@inf.ufpr.br>, Rafael Sanfelice Castilho <rsc15@inf.ufpr.br>, Lucas Sulzbach <ls17@c3sl.ufpr.br>
Build-Depends: debhelper (>=9), dh-python, dh-systemd (>= 1.5), python (>= 2.6.5), python-distutils-extra (>= 2.4), python-all, python-setuptools, python3-all, python3-dev
Standards-Version: 3.9.7
Vcs-Git: https://gitlab.c3sl.ufpr.br/le6/le-epoptes
......
......@@ -80,6 +80,13 @@ class LEEpoptes(object):
my_server, current_server)
if my_server != current_server:
if self.conn.get_attribute('epoptes', '_status') == 'disabled':
call_error_dialog("O epoptes está desabilitado. Peça para o administrador habilitá-lo no painel de controle.")
else:
if current_server != '':
logging.info("The current server is %s. Changing server to local machine instead.", current_server)
logging.info("Starting server %s", my_server)
......@@ -88,11 +95,10 @@ class LEEpoptes(object):
if self.wait_for_lelab():
self.open_epoptes()
logging.info("Closing server %s", my_server)
self.conn.epoptes_remove()
logging.debug("Server %s closed", my_server)
else:
call_error_dialog("This computer is already registered as an epoptes server.")
......
......@@ -112,7 +112,7 @@ function update_server() {
string = InfoMessage.SERVER_STATUS.DISABLED;
icon.icon_name = LAB_ICON.DISABLED;
} else if (serverStatus == "none"){
} else if (serverStatus == "enabled" || serverStatus == "disabled"){
string = InfoMessage.SERVER_STATUS.DISCONNECTED;
icon.icon_name = LAB_ICON.DISABLED;
......
......@@ -168,7 +168,7 @@ class LEEpoptes_control(object):
if status == 'pre_client':
self.update_server('client',server)
else:
self.update_server('none',"")
self.update_server('enabled',"")
def set_server(self, host, port):
......@@ -177,12 +177,20 @@ class LEEpoptes_control(object):
"""
status = self.conn.epoptes_get_attribute('_status')
server = self.conn.epoptes_get_attribute('_server')
hosts = self.conn.epoptes_get_connected_hosts()
while status == 'disabled' and hosts:
time.sleep(0.5)
status = self.conn.epoptes_get_attribute('_status')
hosts = self.conn.epoptes_get_connected_hosts()
if status == 'server':
self.update_server('pre_client',host)
status = 'pre_client'
else:
self.update_server('client',host)
status = 'client'
if hosts:
self.update_server(status, host)
def unset_server(self, host):
......@@ -204,9 +212,9 @@ class LEEpoptes_control(object):
'''
if host == server:
self.update_server('none',"")
else:
self.update_server('none',"")
self.update_server('enabled',"")
elif status != 'disabled':
self.update_server('enabled',"")
def update_server(self,status,host):
......@@ -221,7 +229,7 @@ class LEEpoptes_control(object):
def update_epoptes(self,status,host):
# Update the active epoptes instances according to the new status
if status == 'none':
if status == 'enabled' or status == 'disabled':
self.disable_client()
self.disable_server()
elif status == 'pre_client':
......
systemd epoptes
_status none
_status disabled
_server
_port 789
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment