]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Metadata: Add bind_host to the config
authorAngus Salkeld <asalkeld@redhat.com>
Mon, 7 May 2012 08:25:03 +0000 (18:25 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Mon, 7 May 2012 08:25:03 +0000 (18:25 +1000)
This needs to be set to the nova interface to work.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
bin/heat-metadata
heat/common/config.py

index 701a7ec566cff6ccf6adbddff0f8107890e08983..985e0e32213c2edf0481111813c26d6762ef2fe6 100755 (executable)
@@ -39,13 +39,11 @@ from heat.common import config
 from heat.common import wsgi
 from heat import context
 from paste import httpserver
-from socket import gethostbyname, gethostname
 
 LOG = logging.getLogger('heat.metadata')
 
 
-def send_address_to_engine(port):
-    host = gethostbyname(gethostname())
+def send_address_to_engine(host, port):
     con = context.get_admin_context()
     resp = rpc.call(con, 'engine',
                     {'method': 'metadata_register_address',
@@ -63,8 +61,9 @@ if __name__ == '__main__':
         app = config.load_paste_app(conf)
 
         port = conf.bind_port
-        send_address_to_engine(port)
-        LOG.info(('Starting Heat Metadata on port %s') % port)
-        httpserver.serve(app, port=port)
+        host = conf.bind_host
+        send_address_to_engine(host, port)
+        LOG.info(('Starting Heat Metadata on %s:%s') % (host, port))
+        httpserver.serve(app, host=host, port=port)
     except RuntimeError, e:
         sys.exit("ERROR: %s" % e)
index 2d26e53e1ce6bfcb29287101c637365692d10cbf..0902a676845bba4843d4d91f4f89c79a17b3eeb4 100644 (file)
@@ -148,7 +148,8 @@ class HeatMetadataConfigOpts(cfg.CommonConfigOpts):
             version='%%prog %s' % version.version_string(),
             default_config_files=default_config_files,
             **kwargs)
-        opts = [cfg.IntOpt('bind_port', default=8000)]
+        opts = [cfg.IntOpt('bind_port', default=8000),
+                cfg.StrOpt('bind_host', default='127.0.0.1')]
         opts.extend(rpc_opts)
         self.register_cli_opts(opts)