[X2go-Commits] x2gobroker.git - master (branch) updated: 0.0.0.1-32-g9f6eaa8
X2Go dev team
git-admin at x2go.org
Tue Feb 19 21:32:12 CET 2013
The branch, master has been updated
via 9f6eaa8a2b8d2901875d87f00d4deb6e5822f2ec (commit)
via 23c2c59626fbd1c0d5b5cccc3db6387996e35a9c (commit)
via afc89fc0421a3061f9caa388e3f0de17a0b41575 (commit)
via e62340932ce2e795b38309453f8754cd500ecf4d (commit)
via 961a085fe915a6b1e6c7809717fa894062bbf927 (commit)
via dd6e78151e15db52f78f2d8d9caf66a1ca018149 (commit)
via 36cadfdd3a58b86b0c0cf79256c446e49a6626c9 (commit)
via 5dfab3f0e3fd408d2fe24969dd554f9348b62e23 (commit)
via a9b66e7a546aebe2d75b7303faae4491c9eb0a15 (commit)
via 441738987b1baad30e9195c811bce85b3cc6809e (commit)
from 0aca8cade7297dbe428473bcb5ca4e00d4f4bc10 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9f6eaa8a2b8d2901875d87f00d4deb6e5822f2ec
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:34:52 2013 +0100
fix test_broker_base: two options (user, host) have been added to the DEFAULT_SESSIONPROFILE recently
commit 23c2c59626fbd1c0d5b5cccc3db6387996e35a9c
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:33:10 2013 +0100
add some debug messages
commit afc89fc0421a3061f9caa388e3f0de17a0b41575
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:32:45 2013 +0100
add some debug messages
commit e62340932ce2e795b38309453f8754cd500ecf4d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:32:21 2013 +0100
Set log level to CRITICAL if running unit tests.
commit 961a085fe915a6b1e6c7809717fa894062bbf927
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:31:28 2013 +0100
do not manipulate X2GOBROKER_CONFIG_DEFAULTS, this has an effect on all other test units
commit dd6e78151e15db52f78f2d8d9caf66a1ca018149
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:28:50 2013 +0100
fix function name, fix variable name
commit 36cadfdd3a58b86b0c0cf79256c446e49a6626c9
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:28:25 2013 +0100
only override X2GOBROKER_DEBUG if cmdline arg --debug is set
commit 5dfab3f0e3fd408d2fe24969dd554f9348b62e23
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 21:05:05 2013 +0100
typo fix
commit a9b66e7a546aebe2d75b7303faae4491c9eb0a15
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 20:39:44 2013 +0100
typo fix
commit 441738987b1baad30e9195c811bce85b3cc6809e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Feb 19 20:34:54 2013 +0100
be more strict with UID providing variables in init script
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 1 +
debian/x2gobroker-daemon.default | 2 +-
debian/x2gobroker-daemon.init | 3 +++
sbin/x2gobroker | 5 ++++-
test.py | 2 ++
x2gobroker/agent.py | 4 ++--
x2gobroker/brokers/base_broker.py | 4 ++++
x2gobroker/config.py | 2 +-
x2gobroker/defaults.py | 15 ++++++++++++++-
x2gobroker/tests/test_broker_base.py | 2 ++
x2gobroker/tests/test_web_plain_base.py | 3 ---
x2gobroker/web/plain.py | 15 ++++++++++-----
12 files changed, 44 insertions(+), 14 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index ba7337d..ad2e00c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ x2gobroker (0.0.0.2-0~x2go1) UNRELEASED; urgency=low
the getpass.getuser() function sees the correct effective UID.
- Make sure the unprivileged daemon user (x2gobroker) has access to the
PID file directory.
+ - Set log level to CRITICAL if running unit tests.
* /debian/control:
+ Add bin:package x2gobroker-agent.
* /debian/x2gobroker-daemon.init:
diff --git a/debian/x2gobroker-daemon.default b/debian/x2gobroker-daemon.default
index 8b8bea2..ff315d5 100644
--- a/debian/x2gobroker-daemon.default
+++ b/debian/x2gobroker-daemon.default
@@ -9,7 +9,7 @@ START_DAEMON=true
# writable by that user
#X2GOBROKER_DAEMON_USER=x2gobroker
-# run XGo Session Broker in debug mode, this will make the broker
+# run X2Go Session Broker in debug mode, this will make the broker
# available through http GET method calls (otherwise: POST method
# only) and you will be able to test the broker through your web
# browser (0=disable, 1=enable).
diff --git a/debian/x2gobroker-daemon.init b/debian/x2gobroker-daemon.init
index 7d945ed..fba7672 100755
--- a/debian/x2gobroker-daemon.init
+++ b/debian/x2gobroker-daemon.init
@@ -46,7 +46,10 @@ mkdir -p $RUNDIR/x2gobroker
chown $X2GOBROKER_DAEMON_USER:nogroup $RUNDIR/x2gobroker
chmod 0700 $RUNDIR/x2gobroker
+# mend user ID variables when --chuid $X2GOBROKER_DAEMON_USER is used with start-stop-daemon
export LOGNAME=$X2GOBROKER_DAEMON_USER
+export USER=$X2GOBROKER_DAEMON_USER
+export USERNAME=$X2GOBROKER_DAEMON_USER
export X2GOBROKER_DEBUG
export X2GOBROKER_DAEMON_USER
diff --git a/sbin/x2gobroker b/sbin/x2gobroker
index 2e8b5b4..da91b0e 100755
--- a/sbin/x2gobroker
+++ b/sbin/x2gobroker
@@ -61,7 +61,10 @@ if __name__ == "__main__":
if cmdline_args.config_file is not None:
x2gobroker.defaults.X2GOBROKER_CONFIG = cmdline_args.config_file
- x2gobroker.defaults.X2GOBROKER_DEBUG = cmdline_args.debug
+
+ # override X2GOBROKER_DEBUG=0 in os.environ with the command line switch
+ if cmdline_args.debug:
+ x2gobroker.defaults.X2GOBROKER_DEBUG = cmdline_args.debug
# some people just give the port but prepend a colon, webpy does not like this, so we strip if off
cmdline_args.bind = cmdline_args.bind.lstrip(':')
diff --git a/test.py b/test.py
index 353cd16..a8c53df 100755
--- a/test.py
+++ b/test.py
@@ -22,8 +22,10 @@
Unit tests for Python X2GoBroker.
"""
import os
+import logging
if __name__ == "__main__":
os.environ.update({'X2GOBROKER_DEBUG': "1"})
+ os.environ.update({'X2GOBROKER_TESTSUITE': "1"})
os.chdir(os.path.join('x2gobroker', 'tests',))
os.system('python ./runalltests.py')
diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 3e7cdc6..81edc04 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
@@ -24,7 +24,7 @@ import subprocess
# X2Go Broker modules
import x2gobroker.defaults
-def call_x2gobroker_agent(username, mode):
+def call_broker_agent(username, mode):
"""\
Launch X2Go Broker Agent and process its output.
@@ -34,7 +34,7 @@ def call_x2gobroker_agent(username, mode):
@type mode: C{unicode}
"""
- cmdline = [
+ cmd_line = [
'{x2gobroker_agent_binary}'.format(x2gobroker_agent_binary=x2gobroker.defaults.X2GOBROKER_AGENT_CMD),
'{username}'.format(username=username),
'{mode}'.format(mode=mode),
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 9c710b3..7b812a3 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -36,6 +36,8 @@ import x2gobroker.config
import x2gobroker.defaults
import x2gobroker.agent
+from x2gobroker.loggers import logger_broker, logger_error
+
class X2GoBroker(object):
"""\
L{base.X2GoBroker} is an abstract class for X2Go broker implementations.
@@ -414,9 +416,11 @@ class X2GoBroker(object):
_auth_mech = ""
if self.config.has_value('global', 'default-auth-mech'):
_default_auth_mech = self.config.get_value('global', 'default-auth-mech').lower()
+ logger_broker.debug('base_broker.X2GoBroker.get_authentication_mechanism(): found default-auth-mech in global config section: {value}'.format(value=_default_auth_mech))
if self.config.has_value(self.backend_name, 'auth-mech'):
_auth_mech = self.config.get_value(self.backend_name, 'auth-mech').lower()
+ logger_broker.debug('base_broker.X2GoBroker.get_authentication_mechanism(): found auth-mech in backend config section »{backend}«: {value}'.format(backend=self.backend_name, value=_auth_mech))
return unicode(_auth_mech) or unicode(_default_auth_mech)
diff --git a/x2gobroker/config.py b/x2gobroker/config.py
index 962b33c..974ad73 100644
--- a/x2gobroker/config.py
+++ b/x2gobroker/config.py
@@ -99,7 +99,7 @@ class X2GoBrokerConfigFile(object):
self.write()
def __repr__(self):
- result = 'X2goConfigFile('
+ result = 'X2GoConfigFile('
for p in dir(self):
if '__' in p or not p in self.__dict__ or type(p) is types.InstanceType: continue
result += p + '=' + str(self.__dict__[p]) + ','
diff --git a/x2gobroker/defaults.py b/x2gobroker/defaults.py
index d52a485..4e90837 100644
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -37,14 +37,27 @@ if os.environ.has_key('X2GOBROKER_DEBUG'):
X2GOBROKER_DEBUG = ( os.environ['X2GOBROKER_DEBUG'].lower() in ('1', 'on', 'true', 'yes', ) )
else:
X2GOBROKER_DEBUG = False
+if os.environ.has_key('X2GOBROKER_TESTSUITE'):
+ X2GOBROKER_TESTSUITE = ( os.environ['X2GOBROKER_TESTSUITE'].lower() in ('1', 'on', 'true', 'yes', ) )
+else:
+ X2GOBROKER_TESTSUITE = False
+
+# enforce debugging for interactive usage
if X2GOBROKER_USER != X2GOBROKER_DAEMON_USER:
X2GOBROKER_DEBUG = True
-if X2GOBROKER_DEBUG:
+# raise log level to DEBUG if requested...
+if X2GOBROKER_DEBUG and not X2GOBROKER_TESTSUITE:
logger_broker.setLevel(logging.DEBUG)
logger_access.setLevel(logging.DEBUG)
logger_error.setLevel(logging.DEBUG)
+# drop og level to CRITICAL if we are running the unittests...
+if X2GOBROKER_TESTSUITE:
+ logger_broker.setLevel(logging.CRITICAL)
+ logger_access.setLevel(logging.CRITICAL)
+ logger_error.setLevel(logging.CRITICAL)
+
# check effective UID the broker runs as and complain appropriately...
if X2GOBROKER_USER != X2GOBROKER_DAEMON_USER and os.geteuid() != 0:
logger_broker.warn('X2Go Session Broker has been started interactively by user {username}, better run as user {daemon_username}.'.format(username=X2GOBROKER_USER, daemon_username=X2GOBROKER_DAEMON_USER))
diff --git a/x2gobroker/tests/test_broker_base.py b/x2gobroker/tests/test_broker_base.py
index 057647d..0bda18e 100644
--- a/x2gobroker/tests/test_broker_base.py
+++ b/x2gobroker/tests/test_broker_base.py
@@ -304,6 +304,8 @@ check-credentials = false
'sshport': 22,
'setdpi': 0,
'pack': '16m-jpeg',
+ 'user': '',
+ 'host': [u'localhost'],
}
_profile = base_backend.get_profile_defaults()
self.assertEqual(len(_expected_profile.keys()), len(_profile.keys()))
diff --git a/x2gobroker/tests/test_web_plain_base.py b/x2gobroker/tests/test_web_plain_base.py
index fd5019c..a31850f 100644
--- a/x2gobroker/tests/test_web_plain_base.py
+++ b/x2gobroker/tests/test_web_plain_base.py
@@ -30,8 +30,6 @@ from x2gobroker.web.plain import *
urls = ( '/plain/(.*)', 'X2GoBrokerWebPlain',)
app = web.application(urls, globals())
-x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS.update({'base': {'enable': True, 'auth-mech': 'pam', }, })
-
class TestX2GoBrokerWebPlainBase(unittest.TestCase):
### TEST RESPONSE: is enabled?
@@ -110,7 +108,6 @@ auth-mech = testsuite
def test_suite():
- x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS.update({'base': {'enable': True, 'auth-mech': 'pam', }, })
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestX2GoBrokerWebPlainBase))
diff --git a/x2gobroker/web/plain.py b/x2gobroker/web/plain.py
index e25b5c0..22b14ba 100644
--- a/x2gobroker/web/plain.py
+++ b/x2gobroker/web/plain.py
@@ -25,8 +25,9 @@ import web
import types
# Python X2Go Broker modules
-from x2gobroker.defaults import X2GOBROKER_DEFAULT_BACKEND as _X2GOBROKER_DEFAULT_BACKEND
-from x2gobroker.defaults import X2GOBROKER_DEBUG as _X2GOBROKER_DEBUG
+import x2gobroker.defaults
+
+from x2gobroker.loggers import logger_broker, logger_error
class X2GoBrokerWebPlain:
@@ -41,14 +42,15 @@ class X2GoBrokerWebPlain:
web.header(http_header_item, self.http_header_items[http_header_item])
def GET(self, backend):
- if _X2GOBROKER_DEBUG:
+ if x2gobroker.defaults.X2GOBROKER_DEBUG:
+ logger_broker.warn('GET http request detected, if unwanted: disable X2GOBROKER_DEBUG')
return self.POST(backend)
return web.notfound()
def POST(self, backend):
if not backend:
- backend = _X2GOBROKER_DEFAULT_BACKEND
+ backend = x2gobroker.defaults.X2GOBROKER_DEFAULT_BACKEND
else:
backend = backend.rstrip('/')
@@ -63,9 +65,11 @@ class X2GoBrokerWebPlain:
# set the client address for the broker backend
ip = web.ctx.env.get('HTTP_X_FORWARDED_FOR', web.ctx.get('ip', ''))
if ip:
+ logger_broker.info('client address is {address}'.format(address=ip))
broker_backend.set_client_address(ip)
- elif not _X2GOBROKER_DEBUG:
+ elif not x2gobroker.defaults.X2GOBROKER_DEBUG:
# if the client IP is not set, we pretend to have nothing on offer
+ logger_error.error('client could not provide an IP address, pretending: 404 Not Found')
return web.notfound()
# if the broker backend is disabled in the configuration, pretend to have nothing on offer
@@ -89,6 +93,7 @@ class X2GoBrokerWebPlain:
output = ''
self._gen_http_header()
+ logger_broker.debug ('username: {username}, password: {password}, task: {task}, profile_id: {profile_id}'.format(username=username, password='XXXXX', task=task, profile_id=profile_id))
if broker_backend.check_access(username=username, password=password, authid=authid):
###
hooks/post-receive
--
x2gobroker.git (HTTP(S) Session broker for X2Go)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).
More information about the x2go-commits
mailing list