Add trac cgi-bin files to puppet.

(imported from commit c9cdba17d0091996f1d44d404a42c400d27bd84d)
This commit is contained in:
Tim Abbott 2013-10-04 13:53:32 -04:00 committed by Steve Howell
parent b8b0eb4508
commit 6920ba0ac3
4 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,49 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Jonas Borgström <jonas@edgewall.com>
try:
import os
import pkg_resources
if 'TRAC_ENV' not in os.environ and \
'TRAC_ENV_PARENT_DIR' not in os.environ:
os.environ['TRAC_ENV'] = '/home/zulip/trac'
if 'PYTHON_EGG_CACHE' not in os.environ:
if 'TRAC_ENV' in os.environ:
egg_cache = os.path.join(os.environ['TRAC_ENV'], '.egg-cache')
elif 'TRAC_ENV_PARENT_DIR' in os.environ:
egg_cache = os.path.join(os.environ['TRAC_ENV_PARENT_DIR'],
'.egg-cache')
pkg_resources.set_extraction_path(egg_cache)
from trac.web import cgi_frontend
cgi_frontend.run()
except SystemExit:
raise
except Exception, e:
import sys
import traceback
print>>sys.stderr, e
traceback.print_exc(file=sys.stderr)
print 'Status: 500 Internal Server Error'
print 'Content-Type: text/plain'
print
print 'Oops...'
print
print 'Trac detected an internal error:', e
print
traceback.print_exc(file=sys.stdout)

View File

@ -0,0 +1,47 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Jonas Borgström <jonas@edgewall.com>
try:
import os
import pkg_resources
if 'TRAC_ENV' not in os.environ and \
'TRAC_ENV_PARENT_DIR' not in os.environ:
os.environ['TRAC_ENV'] = '/home/zulip/trac'
if 'PYTHON_EGG_CACHE' not in os.environ:
if 'TRAC_ENV' in os.environ:
egg_cache = os.path.join(os.environ['TRAC_ENV'], '.egg-cache')
elif 'TRAC_ENV_PARENT_DIR' in os.environ:
egg_cache = os.path.join(os.environ['TRAC_ENV_PARENT_DIR'],
'.egg-cache')
pkg_resources.set_extraction_path(egg_cache)
from trac.web import fcgi_frontend
fcgi_frontend.run()
except SystemExit:
raise
except Exception, e:
print 'Content-Type: text/plain\r\n\r\n',
print 'Oops...'
print
print 'Trac detected an internal error:'
print
print e
print
import traceback
import StringIO
tb = StringIO.StringIO()
traceback.print_exc(file=tb)
print tb.getvalue()

View File

@ -0,0 +1,31 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C)2008-2009 Edgewall Software
# Copyright (C) 2008 Noah Kantrowitz <noah@coderanger.net>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Noah Kantrowitz <noah@coderanger.net>
import os
def application(environ, start_request):
if not 'trac.env_parent_dir' in environ:
environ.setdefault('trac.env_path', '/home/zulip/trac')
if 'PYTHON_EGG_CACHE' in environ:
os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
elif 'trac.env_path' in environ:
os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_path'], '.egg-cache')
elif 'trac.env_parent_dir' in environ:
os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
from trac.web.main import dispatch_request
return dispatch_request(environ, start_request)

View File

@ -19,6 +19,13 @@ class zulip::trac {
source => "puppet:///modules/zulip/trac.ini",
require => User['humbug'],
}
file { "/home/zulip/trac/cgi-bin/":
recurse => true,
owner => "humbug",
group => "humbug",
mode => 644,
source => "puppet:///modules/zulip/trac/cgi-bin/",
}
file { '/home/zulip/trac/plugins/zulip_trac.py':
ensure => 'link',
target => '/home/zulip/zulip/api/integrations/trac/zulip_trac.py',