Commit c8baf10d authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Merge branch 'issue/556' into 'develop'

SCRUM#556: Update lelab's methods calls to the new syntax

See merge request !29
parents a6bf2ffd 299773fd
Pipeline #16439 passed with stages
in 10 minutes and 8 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 -
- echo "Installation test:"
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install $(pwd)/build/*.deb language-pack-gnome-pt language-pack-pt-base
......
le-epoptes (1.0.0) unstable; urgency=medium
* Update lelab's methods calls to the new syntax (Closes: #556)
* debian/control: Update pre-dependency clause to 'le-lab (>= 1.0.0)'
* debian/postinst: Update lelab's restart call to the new syntax
-- Lucas Sulzbach <lesuporte@c3sl.ufpr.br> Fri, 08 Jun 2018 11:05:53 -0300
le-epoptes (0.1.0) unstable; urgency=medium
* Create le-lab attributes to enable/disable epoptes (Closes: #534)
* debian/control: New uploader
-- Lucas Sulzbach <lesuporte@c3sl.ufpr.br> Fri, 29 Jun 2018 08:57:10 -0300
le-epoptes (0.0.20) unstable; urgency=medium
* Add more testing stages on CI (Closes: #463)
......
......@@ -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
......@@ -13,7 +13,7 @@ Package: le-epoptes
Architecture: all
Depends: ${python3:Depends}, ${misc:Depends}, python3-dbus, epoptes, epoptes-client, gnome-shell-extensions, notify-osd, libnotify-bin
Recommends: le-help
Pre-Depends: le-lab (>= 0.2.0)
Pre-Depends: le-lab (>= 1.0.0)
Description: Automatic set up epoptes in a local network
Epoptes is an open source computer lab management and monitoring tool.
This package installs an implementation based on le-lab that automates the
......
......@@ -60,7 +60,7 @@ if ! test -f /etc/default/version || grep -q "Escola" /etc/default/version; then
fi
# Restart le-lab
le-lab -s restart > /dev/null || true
le-lab --restart > /dev/null || true
if $restart; then
echo "Please restart your session to complete the installation process."
......
......@@ -74,25 +74,31 @@ class LEEpoptes(object):
def run(self):
my_server = self.get_current_server()
current_server = self.conn.epoptes_get_attribute('_server')
current_server = self.conn.get_attribute('epoptes', '_server')
logging.debug("Checking server my_server=%s, current_server=%s",
my_server, current_server)
if my_server != current_server:
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)
self.conn.epoptes_advertise()
if self.wait_for_lelab():
self.open_epoptes()
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)
self.conn.advertise('epoptes')
if self.wait_for_lelab():
self.open_epoptes()
logging.info("Closing server %s", my_server)
self.conn.remove('epoptes')
logging.debug("Server %s closed", my_server)
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.")
......@@ -110,7 +116,7 @@ class LEEpoptes(object):
# Wait for le-lab to register the epoptes service
timeout = 0
while True:
if self.conn.epoptes_get_attribute('_status') == 'server':
if self.conn.get_attribute('epoptes', '_status') == 'server':
break
timeout += 1
......
......@@ -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;
......
......@@ -145,8 +145,8 @@ class LEEpoptes_control(object):
Called when a local epoptes service is detected
"""
status = self.conn.epoptes_get_attribute('_status')
server = self.conn.epoptes_get_attribute('_server')
status = self.conn.get_attribute('epoptes', '_status')
server = self.conn.get_attribute('epoptes', '_server')
if status == 'client':
self.update_server('pre_server',server)
......@@ -162,13 +162,13 @@ class LEEpoptes_control(object):
Called when a local epoptes service disconnects
"""
status = self.conn.epoptes_get_attribute('_status')
server = self.conn.epoptes_get_attribute('_server')
status = self.conn.get_attribute('epoptes', '_status')
server = self.conn.get_attribute('epoptes', '_server')
if status == 'pre_client':
self.update_server('client',server)
else:
self.update_server('none',"")
self.update_server('enabled',"")
def set_server(self, host, port):
......@@ -176,13 +176,21 @@ class LEEpoptes_control(object):
Called when a remote epoptes service is detected
"""
status = self.conn.epoptes_get_attribute('_status')
server = self.conn.epoptes_get_attribute('_server')
status = self.conn.get_attribute('epoptes', '_status')
hosts = self.conn.get_connected_hosts('epoptes')
while status == 'disabled' and hosts:
time.sleep(0.5)
status = self.conn.get_attribute('epoptes', '_status')
hosts = self.conn.get_connected_hosts('epoptes')
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):
......@@ -190,8 +198,8 @@ class LEEpoptes_control(object):
Called when a remote epoptes service disconnects
"""
status = self.conn.epoptes_get_attribute('_status')
server = self.conn.epoptes_get_attribute('_server')
status = self.conn.get_attribute('epoptes', '_status')
server = self.conn.get_attribute('epoptes', '_server')
if status == 'pre_server':
self.update_server('server',socket.gethostname()+".local")
......@@ -204,24 +212,24 @@ 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):
logging.info("epoptes updating machine status to %s,%s", status, host)
self.update_epoptes(status,host)
self.conn.epoptes_set_attribute('_status', status)
self.conn.epoptes_set_attribute('_server', host)
self.conn.set_attribute('epoptes', '_status', status)
self.conn.set_attribute('epoptes', '_server', host)
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