Browse Source

External interface can be set as a string

Junaid Ali 2 years ago
parent
commit
0c32a4b93f
2 changed files with 7 additions and 21 deletions
  1. 6
    16
      hooks/pg_gw_utils.py
  2. 1
    5
      templates/kilo/ifcs.conf

+ 6
- 16
hooks/pg_gw_utils.py View File

@@ -267,22 +267,12 @@ def get_gw_interfaces():
267 267
     Gateway node can have multiple interfaces. This function parses json
268 268
     provided in config to get all gateway interfaces for this node.
269 269
     '''
270
-    node_interfaces = []
271
-    try:
272
-        all_interfaces = json.loads(config('external-interfaces'))
273
-    except ValueError:
274
-        raise ValueError("Invalid json provided for gateway interfaces")
275
-    hostname = get_unit_hostname()
276
-    if hostname in all_interfaces:
277
-        node_interfaces = all_interfaces[hostname].split(',')
278
-    elif 'DEFAULT' in all_interfaces:
279
-        node_interfaces = all_interfaces['DEFAULT'].split(',')
280
-    for interface in node_interfaces:
281
-        if not interface_exists(interface):
282
-            log('Provided gateway interface %s does not exist'
283
-                % interface)
284
-            raise ValueError('Provided gateway interface does not exist')
285
-    return node_interfaces
270
+    interface = config('external-interfaces')
271
+    if not interface_exists(interface):
272
+        log('Provided gateway interface %s does not exist'
273
+            % interface)
274
+        raise ValueError('Provided gateway interface does not exist')
275
+    return interface
286 276
 
287 277
 
288 278
 def ensure_mtu():

+ 1
- 5
templates/kilo/ifcs.conf View File

@@ -1,7 +1,3 @@
1 1
 {{ fabric_interface }} = fabric_core host
2
-{% if ext_interfaces -%}
3
-{% for ip in ext_interfaces -%}
4
-{{ ip }} = access_phys
5
-{% endfor -%}
6
-{% endif -%}
2
+{{ ext_interfaces }} = access_phys
7 3
 

Loading…
Cancel
Save