X2Go dev team | 18 Apr 17:01 2013

x2gobroker.git - uccsoutput (branch) updated: 0.0.1.0-52-g3d553c0

The branch, uccsoutput has been updated
       via  3d553c0c30e15dbe643c9208d857d387bbd9c7d4 (commit)
       via  f4fc469442dcdb43047f2165ccda4f6c0e25df4e (commit)
       via  e115d0666c21ebecd8c7c8549192ffe4bbf02071 (commit)
       via  75f4cb8a59b9e8591aaed2f92dce4a6781ff8299 (commit)
       via  688b8ea22350b99660413a3333926bfa81d19609 (commit)
      from  dc9eb932798d2679780d1343e1ab3ea4fa7386cc (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 3d553c0c30e15dbe643c9208d857d387bbd9c7d4
Author: Mike Gabriel <mike.gabriel@...>
Date:   Thu Apr 18 17:00:50 2013 +0200

    follow-up fix for last commit

commit f4fc469442dcdb43047f2165ccda4f6c0e25df4e
Author: Mike Gabriel <mike.gabriel@...>
Date:   Thu Apr 18 16:58:06 2013 +0200

    Separate logging logic of x2gobroker-authservice from the rest of the logging in x2gobroker. (Fixes: #172).

commit e115d0666c21ebecd8c7c8549192ffe4bbf02071
Author: Mike Gabriel <mike.gabriel@...>
Date:   Wed Apr 17 21:15:51 2013 +0200

    fix dependency set of x2gobroker-wsgi

commit 75f4cb8a59b9e8591aaed2f92dce4a6781ff8299
Author: Mike Gabriel <mike.gabriel@...>
Date:   Wed Apr 17 21:11:36 2013 +0200

    add dependency on adduser for x2gobroker-authservice

commit 688b8ea22350b99660413a3333926bfa81d19609
Author: Mike Gabriel <mike.gabriel@...>
Date:   Wed Apr 17 21:07:57 2013 +0200

    /debian/control: Let bin:package x2gobroker-authservice depend on python-x2gobroker (of the same
version). (Fixes: #170).

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                                   |    4 ++
 debian/control                                     |    5 +-
 debian/python-x2gobroker.install                   |    1 -
 debian/python-x2gobroker.postinst                  |   29 ++++++++++++
 debian/python-x2gobroker.postrm                    |   27 +++++++++++
 debian/python-x2gobroker.preinst                   |   31 +++++++++++++
 debian/x2gobroker-agent.postinst                   |    3 ++
 debian/x2gobroker-authservice.install              |    3 +-
 debian/x2gobroker-daemon.install                   |    1 +
 debian/x2gobroker-daemon.postinst                  |    3 ++
 debian/x2gobroker-wsgi.install                     |    3 +-
 debian/x2gobroker-wsgi.postinst                    |    3 ++
 etc/broker/x2gobroker-loggers.conf                 |   21 ++-------
 logrotate/x2gobroker-authservice                   |   13 ++++++
 logrotate/x2gobroker-daemon                        |   13 ++++++
 logrotate/{x2gobroker => x2gobroker-wsgi}          |    4 +-
 sbin/x2gobroker-authservice                        |   21 ++++-----
 x2gobroker/__init__.py                             |    9 ----
 x2gobroker/agent.py                                |    5 +-
 x2gobroker/authservice.py                          |   48 +++++++++++++++++---
 x2gobroker/loggers.py                              |    5 --
 .../{__init__.py => x2gobroker_exceptions.py}      |    3 --
 22 files changed, 192 insertions(+), 63 deletions(-)
 create mode 100755 debian/python-x2gobroker.postinst
 create mode 100755 debian/python-x2gobroker.postrm
 create mode 100755 debian/python-x2gobroker.preinst
 create mode 100644 debian/x2gobroker-daemon.install
 create mode 100644 logrotate/x2gobroker-authservice
 create mode 100644 logrotate/x2gobroker-daemon
 rename logrotate/{x2gobroker => x2gobroker-wsgi} (57%)
 copy x2gobroker/{__init__.py => x2gobroker_exceptions.py} (92%)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 021f5c5..594ca76 100644
--- a/debian/changelog
+++ b/debian/changelog
 <at>  <at>  -11,8 +11,12  <at>  <at>  x2gobroker (0.0.1.1-0~x2go1) UNRELEASED; urgency=low
       session profile parameter that triggers key based auth in X2Go Client.
       (Fixes: #154).
     - Fix hard-coded path to x2gobroker's authservice socket.
+    - Separate logging logic of x2gobroker-authservice from the rest of
+      the logging in x2gobroker. (Fixes: #172).
   * /debian/control:
     + Fix --root parameter in DEB_PYTHON_INSTALL_ARGS.
+    + Let bin:package x2gobroker-authservice depend on python-x2gobroker (of the
+      same version). (Fixes: #170).
   * Properly remove the X2Go Session broker log files on package purgal.
   * Let bin:package x2gobroker-authservice create x2gouser:x2gouser, as well.
     (Fixes: #171).
diff --git a/debian/control b/debian/control
index 45e0eae..21554ca 100644
--- a/debian/control
+++ b/debian/control
 <at>  <at>  -58,6 +58,7  <at>  <at>  Depends:
  python-argparse,
  python-setproctitle,
  python-tornado,
+ python-wsgilog,
  python-x2gobroker (>= ${source:Version}), python-x2gobroker (<< ${source:Version}.1~),
 Suggests:
  apache2 | httpd,
 <at>  <at>  -87,9 +88,11  <at>  <at>  Architecture: all
 Depends:
  ${python:Depends},
  ${misc:Depends},
+ adduser,
  python,
  python-argparse,
  python-setproctitle,
+ python-x2gobroker (>= ${source:Version}), python-x2gobroker (<< ${source:Version}.1~),
 Suggests:
  x2gobroker-daemon,
 Description: X2Go http(s) based session broker (PAM authentication service)
 <at>  <at>  -152,7 +155,7  <at>  <at>  Depends:
  ${python:Depends},
  python,
  adduser,
- python-wsgilog,
+ x2gobroker (>= ${source:Version}), x2gobroker (<< ${source:Version}.1~),
 Suggests:
  apache2,
 Description: X2Go http(s) based session broker (CGI)
diff --git a/debian/python-x2gobroker.install b/debian/python-x2gobroker.install
index 91aabf6..c8bd09a 100644
--- a/debian/python-x2gobroker.install
+++ b/debian/python-x2gobroker.install
 <at>  <at>  -1,5 +1,4  <at>  <at> 
 etc/x2gobroker.conf etc/x2go/
 etc/broker etc/x2go/
-logrotate/x2gobroker etc/logrotate.d/
 pam/x2gobroker etc/pam.d/
 usr/
diff --git a/debian/python-x2gobroker.postinst b/debian/python-x2gobroker.postinst
new file mode 100755
index 0000000..5829481
--- /dev/null
+++ b/debian/python-x2gobroker.postinst
 <at>  <at>  -0,0 +1,29  <at>  <at> 
+#!/bin/sh
+# postinst script for python-x2gobroker
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
+	dpkg-maintscript-helper rm_conffile /etc/logrotate.d/x2gobroker 0.0.1.1-0 -- "$ <at> "
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/python-x2gobroker.postrm b/debian/python-x2gobroker.postrm
new file mode 100755
index 0000000..d8e6815
--- /dev/null
+++ b/debian/python-x2gobroker.postrm
 <at>  <at>  -0,0 +1,27  <at>  <at> 
+#! /bin/sh
+# postrm script for python-x2gobroker
+#
+# see: dh_installdeb(1)
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see /usr/share/doc/packaging-manual/
+
+set -e
+
+if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
+	dpkg-maintscript-helper rm_conffile /etc/logrotate.d/x2gobroker 0.0.1.1-0 -- "$ <at> "
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
\ No newline at end of file
diff --git a/debian/python-x2gobroker.preinst b/debian/python-x2gobroker.preinst
new file mode 100755
index 0000000..1f28dd6
--- /dev/null
+++ b/debian/python-x2gobroker.preinst
 <at>  <at>  -0,0 +1,31  <at>  <at> 
+#!/bin/sh
+# preinst script for python-x2gobroker
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
+	dpkg-maintscript-helper rm_conffile /etc/logrotate.d/x2gobroker 0.0.1.1-0 -- "$ <at> "
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/x2gobroker-agent.postinst b/debian/x2gobroker-agent.postinst
index 8f48ccd..a6fd79d 100755
--- a/debian/x2gobroker-agent.postinst
+++ b/debian/x2gobroker-agent.postinst
 <at>  <at>  -56,6 +56,9  <at>  <at>  case "$1" in
 		if ! dpkg-statoverride --list /usr/lib/x2go/x2gobroker-agent 1>/dev/null; then
 		    dpkg-statoverride --add --update root x2gobroker 4750 /usr/lib/x2go/x2gobroker-agent
 		fi
+		touch /var/log/x2gobroker/broker.log && chown x2gobroker:adm /var/log/x2gobroker/broker.log
+		touch /var/log/x2gobroker/error.log && chown x2gobroker:adm /var/log/x2gobroker/error.log
+

 		;;

diff --git a/debian/x2gobroker-authservice.install b/debian/x2gobroker-authservice.install
index 03fb37c..8d466ac 100644
--- a/debian/x2gobroker-authservice.install
+++ b/debian/x2gobroker-authservice.install
 <at>  <at>  -1 +1,2  <at>  <at> 
-sbin/x2gobroker-authservice usr/sbin/
\ No newline at end of file
+sbin/x2gobroker-authservice usr/sbin/
+logrotate/x2gobroker-authservice etc/logrotate.d/
\ No newline at end of file
diff --git a/debian/x2gobroker-daemon.install b/debian/x2gobroker-daemon.install
new file mode 100644
index 0000000..7f70476
--- /dev/null
+++ b/debian/x2gobroker-daemon.install
 <at>  <at>  -0,0 +1  <at>  <at> 
+logrotate/x2gobroker-daemon etc/logrotate.d/
\ No newline at end of file
diff --git a/debian/x2gobroker-daemon.postinst b/debian/x2gobroker-daemon.postinst
index 9bc1d52..95c4475 100755
--- a/debian/x2gobroker-daemon.postinst
+++ b/debian/x2gobroker-daemon.postinst
 <at>  <at>  -53,6 +53,9  <at>  <at>  case "$1" in
 		if ! dpkg-statoverride --list /var/log/x2gobroker 1>/dev/null; then
 			dpkg-statoverride --add --update x2gobroker adm 2750 /var/log/x2gobroker
 		fi
+		touch /var/log/x2gobroker/access.log && chown x2gobroker:adm /var/log/x2gobroker/access.log
+		touch /var/log/x2gobroker/broker.log && chown x2gobroker:adm /var/log/x2gobroker/broker.log
+		touch /var/log/x2gobroker/error.log && chown x2gobroker:adm /var/log/x2gobroker/error.log

 		;;

diff --git a/debian/x2gobroker-wsgi.install b/debian/x2gobroker-wsgi.install
index 26c32b7..f7f6452 100644
--- a/debian/x2gobroker-wsgi.install
+++ b/debian/x2gobroker-wsgi.install
 <at>  <at>  -1,2 +1,3  <at>  <at> 
 etc/x2gobroker-wsgi.apache.conf /etc/x2go/
-etc/x2gobroker-wsgi.apache.vhost /etc/x2go/
\ No newline at end of file
+etc/x2gobroker-wsgi.apache.vhost /etc/x2go/
+logrotate/x2gobroker-wsgi etc/logrotate.d/
\ No newline at end of file
diff --git a/debian/x2gobroker-wsgi.postinst b/debian/x2gobroker-wsgi.postinst
index 873b123..0372383 100755
--- a/debian/x2gobroker-wsgi.postinst
+++ b/debian/x2gobroker-wsgi.postinst
 <at>  <at>  -56,6 +56,9  <at>  <at>  case "$1" in
 		if ! dpkg-statoverride --list /var/log/x2gobroker 1>/dev/null; then
 			dpkg-statoverride --add --update x2gobroker adm 2750 /var/log/x2gobroker
 		fi
+		touch /var/log/x2gobroker/broker.log && chown x2gobroker:adm /var/log/x2gobroker/broker.log
+		touch /var/log/x2gobroker/error.log && chown x2gobroker:adm /var/log/x2gobroker/error.log
+		touch /var/log/x2gobroker/wsgi.log && chown x2gobroker:adm /var/log/x2gobroker/wsgi.log

 		;;

diff --git a/etc/broker/x2gobroker-loggers.conf b/etc/broker/x2gobroker-loggers.conf
index 87d7dca..e2edd23 100644
--- a/etc/broker/x2gobroker-loggers.conf
+++ b/etc/broker/x2gobroker-loggers.conf
 <at>  <at>  -21,17 +21,17  <at>  <at> 
 # WARNING: only modify this file if you _exactly_ know what you are doing!!!

 [loggers]
-keys=root,broker,authservice,access,error
+keys=root,broker,access,error

 [logger_root]
 level=NOTSET
 handlers=stderrHandler

 [handlers]
-keys=stderrHandler,brokerFileHandler,authserviceFileHandler,accessFileHandler,errorFileHandler
+keys=stderrHandler,brokerFileHandler,accessFileHandler,errorFileHandler

 [formatters]
-keys=brokerFormatter,authserviceFormatter,accessFormatter,errorFormatter
+keys=brokerFormatter,accessFormatter,errorFormatter

 [handler_stderrHandler]
 class=StreamHandler
 <at>  <at>  -52,21 +52,6  <at>  <at>  args=('/var/log/x2gobroker/broker.log',)
 format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
 datefmt=

-[logger_authservice]
-level=DEBUG
-handlers=authserviceFileHandler
-qualname=authservice
-propagate=0
-
-[handler_authserviceFileHandler]
-class=FileHandler
-formatter=authserviceFormatter
-args=('/var/log/x2gobroker/authservice.log',)
-
-[formatter_authserviceFormatter]
-format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
-datefmt=
-
 [logger_access]
 level=DEBUG
 handlers=accessFileHandler
diff --git a/logrotate/x2gobroker-authservice b/logrotate/x2gobroker-authservice
new file mode 100644
index 0000000..d19cc13
--- /dev/null
+++ b/logrotate/x2gobroker-authservice
 <at>  <at>  -0,0 +1,13  <at>  <at> 
+/var/log/x2gobroker/authservice.log {
+	weekly
+	missingok
+	rotate 52
+	compress
+	delaycompress
+	notifempty
+	create 640 root adm
+	sharedscripts
+	postrotate
+		invoke-rc.d x2gobroker-authservice restart > /dev/null
+	endscript
+}
diff --git a/logrotate/x2gobroker-daemon b/logrotate/x2gobroker-daemon
new file mode 100644
index 0000000..31da1bd
--- /dev/null
+++ b/logrotate/x2gobroker-daemon
 <at>  <at>  -0,0 +1,13  <at>  <at> 
+/var/log/x2gobroker/access.log /var/log/x2gobroker/broker.log /var/log/x2gobroker/error.log {
+	weekly
+	missingok
+	rotate 52
+	compress
+	delaycompress
+	notifempty
+	create 640 x2gobroker adm
+	sharedscripts
+	postrotate
+		invoke-rc.d x2gobroker-daemon restart > /dev/null
+	endscript
+}
diff --git a/logrotate/x2gobroker b/logrotate/x2gobroker-wsgi
similarity index 57%
rename from logrotate/x2gobroker
rename to logrotate/x2gobroker-wsgi
index 4e8c689..bb040b7 100644
--- a/logrotate/x2gobroker
+++ b/logrotate/x2gobroker-wsgi
 <at>  <at>  -1,4 +1,4  <at>  <at> 
-/var/log/x2gobroker/*.log {
+/var/log/x2gobroker/broker.log /var/log/x2gobroker/error.log /var/log/x2gobroker/wsgi.log {
 	weekly
 	missingok
 	rotate 52
 <at>  <at>  -7,7 +7,5  <at>  <at> 
 	notifempty
 	create 640 x2gobroker adm
 	sharedscripts
-	postrotate
-		/etc/init.d/x2gobroker restart > /dev/null
 	endscript
 }
diff --git a/sbin/x2gobroker-authservice b/sbin/x2gobroker-authservice
index e17271e..5f0bd13 100755
--- a/sbin/x2gobroker-authservice
+++ b/sbin/x2gobroker-authservice
 <at>  <at>  -28,12 +28,10  <at>  <at>  import argparse
 import logging

 try:
-    import x2gobroker.defaults
+    import x2gobroker.authservice
 except ImportError:
     sys.path.insert(0, os.path.join(os.getcwd(), '..'))
-    import x2gobroker.defaults
-
-import x2gobroker.authservice
+    import x2gobroker.authservice

 PROG_NAME = os.path.basename(sys.argv[0])
 PROG_OPTIONS = sys.argv[1:]
 <at>  <at>  -41,20 +39,19  <at>  <at>  setproctitle.setproctitle("%s %s" % (PROG_NAME, " ".join(PROG_OPTIONS)))

 from x2gobroker import __VERSION__
 from x2gobroker import __AUTHOR__
-from x2gobroker.loggers import logger_authservice

 # raise log level to DEBUG if requested...
-if x2gobroker.defaults.X2GOBROKER_DEBUG and not x2gobroker.defaults.X2GOBROKER_TESTSUITE:
-    logger_authservice.setLevel(logging.DEBUG)
+if x2gobroker.authservice.X2GOBROKER_DEBUG and not x2gobroker.authservice.X2GOBROKER_TESTSUITE:
+    x2gobroker.authservice.logger_authservice.setLevel(logging.DEBUG)

-logger_authservice.info('X2Go Session Broker ({version}), written by
{author}'.format(version=__VERSION__, author=__AUTHOR__))
-logger_authservice.info('Setting up the PAM authentication service\'s environment...')
-logger_authservice.info('  X2GOBROKER_DEBUG: {value}'.format(value=x2gobroker.defaults.X2GOBROKER_DEBUG))
-logger_authservice.info('  X2GOBROKER_AUTHSERVICE_SOCKET: {value}'.format(value=x2gobroker.defaults.X2GOBROKER_AUTHSERVICE_SOCKET))
+x2gobroker.authservice.logger_authservice.info('X2Go Session Broker ({version}), written by
{author}'.format(version=__VERSION__, author=__AUTHOR__))
+x2gobroker.authservice.logger_authservice.info('Setting up the PAM authentication service\'s environment...')
+x2gobroker.authservice.logger_authservice.info('  X2GOBROKER_DEBUG: {value}'.format(value=x2gobroker.authservice.X2GOBROKER_DEBUG))
+x2gobroker.authservice.logger_authservice.info('  X2GOBROKER_AUTHSERVICE_SOCKET: {value}'.format(value=x2gobroker.authservice.X2GOBROKER_AUTHSERVICE_SOCKET))

 # check effective UID the broker runs as and complain appropriately...
 if os.geteuid() != 0:
-    logger_authservice.warn('X2Go Session Broker\'s PAM authentication service should run with root
privileges to guarantee proper access to all PAM modules.')
+    x2gobroker.authservice.logger_authservice.warn('X2Go Session Broker\'s PAM authentication
service should run with root privileges to guarantee proper access to all PAM modules.')

 if __name__ == '__main__':

diff --git a/x2gobroker/__init__.py b/x2gobroker/__init__.py
index 5ebaa35..f912e33 100644
--- a/x2gobroker/__init__.py
+++ b/x2gobroker/__init__.py
 <at>  <at>  -20,12 +20,3  <at>  <at> 

 __VERSION__ = '0.0.1.1'
 __AUTHOR__ = 'Mike Gabriel (X2Go Project) <mike.gabriel@...>'
-
-from loggers import logger_error
-
-class X2GoBrokerBaseException(BaseException):
-    def __init__(self, *args, **kwargs):
-        BaseException.__init__(self, *args, **kwargs)
-        logger_error.error('An exceptional problem occurred:
{exception}("{msg}")'.format(exception=type(self).__name__, msg=str(self)))
-
-class X2GoBrokerAgentException(X2GoBrokerBaseException): pass
diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 001a800..35bb6a6 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
 <at>  <at>  -31,6 +31,7  <at>  <at>  x2gobroker._paramiko.monkey_patch_paramiko()

 # X2Go Broker modules
 import x2gobroker.defaults
+import x2gobroker.x2gobroker_exceptions
 from x2gobroker.loggers import logger_broker, logger_error

 
 <at>  <at>  -83,7 +84,7  <at>  <at>  def call_local_broker_agent(username, mode, cmdline_args=[]):
     if result[0].startswith('OK'):
         return [ r for r in result[1:] if r ]

-    raise x2gobroker.X2GoBrokerAgentException('Query to local X2Go Broker Agent failed with no response')
+    raise x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException('Query to local X2Go Broker
Agent failed with no response')

 def call_remote_broker_agent(username, mode, cmdline_args=[], remote_agent=None):
     """\
 <at>  <at>  -135,7 +136,7  <at>  <at>  def call_remote_broker_agent(username, mode, cmdline_args=[], remote_agent=None)
         if result and result[0].startswith('OK'):
             return [ r for r in result[1:] if r ]
     except (paramiko.SSHException, paramiko.AuthenticationException,
paramiko.BadHostKeyException, socket.error):
-        raise x2gobroker.X2GoBrokerAgentException('Query to remote X2Go Broker Agent (user: {user},
hostname: {hostname}, port: {port}) failed'.format(user=remote_username,
hostname=remote_hostname, port=remote_port))
+        raise x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException('Query to remote X2Go Broker
Agent (user: {user}, hostname: {hostname}, port: {port}) failed'.format(user=remote_username,
hostname=remote_hostname, port=remote_port))

 
 def list_sessions(username, query_mode='LOCAL', remote_agent=None):
diff --git a/x2gobroker/authservice.py b/x2gobroker/authservice.py
index bebc2ab..0f97a29 100644
--- a/x2gobroker/authservice.py
+++ b/x2gobroker/authservice.py
 <at>  <at>  -24,22 +24,56  <at>  <at>  import os
 import asyncore
 import pam
 import socket
+import getpass
+import logging
+import logging.config

 from pwd import getpwnam
 from grp import getgrnam

-# set up the broker's environment
-import x2gobroker.defaults
-
-from loggers import logger_authservice
-
-logger_authservice.info('X2Go Session Broker PAM Authentication Service: Setting up the broker\'s environment...')
+# normally this would go into defaults.py, however, we do not want to pull in defaults.py here as that will create
+# unwanted logfiles (access.log, broker.log, error.log) when x2gobroker-authservice is installed as
standalone service
+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
+if os.environ.has_key('X2GOBROKER_DAEMON_USER'):
+    X2GOBROKER_DAEMON_USER=os.environ['X2GOBROKER_DAEMON_USER']
+else:
+    X2GOBROKER_DAEMON_USER="x2gobroker"
+if os.environ.has_key('X2GOBROKER_AUTHSERVICE_LOGCONFIG'):
+    X2GOBROKER_AUTHSERVICE_LOGCONFIG=os.environ['X2GOBROKER_AUTHSERVICE_LOGCONFIG']
+else:
+    X2GOBROKER_AUTHSERVICE_LOGCONFIG="/etc/x2go/broker/x2gobroker-authservice-logger.conf"
 if os.environ.has_key('X2GOBROKER_AUTHSERVICE_SOCKET'):
     X2GOBROKER_AUTHSERVICE_SOCKET=os.environ['X2GOBROKER_AUTHSERVICE_SOCKET']
 else:
     X2GOBROKER_AUTHSERVICE_SOCKET="/run/x2gobroker/x2gobroker-authservice.socket"
-logger_authservice.info('  X2GOBROKER_AUTHSERVICE_SOCKET: {value}'.format(value=X2GOBROKER_AUTHSERVICE_SOCKET))

+# standalone daemon mode (x2gobroker-authservice as daemon) or interactive mode (called from the cmdline)?
+if getpass.getuser() in (X2GOBROKER_DAEMON_USER, 'root'):
+
+    # we run in standalone daemon mode, so let's use the system configuration for logging
+    logging.config.fileConfig(X2GOBROKER_AUTHSERVICE_LOGCONFIG)
+
+    # create authservice logger
+    logger_authservice = logging.getLogger('authservice')
+
+else:
+    logger_root = logging.getLogger()
+    stderr_handler = logging.StreamHandler(sys.stderr)
+    stderr_handler.setFormatter(logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s -
%(message)s', datefmt=''))
+
+    # all loggers stream to stderr...
+    logger_root.addHandler(stderr_handler)
+
+    logger_authservice = logging.getLogger('authservice')
+    logger_authservice.addHandler(stderr_handler)
+    logger_authservice.propagate = 0

 class AuthClient(asyncore.dispatcher_with_send):

diff --git a/x2gobroker/loggers.py b/x2gobroker/loggers.py
index e7eabe0..2d0963c 100644
--- a/x2gobroker/loggers.py
+++ b/x2gobroker/loggers.py
 <at>  <at>  -43,7 +43,6  <at>  <at>  if getpass.getuser() in (X2GOBROKER_DAEMON_USER, 'root'):

     # create loggers
     logger_broker = logging.getLogger('broker')
-    logger_authservice = logging.getLogger('authservice')
     logger_access = logging.getLogger('access')
     logger_error = logging.getLogger('error')

 <at>  <at>  -59,10 +58,6  <at>  <at>  else:
     logger_broker.addHandler(stderr_handler)
     logger_broker.propagate = 0

-    logger_authservice = logging.getLogger('authservice')
-    logger_authservice.addHandler(stderr_handler)
-    logger_authservice.propagate = 0
-
     logger_access = logging.getLogger('access')
     logger_access.addHandler(stderr_handler)
     logger_access.propagate = 0
diff --git a/x2gobroker/__init__.py b/x2gobroker/x2gobroker_exceptions.py
similarity index 92%
copy from x2gobroker/__init__.py
copy to x2gobroker/x2gobroker_exceptions.py
index 5ebaa35..d458419 100644
--- a/x2gobroker/__init__.py
+++ b/x2gobroker/x2gobroker_exceptions.py
 <at>  <at>  -18,9 +18,6  <at>  <at> 
 # Free Software Foundation, Inc.,
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

-__VERSION__ = '0.0.1.1'
-__AUTHOR__ = 'Mike Gabriel (X2Go Project) <mike.gabriel@...>'
-
 from loggers import logger_error

 class X2GoBrokerBaseException(BaseException):

hooks/post-receive

Gmane