From 08ecf23b1b23f44cc70dfd3eb13be2de40deaa2e Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 12 Jan 2017 10:14:27 +0000 Subject: [PATCH] =?UTF-8?q?#718:=20OGAgent=20soporta=20ejecutar=20script?= =?UTF-8?q?=20en=20sesi=C3=B3n=20de=20usuario=20y=20peque=C3=B1os=20cambio?= =?UTF-8?q?s=20de=20informaci=C3=B3n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5145 a21b9725-9963-47de-94b9-378ad31fedc9 --- linux/debian/changelog | 12 ++++++------ linux/debian/control | 2 +- linux/debian/copyright | 2 +- .../modules/client/OpenGnSys/__init__.py | 15 +++++++++------ .../modules/server/OpenGnSys/__init__.py | 11 ++--------- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/linux/debian/changelog b/linux/debian/changelog index 30efe00..01fd564 100644 --- a/linux/debian/changelog +++ b/linux/debian/changelog @@ -1,12 +1,12 @@ -ogagent (1.0.0) stable; urgency=medium - - * Initial release for OpenGnsys Agent - - -- Adolfo Gómez García Tue, 18 Jul 2015 03:18:22 +0200 - ogagent (1.1.0) stable; urgency=medium * Functional OpenGnsys Agent interacting with OpenGnsys Server 1.1.0 -- Ramón M. Gómez Tue, 13 Oct 2016 17:00:00 +0200 +ogagent (1.0.0) stable; urgency=medium + + * Initial release for OpenGnsys Agent + + -- Adolfo Gómez García Tue, 18 Jul 2015 03:18:22 +0200 + diff --git a/linux/debian/control b/linux/debian/control index e89e8da..b5b75a0 100644 --- a/linux/debian/control +++ b/linux/debian/control @@ -1,7 +1,7 @@ Source: ogagent Section: admin Priority: optional -Maintainer: Adolfo Gómez García +Maintainer: Ramón M. Gómez Build-Depends: debhelper (>= 7), po-debconf Standards-Version: 3.9.2 Homepage: http://www.opengnsys.es diff --git a/linux/debian/copyright b/linux/debian/copyright index 8e5ceac..1884144 100644 --- a/linux/debian/copyright +++ b/linux/debian/copyright @@ -1,6 +1,6 @@ Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 Name: ogagent -Maintainer: Adolfo Gómez García +Maintainer: Ramón M. Gómez Source: http://opengnsys.es Copyright: 2014 Virtual Cable S.L.U. diff --git a/src/opengnsys/modules/client/OpenGnSys/__init__.py b/src/opengnsys/modules/client/OpenGnSys/__init__.py index 6e287be..27e94db 100644 --- a/src/opengnsys/modules/client/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/client/OpenGnSys/__init__.py @@ -26,7 +26,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' -@author: Adolfo Gómez, dkmaster at dkmon dot com +@author: Ramón M. Gómez, ramongomez at us dot es ''' from __future__ import unicode_literals @@ -34,6 +34,7 @@ from opengnsys.workers import ClientWorker from opengnsys import operations from opengnsys.log import logger +from opengnsys.scriptThread import ScriptExecutorThread class OpenGnSysWorker(ClientWorker): name = 'opengnsys' @@ -44,12 +45,14 @@ class OpenGnSysWorker(ClientWorker): def onDeactivation(self): logger.debug('Deactivate invoked') - # Processes message "doit" (sample) - def process_doit(self, jsonParams): - logger.debug('Processed message doit with params {}'.format(jsonParams)) - self.sendServerMessage('doit', {'data':1}) + # Processes script execution + def process_script(self, jsonParams): + logger.debug('Processed message: script({})'.format(jsonParams)) + thr = ScriptExecutorThread(jsonParams['code']) + thr.start() + #self.sendServerMessage({'op', 'launched'}) def process_logoff(self, jsonParams): - logger.debug('Processed logoff message with params {}'.format(jsonParams)) + logger.debug('Processed message: logoff({})'.format(jsonParams)) operations.logoff() diff --git a/src/opengnsys/modules/server/OpenGnSys/__init__.py b/src/opengnsys/modules/server/OpenGnSys/__init__.py index c15db96..8a72a03 100644 --- a/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -26,7 +26,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' -@author: Ramón M. Gómez, ramongomez at us dot es +@author: Ramón M. Gómez, ramongomez at us dot es ''' from __future__ import unicode_literals @@ -101,13 +101,6 @@ class OpenGnSysWorker(ServerWorker): logger.debug('onDeactivation') self.REST.sendMessage('ogagent/stopped', {'mac': self.interface.mac, 'ip': self.interface.ip, 'ostype': operations.osType, 'osversion': operations.osVersion}) - # Processes message "doit" (sample) - #def process_doit(self, path, getParams, postParams): - # # Send a sample message to client - # logger.debug('Processing doit') - # self.sendClientMessage('doit', {'param1': 'test', 'param2': 'test2'}) - # return 'Processed message for {}, {}, {}'.format(path, getParams, postParams) - def processClientMessage(self, message, data): logger.debug('Got OpenGnsys message from client: {}, data {}'.format(message, data)) @@ -218,7 +211,7 @@ class OpenGnSysWorker(ServerWorker): thr = ScriptExecutorThread(script) thr.start() else: - self.sendScriptMessage(script) + self.sendClientMessage('script', {'code': script}) return {'op': 'launched'} def process_logoff(self, path, getParams, postParams, server):