diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-11-07 21:01:52 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-11-07 21:01:52 +0100 |
commit | f0ba03a2319f1c2ac9346494dc03696684722d4e (patch) | |
tree | c6e9cc5d10fc43e1debfcd7dceea3f08164757fc /templating | |
parent | 1645bca3aed66c2121fe6d8aaeea8405906723e2 (diff) |
Fill up switches.txt template
Diffstat (limited to 'templating')
-rw-r--r-- | templating/templates/switches.txt | 7 | ||||
-rwxr-xr-x | templating/templating.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/templating/templates/switches.txt b/templating/templates/switches.txt index 957df02..0cc203b 100644 --- a/templating/templates/switches.txt +++ b/templating/templates/switches.txt @@ -1,2 +1,7 @@ -{% for switch in objects["public/switches"].switches %}Switch {{ switch }}: {{ objects["read/switches-management"].switches[switch].mgmt_v4_addr }} +{% for switch in objects["public/switches"].switches %} + {% set mg = objects["read/switches-management"].switches[switch] %} + {% set s = objects["public/switches"].switches[switch] %} + {% if mg.subnet4 -%} + {{ switch }} {{mg.subnet4 }} {{ mg.subnet6 }} {{ mg.mgmt_v4_addr }} {{ mg.mgmt_v6_addr }} {{ mg.traffic_vlan }} {{ s.distro_name }} + {% endif %} {% endfor %} diff --git a/templating/templating.py b/templating/templating.py index 2c1259a..5144b89 100755 --- a/templating/templating.py +++ b/templating/templating.py @@ -17,7 +17,7 @@ def updateData(): for a in endpoints: objects[a] = getEndpoint(a) -env = Environment(loader=FileSystemLoader(['templates/','/opt/gondul/templating/templates'])) +env = Environment(loader=FileSystemLoader(['templates/','/opt/gondul/templating/templates']),lstrip_blocks=True, trim_blocks=True) import http.server class MyHandler(http.server.BaseHTTPRequestHandler): |