~dpb/tarmac/backout-409-allow-all-branches

« back to all changes in this revision

Viewing changes to bin/tarmac-web

  • Committer: Tarmac Traffic Controller
  • Author(s): Rodney Dawes
  • Date: 2014-01-09 21:42:57 UTC
  • mfrom: (424.1.1 drop-web)
  • Revision ID: tarmac_traffic_controller-20140109214257-0otunzg8gwo9j755
Drop the tarmac-web interface as it doesn't work and Jenkins is much better.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# This file is part of Tarmac.
3
 
#
4
 
# Tarmac is free software: you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License version 3 as
6
 
# published by
7
 
# the Free Software Foundation.
8
 
#
9
 
# Tarmac is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
16
 
#
17
 
# Copyright 2009 Elliot Murphy
18
 
"""Simple WSGI web application for showing the current Tarmac status."""
19
 
 
20
 
import sys
21
 
import subprocess
22
 
from tarmac.config import TarmacConfig
23
 
import web
24
 
 
25
 
urls = (
26
 
    '/', 'index'
27
 
)
28
 
 
29
 
render = web.template.render('templates/')
30
 
 
31
 
class index(object):
32
 
    """The main page of the status site."""
33
 
 
34
 
    def __init__(self):
35
 
        config = TarmacConfig()
36
 
        self.statusfile = config.get('Tarmac', 'log_file')
37
 
 
38
 
    def GET(self):
39
 
        tail = subprocess.Popen(('tail', '-n40', self.statusfile),
40
 
            stdout = subprocess.PIPE,
41
 
            stderr = subprocess.PIPE)
42
 
        output, errput = tail.communicate()
43
 
        return render.index(output, errput)
44
 
 
45
 
 
46
 
def main():
47
 
    if len(sys.argv) != 3:
48
 
        print "Please specify a port number and a project name: ./webui.py 8080 default"
49
 
        return 1
50
 
    app = web.application(urls, globals())
51
 
    return app.run()
52
 
 
53
 
 
54
 
if __name__ == "__main__":
55
 
    sys.exit(main())