Fix Dns zone.
It is not necessary to specify the zone into the config file Change-Id: I049a4039aab817024ab40e1b6c5b2b383100653f
This commit is contained in:
parent
5a373e7941
commit
d1ebff9034
@ -3,8 +3,6 @@ transport_url=rabbit://<user>:<password>@<host>: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
|
||||
|
@ -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) ',
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user