~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead

  • Committer: John Arbash Meinel
  • Date: 2010-05-10 19:36:37 UTC
  • mto: This revision was merged to the branch mainline in revision 419.
  • Revision ID: john@arbash-meinel.com-20100510193637-4vmxsw7ha5wz0pi2
Allow running the loggerhead test suite using 'bzr selftest'

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
# along with this program; if not, write to the Free Software
14
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
15
 
16
 
"""A script for starting the loggerhead process."""
 
16
"""
 
17
WARNING! This script has been deprecated and will go away soon!
 
18
A script for starting the loggerhead process.
 
19
"""
17
20
 
18
21
 
19
22
import logging
20
 
import logging.handlers
21
23
from optparse import OptionParser
22
24
import os
23
25
import sys
24
26
import urlparse
25
27
 
26
 
from configobj import ConfigObj
 
28
from bzrlib.plugin import load_plugins
 
29
from bzrlib.util.configobj.configobj import ConfigObj
27
30
 
28
31
from paste import httpserver
29
32
from paste.httpexceptions import make_middleware
31
34
 
32
35
from loggerhead import daemon
33
36
from loggerhead.apps.config import Root
34
 
from loggerhead.trace import make_handler, setup_logging
 
37
from loggerhead.trace import setup_logging
35
38
from loggerhead.apps.error import ErrorHandlerApp
36
39
 
37
40
 
38
41
def main():
 
42
    sys.stderr.write('\n\n')
 
43
    sys.stderr.write('WARNING!!! This script has been deprecated by '
 
44
                     'serve-branches, and will be removed in the next '
 
45
                     'release. Please migrate to serve-branches and report '
 
46
                     'any missing features.\n')
 
47
    sys.stderr.write('\n\n')
 
48
 
39
49
    home = os.path.realpath(os.path.dirname(__file__))
40
50
    default_pidfile = os.path.join(home, 'loggerhead.pid')
41
51
    default_configfile = os.path.join(home, 'loggerhead.conf')
92
102
    if not options.foreground:
93
103
        sys.stderr.write('\n')
94
104
        sys.stderr.write('Launching loggerhead into the background.\n')
95
 
        sys.stderr.write('PID file: %s\n' % options.pidfile)
 
105
        sys.stderr.write('PID file: %s\n' % (options.pidfile,))
96
106
        sys.stderr.write('\n')
97
107
 
98
108
        daemon.daemonize(options.pidfile, home)
115
125
        def app(environ, start_response, orig=app):
116
126
            environ['SCRIPT_NAME'] = path
117
127
            environ['HTTP_HOST'] = netloc
 
128
            environ['wsgi.url_scheme'] = scheme
118
129
            return orig(environ, start_response)
119
130
 
 
131
    load_plugins()
 
132
 
120
133
    try:
121
134
        httpserver.serve(
122
135
            app, host=server_host, port=server_port,