Browse Source

Fix Dns zone.

It is not necessary to specify the zone into the config file

Change-Id: I049a4039aab817024ab40e1b6c5b2b383100653f
tags/0.4.7
Fabio Verboso 8 months ago
parent
commit
d1ebff9034
3 changed files with 9 additions and 15 deletions
  1. 0
    2
      etc/iotronic/iotronic.conf
  2. 1
    1
      iotronic/conductor/endpoints.py
  3. 8
    12
      iotronic/wamp/proxies/nginx.py

+ 0
- 2
etc/iotronic/iotronic.conf View File

@@ -3,8 +3,6 @@ transport_url=rabbit://<user>:<password>@<host>:5672/
3 3
 
4 4
 debug=True
5 5
 proxy=nginx
6
-# dns_zone=openstack.iotronic
7
-
8 6
 
9 7
 # Authentication strategy used by iotronic-api: one of
10 8
 # "keystone" or "noauth". "noauth" should not be used in a

+ 1
- 1
iotronic/conductor/endpoints.py View File

@@ -713,7 +713,7 @@ class ConductorEndpoint(object):
713 713
 
714 714
         cctx = self.wamp_agent_client.prepare(server=board.agent)
715 715
         cctx.call(ctx, 'enable_webservice', board=dns,
716
-                  https_port=https_port, http_port=http_port)
716
+                  https_port=https_port, http_port=http_port, zone=zone)
717 717
         cctx.call(ctx, 'reload_proxy')
718 718
 
719 719
         LOG.debug('Configure Web Proxy on Board %s with dns %s (email: %s) ',

+ 8
- 12
iotronic/wamp/proxies/nginx.py View File

@@ -23,20 +23,17 @@ LOG = logging.getLogger(__name__)
23 23
 nginx_opts = [
24 24
     cfg.StrOpt('nginx_path',
25 25
                default='/etc/nginx/conf.d/iotronic',
26
-               help=('Default Nginx Path')),
27
-    cfg.StrOpt('dns_zone',
28
-               default='openstack.iotronic',
29
-               help=('Default zone')),
26
+               help=('Default Nginx Path'))
30 27
 ]
31 28
 
32 29
 CONF = cfg.CONF
33 30
 CONF.register_opts(nginx_opts, 'nginx')
34 31
 
35 32
 
36
-def save_map(board, dns):
33
+def save_map(board, zone):
37 34
     fp = CONF.nginx.nginx_path + "/maps/map_" + board
38 35
     with open(fp, "w") as text_file:
39
-        text_file.write("~" + board + "." + dns + " " + board + ";")
36
+        text_file.write("~" + board + "." + zone + " " + board + ";")
40 37
 
41 38
 
42 39
 def save_upstream(board, https_port):
@@ -50,7 +47,7 @@ def save_upstream(board, https_port):
50 47
         text_file.write("%s" % string)
51 48
 
52 49
 
53
-def save_server(board, http_port, dns):
50
+def save_server(board, http_port, zone):
54 51
     fp = CONF.nginx.nginx_path + "/servers/" + board
55 52
     string = '''server {{
56 53
     listen              80;
@@ -60,7 +57,7 @@ def save_server(board, http_port, dns):
60 57
         proxy_pass http://localhost:{1};
61 58
     }}
62 59
     }}
63
-    '''.format(board, http_port, dns)
60
+    '''.format(board, http_port, zone)
64 61
 
65 62
     with open(fp, "w") as text_file:
66 63
         text_file.write("%s" % string)
@@ -77,19 +74,18 @@ def remove(board):
77 74
 class ProxyManager(Proxy):
78 75
 
79 76
     def __init__(self):
80
-        self.dns = CONF.nginx.dns_zone
81 77
         super(ProxyManager, self).__init__("nginx")
82 78
 
83 79
     def reload_proxy(self, ctx):
84 80
         call(["nginx", "-s", "reload"])
85 81
 
86
-    def enable_webservice(self, ctx, board, https_port, http_port):
82
+    def enable_webservice(self, ctx, board, https_port, http_port, zone):
87 83
         LOG.debug(
88 84
             'Enabling WebService with ports  %s for http and %s for https '
89 85
             'on board %s', http_port, https_port, board)
90
-        save_map(board, self.dns)
86
+        save_map(board, zone)
91 87
         save_upstream(board, https_port)
92
-        save_server(board, http_port, self.dns)
88
+        save_server(board, http_port, zone)
93 89
 
94 90
     def disable_webservice(self, ctx, board):
95 91
         LOG.debug('Disabling WebService on board %s',

Loading…
Cancel
Save