From 2617f6bdfe9f0323b21c31a13012972535560e46 Mon Sep 17 00:00:00 2001 From: Daniel Ankers Date: Thu, 4 Jul 2024 14:56:24 +0100 Subject: [PATCH] Cope better with no rack information --- juniper-macros.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/juniper-macros.j2 b/juniper-macros.j2 index 342777e..a8a9b26 100644 --- a/juniper-macros.j2 +++ b/juniper-macros.j2 @@ -250,7 +250,15 @@ interfaces { {% macro snmpsection(device, snmp) %} snmp { +{% if device.rack and device.rack.site %} location "{{ device.rack.site.name }} Rack {{ device.rack.name }}"; +{% elif device.rack and device.site %} + location "{{ device.site.name }} Rack {{ device.rack.name }}"; +{% elif device.site %} + location "{{ device.site.name }}" +{% elif device.rack %} + location "{{ device.rack.name }}" +{% endif %} contact "{{ snmp['contact'] }}"; community {{ snmp['community'] }} { authorization read-only;