~gary/charms/oneiric/buildbot-slave/run-as-buildbot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python

# Copyright 2012 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# A little python script to open a port on the buildslave so that we can
# test that it's actually deployed successfully.

import subprocess
import SimpleHTTPServer
import SocketServer

PORT = 9000

simple_html = """
<html>
    <head>
        <title>Here's some HTML</title>
    </head>
    <body><p>The slave is UP!</p></body>
</html>
"""

with open('/tmp/index.html', 'w') as index_file:
    index_file.write(simple_html)

subprocess.call(['open-port', '9000/TCP'])
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
#httpd.serve_forever()
print "HERE I AM!!!"