summaryrefslogtreecommitdiff
path: root/common/scripts/kvm-cloud/wait-ip.py
diff options
context:
space:
mode:
Diffstat (limited to 'common/scripts/kvm-cloud/wait-ip.py')
-rwxr-xr-xcommon/scripts/kvm-cloud/wait-ip.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/common/scripts/kvm-cloud/wait-ip.py b/common/scripts/kvm-cloud/wait-ip.py
new file mode 100755
index 0000000..392fc8c
--- /dev/null
+++ b/common/scripts/kvm-cloud/wait-ip.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+# Wait for a HTTP post and echo the IP of the first visitor
+
+from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+
+class MyHandler(BaseHTTPRequestHandler):
+ def returnIP(self):
+ self.send_response(200)
+ self.end_headers()
+ print self.client_address[0]
+ return
+
+ def log_message(self, format, *args):
+ return
+
+ def do_POST(self):
+ self.returnIP()
+
+ def do_GET(self):
+ self.returnIP()
+
+server = HTTPServer(('', 8080), MyHandler)
+server.handle_request()
+