#718: Creación de OGAgent:
* adaptar algunos ficheros a la sintaxis recomendada por el comando {{{pylint}}}; * OGAgent para Windows: * actualizar componentes y reducir los aviso de Wine; * corregir fallo al instalar {{{pycrypto}}} para Windows; * corregir localización de certificado en Windows (ahora está en librería {{{certifi}}} en vez de en {{{requests}}}); * OGAgent para Linux: * evitar bucle infinito al intentar parar el proceso. * Ignorar mensajes de SELinux en la MV Vagrant para OGAgent. git-svn-id: https://opengnsys.es/svn/branches/version1.1@5471 a21b9725-9963-47de-94b9-378ad31fedc9remotes/github/oglive
parent
e21cba12d0
commit
90e5c2d1a4
|
@ -156,7 +156,7 @@ class Daemon:
|
||||||
|
|
||||||
# Try killing the daemon process
|
# Try killing the daemon process
|
||||||
try:
|
try:
|
||||||
while True:
|
for i in range(10):
|
||||||
os.kill(pid, SIGTERM)
|
os.kill(pid, SIGTERM)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
|
|
|
@ -30,13 +30,6 @@
|
||||||
'''
|
'''
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from opengnsys.workers import ServerWorker
|
|
||||||
|
|
||||||
from opengnsys import REST, RESTError
|
|
||||||
from opengnsys import operations
|
|
||||||
from opengnsys.log import logger
|
|
||||||
from opengnsys.scriptThread import ScriptExecutorThread
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
import thread
|
import thread
|
||||||
|
@ -47,6 +40,12 @@ import random
|
||||||
import string
|
import string
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
from opengnsys.workers import ServerWorker
|
||||||
|
from opengnsys import REST, RESTError
|
||||||
|
from opengnsys import operations
|
||||||
|
from opengnsys.log import logger
|
||||||
|
from opengnsys.scriptThread import ScriptExecutorThread
|
||||||
|
|
||||||
# Error handler decorator.
|
# Error handler decorator.
|
||||||
def catchBackgroundError(fnc):
|
def catchBackgroundError(fnc):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
@ -147,13 +146,12 @@ class OpenGnSysWorker(ServerWorker):
|
||||||
|
|
||||||
The methods must return data that can be serialized to json (i.e. Ojects are not serializable to json, basic type are)
|
The methods must return data that can be serialized to json (i.e. Ojects are not serializable to json, basic type are)
|
||||||
'''
|
'''
|
||||||
if len(path) == 0:
|
if not path:
|
||||||
return "ok"
|
return "ok"
|
||||||
try:
|
try:
|
||||||
operation = getattr(self, 'ogclient_' + path[0])
|
operation = getattr(self, 'ogclient_' + path[0])
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception('Message processor for "{}" not found'.format(path[0]))
|
raise Exception('Message processor for "{}" not found'.format(path[0]))
|
||||||
|
|
||||||
return operation(path[1:], getParams, postParams)
|
return operation(path[1:], getParams, postParams)
|
||||||
|
|
||||||
def process_status(self, path, getParams, postParams, server):
|
def process_status(self, path, getParams, postParams, server):
|
||||||
|
@ -241,6 +239,6 @@ class OpenGnSysWorker(ServerWorker):
|
||||||
self.sendClientMessage('popup', postParams)
|
self.sendClientMessage('popup', postParams)
|
||||||
return {'op': 'launched'}
|
return {'op': 'launched'}
|
||||||
|
|
||||||
def process_client_popup(tself, params):
|
def process_client_popup(self, params):
|
||||||
self.REST.sendMessage('popup_done', params)
|
self.REST.sendMessage('popup_done', params)
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
# Valid logging levels, from UDS Broker (uds.core.utils.log)
|
# Valid logging levels, from UDS Broker (uds.core.utils.log)
|
||||||
OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in xrange(6))
|
OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in range(6))
|
||||||
|
|
||||||
|
|
||||||
class LocalLogger(object):
|
class LocalLogger(object):
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
|
@author: Ramón M. Gómez, ramongomez at us dot es
|
||||||
'''
|
'''
|
||||||
|
|
||||||
VERSION = '1.1.0'
|
VERSION = '1.1.0'
|
||||||
|
@ -63,9 +64,12 @@ import os
|
||||||
sys.argv.append('py2exe')
|
sys.argv.append('py2exe')
|
||||||
|
|
||||||
def get_requests_cert_file():
|
def get_requests_cert_file():
|
||||||
"""Add Python requests .pem file for installers."""
|
"""Add Python requests or certifi .pem file for installers."""
|
||||||
import requests
|
import requests
|
||||||
f = os.path.join(os.path.dirname(requests.__file__), 'cacert.pem')
|
f = os.path.join(os.path.dirname(requests.__file__), 'cacert.pem')
|
||||||
|
if not os.path.exists(f):
|
||||||
|
import certifi
|
||||||
|
f = os.path.join(os.path.dirname(certifi.__file__), 'cacert.pem')
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
# * Wine (32 bit)
|
# * Wine (32 bit)
|
||||||
# * winetricks (in some distributions)
|
# * winetricks (in some distributions)
|
||||||
|
|
||||||
export WINEARCH=win32
|
export WINEARCH=win32 WINEPREFIX=$PWD/wine WINEDEBUG=fixme-all
|
||||||
WINE=wine
|
WINE=wine
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
mkdir downloads
|
mkdir downloads
|
||||||
# Get needed software
|
# Get needed software
|
||||||
cd downloads
|
cd downloads
|
||||||
wget -nd https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi -O python-2.7.msi
|
wget -nd https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi -O python-2.7.msi
|
||||||
wget -nd http://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
|
wget -nd http://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
|
||||||
wget -nd https://bootstrap.pypa.io/get-pip.py
|
wget -nd https://bootstrap.pypa.io/get-pip.py
|
||||||
wget -nd http://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/pywin32-220.win32-py2.7.exe/download -O pywin32-install.exe
|
wget -nd http://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win32-py2.7.exe/download -O pywin32-install.exe
|
||||||
wget -nd http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download -O py2exe-install.exe
|
wget -nd http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download -O py2exe-install.exe
|
||||||
wget -nd http://prdownloads.sourceforge.net/nsis/nsis-3.0rc1-setup.exe?download -O nsis-install.exe
|
wget -nd http://prdownloads.sourceforge.net/nsis/nsis-3.0rc1-setup.exe?download -O nsis-install.exe
|
||||||
wget -nd http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe/download -O pyqt-install.exe
|
wget -nd http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe/download -O pyqt-install.exe
|
||||||
|
@ -23,8 +23,6 @@ download() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_python() {
|
install_python() {
|
||||||
WINEPREFIX=`pwd`/wine
|
|
||||||
export WINEPREFIX
|
|
||||||
if which winetricks &>/dev/null; then
|
if which winetricks &>/dev/null; then
|
||||||
echo "Setting up wine prefix (using winetricks)"
|
echo "Setting up wine prefix (using winetricks)"
|
||||||
winetricks
|
winetricks
|
||||||
|
@ -50,18 +48,15 @@ install_python() {
|
||||||
|
|
||||||
setup_pip() {
|
setup_pip() {
|
||||||
echo "Seting up pip..."
|
echo "Seting up pip..."
|
||||||
#mkdir $WINEPREFIX/drive_c/temp
|
$WINE C:\\Python27\\python -m pip install --upgrade pip
|
||||||
#cp downloads/get-pip.py $WINEPREFIX/drive_c/temp
|
|
||||||
#cd $WINEPREFIX/drive_c/temp
|
|
||||||
#$WINE c:\\Python27\\python.exe get-pip.py
|
|
||||||
wine c:\\Python27\\python -m pip install --upgrade pip
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
echo "Installing required packages"
|
echo "Installing required packages"
|
||||||
wine c:\\Python27\\python -m pip install requests
|
$WINE C:\\Python27\\python -m pip install requests
|
||||||
wine c:\\Python27\\python -m pip install pycrypto
|
$WINE C:\\Python27\\python -m pip install six
|
||||||
wine c:\\Python27\\python -m pip install six
|
# Using easy_install instead of pip to install pycrypto
|
||||||
|
$WINE C:\\Python27\\Scripts\\easy_install http://www.voidspace.org.uk/python/pycrypto-2.6.1/pycrypto-2.6.1.win32-py2.7.exe
|
||||||
# Copy nsis required NSIS_Simple_Firewall_Plugin_1
|
# Copy nsis required NSIS_Simple_Firewall_Plugin_1
|
||||||
echo "Copying simple firewall plugin for nsis installer"
|
echo "Copying simple firewall plugin for nsis installer"
|
||||||
unzip -o downloads/NSIS_Simple_Firewall_Plugin_1.20.zip SimpleFC.dll -d $WINEPREFIX/drive_c/Program\ Files/NSIS/Plugins/x86-ansi/
|
unzip -o downloads/NSIS_Simple_Firewall_Plugin_1.20.zip SimpleFC.dll -d $WINEPREFIX/drive_c/Program\ Files/NSIS/Plugins/x86-ansi/
|
||||||
|
|
Loading…
Reference in New Issue