From d1ebff90342e2dfee677b68b60e503109edb7b03 Mon Sep 17 00:00:00 2001 From: Fabio Verboso Date: Mon, 10 Dec 2018 17:22:59 +0100 Subject: [PATCH] Fix Dns zone. It is not necessary to specify the zone into the config file Change-Id: I049a4039aab817024ab40e1b6c5b2b383100653f --- etc/iotronic/iotronic.conf | 2 -- iotronic/conductor/endpoints.py | 2 +- iotronic/wamp/proxies/nginx.py | 20 ++++++++------------ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/etc/iotronic/iotronic.conf b/etc/iotronic/iotronic.conf index 7dd9b46..66256a9 100644 --- a/etc/iotronic/iotronic.conf +++ b/etc/iotronic/iotronic.conf @@ -3,8 +3,6 @@ transport_url=rabbit://:@:5672/ debug=True proxy=nginx -# dns_zone=openstack.iotronic - # Authentication strategy used by iotronic-api: one of # "keystone" or "noauth". "noauth" should not be used in a diff --git a/iotronic/conductor/endpoints.py b/iotronic/conductor/endpoints.py index 763b8e2..8602dab 100644 --- a/iotronic/conductor/endpoints.py +++ b/iotronic/conductor/endpoints.py @@ -713,7 +713,7 @@ class ConductorEndpoint(object): cctx = self.wamp_agent_client.prepare(server=board.agent) cctx.call(ctx, 'enable_webservice', board=dns, - https_port=https_port, http_port=http_port) + https_port=https_port, http_port=http_port, zone=zone) cctx.call(ctx, 'reload_proxy') LOG.debug('Configure Web Proxy on Board %s with dns %s (email: %s) ', diff --git a/iotronic/wamp/proxies/nginx.py b/iotronic/wamp/proxies/nginx.py index 6ec71bf..b8ac651 100644 --- a/iotronic/wamp/proxies/nginx.py +++ b/iotronic/wamp/proxies/nginx.py @@ -23,20 +23,17 @@ LOG = logging.getLogger(__name__) nginx_opts = [ cfg.StrOpt('nginx_path', default='/etc/nginx/conf.d/iotronic', - help=('Default Nginx Path')), - cfg.StrOpt('dns_zone', - default='openstack.iotronic', - help=('Default zone')), + help=('Default Nginx Path')) ] CONF = cfg.CONF CONF.register_opts(nginx_opts, 'nginx') -def save_map(board, dns): +def save_map(board, zone): fp = CONF.nginx.nginx_path + "/maps/map_" + board with open(fp, "w") as text_file: - text_file.write("~" + board + "." + dns + " " + board + ";") + text_file.write("~" + board + "." + zone + " " + board + ";") def save_upstream(board, https_port): @@ -50,7 +47,7 @@ def save_upstream(board, https_port): text_file.write("%s" % string) -def save_server(board, http_port, dns): +def save_server(board, http_port, zone): fp = CONF.nginx.nginx_path + "/servers/" + board string = '''server {{ listen 80; @@ -60,7 +57,7 @@ def save_server(board, http_port, dns): proxy_pass http://localhost:{1}; }} }} - '''.format(board, http_port, dns) + '''.format(board, http_port, zone) with open(fp, "w") as text_file: text_file.write("%s" % string) @@ -77,19 +74,18 @@ def remove(board): class ProxyManager(Proxy): def __init__(self): - self.dns = CONF.nginx.dns_zone super(ProxyManager, self).__init__("nginx") def reload_proxy(self, ctx): call(["nginx", "-s", "reload"]) - def enable_webservice(self, ctx, board, https_port, http_port): + def enable_webservice(self, ctx, board, https_port, http_port, zone): LOG.debug( 'Enabling WebService with ports %s for http and %s for https ' 'on board %s', http_port, https_port, board) - save_map(board, self.dns) + save_map(board, zone) save_upstream(board, https_port) - save_server(board, http_port, self.dns) + save_server(board, http_port, zone) def disable_webservice(self, ctx, board): LOG.debug('Disabling WebService on board %s',