Commit af9ed869 authored by Srikanth Raju's avatar Srikanth Raju Committed by Leigh B Stoller
Browse files

Use IP of boss in meta server

Ignore Metadata version
parent 39ed8ed6
...@@ -23,13 +23,14 @@ class Ec2MetaHandler(BaseHTTPRequestHandler): ...@@ -23,13 +23,14 @@ class Ec2MetaHandler(BaseHTTPRequestHandler):
while 1: while 1:
only_path,folder=os.path.split(only_path) only_path,folder=os.path.split(only_path)
if folder != "": if folder != "":
folders.append(folder) folders.append(folder)
if only_path=="/": if only_path=="/":
break; break;
if len(folders) > 0:
folders.pop() #Ignore version
folders.reverse() folders.reverse()
print folders
try: try:
message = self.handle_req(folders, self.metas) message = self.handle_req(folders, self.metas)
...@@ -178,24 +179,24 @@ class Ec2MetaHandler(BaseHTTPRequestHandler): ...@@ -178,24 +179,24 @@ class Ec2MetaHandler(BaseHTTPRequestHandler):
return key[0] return key[0]
metas = { metas = {
"latest" : { "meta-data" : {
"meta-data" : { "placement" : {"availability-zone" : doavail},
"placement" : {"availability-zone" : doavail}, "ami-id": doamiid,
"ami-id": doamiid, "local-hostname" : dolocal_hostname,
"local-hostname" : dolocal_hostname, "public-hostname":dolocal_hostname,
"public-hostname":dolocal_hostname, "network": {"interfaces": {"macs" : domacs}},
"network": {"interfaces": {"macs" : domacs}}, "mac":domac,
"mac":domac, "instance-id":doinstance_id,
"instance-id":doinstance_id, "public-keys": dopublic_keys },
"public-keys": dopublic_keys }, "user-data" : do_userdata
"user-data" : do_userdata
}
} }
if __name__ == '__main__': if __name__ == '__main__':
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
server = HTTPServer(('155.98.36.155', 8787), Ec2MetaHandler) import socket
server = HTTPServer((socket.gethostbyname(socket.gethostname()), 8787), Ec2MetaHandler)
print 'Starting server, use <Ctrl-C> to stop' print 'Starting server, use <Ctrl-C> to stop'
server.serve_forever() server.serve_forever()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment