#718: OGAgent soporta ejecutar script en sesión de usuario y pequeños cambios de información.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5145 a21b9725-9963-47de-94b9-378ad31fedc9
oglive
ramon 2017-01-12 10:14:27 +00:00
parent 937c21f7a0
commit 08ecf23b1b
5 changed files with 19 additions and 23 deletions

View File

@ -1,12 +1,12 @@
ogagent (1.0.0) stable; urgency=medium
* Initial release for OpenGnsys Agent
-- Adolfo Gómez García <agomez@virtualcable.es> Tue, 18 Jul 2015 03:18:22 +0200
ogagent (1.1.0) stable; urgency=medium ogagent (1.1.0) stable; urgency=medium
* Functional OpenGnsys Agent interacting with OpenGnsys Server 1.1.0 * Functional OpenGnsys Agent interacting with OpenGnsys Server 1.1.0
-- Ramón M. Gómez <ramongomez@us.es> Tue, 13 Oct 2016 17:00:00 +0200 -- Ramón M. Gómez <ramongomez@us.es> 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 <agomez@virtualcable.es> Tue, 18 Jul 2015 03:18:22 +0200

View File

@ -1,7 +1,7 @@
Source: ogagent Source: ogagent
Section: admin Section: admin
Priority: optional Priority: optional
Maintainer: Adolfo Gómez García <agomez@virtualcable.es> Maintainer: Ramón M. Gómez <ramongomez@us.es>
Build-Depends: debhelper (>= 7), po-debconf Build-Depends: debhelper (>= 7), po-debconf
Standards-Version: 3.9.2 Standards-Version: 3.9.2
Homepage: http://www.opengnsys.es Homepage: http://www.opengnsys.es

View File

@ -1,6 +1,6 @@
Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
Name: ogagent Name: ogagent
Maintainer: Adolfo Gómez García Maintainer: Ramón M. Gómez
Source: http://opengnsys.es Source: http://opengnsys.es
Copyright: 2014 Virtual Cable S.L.U. Copyright: 2014 Virtual Cable S.L.U.

View File

@ -26,7 +26,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # 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. # 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 from __future__ import unicode_literals
@ -34,6 +34,7 @@ from opengnsys.workers import ClientWorker
from opengnsys import operations from opengnsys import operations
from opengnsys.log import logger from opengnsys.log import logger
from opengnsys.scriptThread import ScriptExecutorThread
class OpenGnSysWorker(ClientWorker): class OpenGnSysWorker(ClientWorker):
name = 'opengnsys' name = 'opengnsys'
@ -44,12 +45,14 @@ class OpenGnSysWorker(ClientWorker):
def onDeactivation(self): def onDeactivation(self):
logger.debug('Deactivate invoked') logger.debug('Deactivate invoked')
# Processes message "doit" (sample) # Processes script execution
def process_doit(self, jsonParams): def process_script(self, jsonParams):
logger.debug('Processed message doit with params {}'.format(jsonParams)) logger.debug('Processed message: script({})'.format(jsonParams))
self.sendServerMessage('doit', {'data':1}) thr = ScriptExecutorThread(jsonParams['code'])
thr.start()
#self.sendServerMessage({'op', 'launched'})
def process_logoff(self, jsonParams): def process_logoff(self, jsonParams):
logger.debug('Processed logoff message with params {}'.format(jsonParams)) logger.debug('Processed message: logoff({})'.format(jsonParams))
operations.logoff() operations.logoff()

View File

@ -101,13 +101,6 @@ class OpenGnSysWorker(ServerWorker):
logger.debug('onDeactivation') logger.debug('onDeactivation')
self.REST.sendMessage('ogagent/stopped', {'mac': self.interface.mac, 'ip': self.interface.ip, 'ostype': operations.osType, 'osversion': operations.osVersion}) 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): def processClientMessage(self, message, data):
logger.debug('Got OpenGnsys message from client: {}, data {}'.format(message, data)) logger.debug('Got OpenGnsys message from client: {}, data {}'.format(message, data))
@ -218,7 +211,7 @@ class OpenGnSysWorker(ServerWorker):
thr = ScriptExecutorThread(script) thr = ScriptExecutorThread(script)
thr.start() thr.start()
else: else:
self.sendScriptMessage(script) self.sendClientMessage('script', {'code': script})
return {'op': 'launched'} return {'op': 'launched'}
def process_logoff(self, path, getParams, postParams, server): def process_logoff(self, path, getParams, postParams, server):