[X2Go-Commits] [x2gobroker] 01/01: drop obsolete/redundant code for optional scripts with JSON webUI frontend, only call optional script if not ''

git-admin at x2go.org git-admin at x2go.org
Thu Apr 3 16:19:01 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit 4b3e3a5f83f5851fd66f03405848737d06a67087
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Apr 3 16:18:55 2014 +0200

    drop obsolete/redundant code for optional scripts with JSON webUI frontend, only call optional script if not ''
---
 x2gobroker/brokers/base_broker.py |   13 +++++++------
 x2gobroker/web/json.py            |   12 ------------
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 603d443..026991b 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -1169,12 +1169,13 @@ class X2GoBroker(object):
         if len(global_config[script_type]) != 0:
             for script in global_config[script_type]:
                 try:
-                    my_script=None
-                    exec("import x2gobroker.optional_scripts.{script}_script".format(script=script))
-                    exec("my_script = x2gobroker.optional_scripts.{script}_script.X2GoBrokerOptionalScript()".format(script=script))
-                    logger_broker.debug ('Calling {script_type} {script} with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}, authed: {authed}, server: {server}'.format(script_type=script_type,script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server))
-                    username, password, task, profile_id, ip, cookie, authed, server = my_script.run_me(username=username, password=password, task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server)
-                    logger_broker.debug ('Finished {script_type} {script} with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}, authed: {authed}, server: {server}'.format(script_type=script_type,script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server))
+                    if script:
+                        my_script=None
+                        exec("import x2gobroker.optional_scripts.{script}_script".format(script=script))
+                        exec("my_script = x2gobroker.optional_scripts.{script}_script.X2GoBrokerOptionalScript()".format(script=script))
+                        logger_broker.debug ('Calling {script_type} {script} with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}, authed: {authed}, server: {server}'.format(script_type=script_type,script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server))
+                        username, password, task, profile_id, ip, cookie, authed, server = my_script.run_me(username=username, password=password, task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server)
+                        logger_broker.debug ('Finished {script_type} {script} with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}, authed: {authed}, server: {server}'.format(script_type=script_type,script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie, authed=authed, server=server))
                 except ImportError:
                     logger_error.error('No such optional script \'{script}\''.format(script=script))
         return username, password, task, profile_id, ip, cookie, authed, server
diff --git a/x2gobroker/web/json.py b/x2gobroker/web/json.py
index b88ca5d..02f4846 100644
--- a/x2gobroker/web/json.py
+++ b/x2gobroker/web/json.py
@@ -134,18 +134,6 @@ class X2GoBrokerWeb(_RequestHandler):
 
         if access:
 
-            if len(global_config['post_auth_scripts']) != 0:
-                for script in global_config['post_auth_scripts']:
-                    try:
-                        post_auth_script=None
-                        exec("import x2gobroker.optional_scripts.{script}_script".format(script=script))
-                        exec("post_auth_script = x2gobroker.optional_scripts.{script}_script.X2GoBrokerOptionalScript()".format(script=script))
-                        logger_broker.debug ('Calling post-auth script {script} with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}'.format(script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie))
-                        username, password, task, profile_id, ip, cookie = post_auth_script.run_me(username=username, password=password, task=task, profile_id=profile_id, ip=ip, cookie=cookie)
-                        logger_broker.debug ('Post-auth script {script} finished with username: {username}, password: {password}, task: {task}, profile_id: {profile_id}, ip: {ip}, cookie: {cookie}'.format(script=script,username=username, password='XXXXX', task=task, profile_id=profile_id, ip=ip, cookie=cookie))
-                    except ImportError:
-                        logger_error.error('No such optional script \'{script}\''.format(script=script))
-
             ###
             ### CONFIRM SUCCESSFUL AUTHENTICATION FIRST
             ###

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git



More information about the x2go-commits mailing list