Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24924384
D4009.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4009.diff
View Options
diff --git a/_modules/node.py b/_modules/node.py
--- a/_modules/node.py
+++ b/_modules/node.py
@@ -517,14 +517,27 @@
for fhrp in interface.get("fhrp", []):
if fhrp["protocol"] == "carp":
+
+ vhid = fhrp.get("id")
+
+ # ignore invalid CARP entries
+ # when vhid or vip are empty in netbox,
+ # in the pillar configuration we'll see that entry carp fhrp = []
+ if vhid is None:
+ return []
+
# Salt will actually recreate a dictionary, so it won't respect the order
# even with OrderedDict
entry = OrderedDict()
entry["device"] = device
entry["interface_name"] = interface_name
- entry["vhid"] = fhrp["id"]
+ entry["vhid"] = vhid
entry["vip"] = fhrp["vip"]
- entry["advskew"] = fhrp.get("advskew", 0)
+ # peer is not always required, if we work in multicast, we won't have peer
+ peer = fhrp.get("peer")
+ if peer is not None:
+ entry["peer"] = peer
+ entry["advskew"] = fhrp["advskew"]
carp_entries.append(entry)
diff --git a/_tests/data/forests.yaml b/_tests/data/forests.yaml
--- a/_tests/data/forests.yaml
+++ b/_tests/data/forests.yaml
@@ -20,6 +20,7 @@
- protocol: carp
id: 1
vip: 1.2.3.10
+ peer: 1.2.3.5
advskew: 0
intranought:
device: net02
diff --git a/_tests/modules/test_node.py b/_tests/modules/test_node.py
--- a/_tests/modules/test_node.py
+++ b/_tests/modules/test_node.py
@@ -153,6 +153,7 @@
"interface_name": "public",
"vhid": 1,
"vip": "1.2.3.10",
+ "peer": "1.2.3.5",
"advskew": 0,
}
]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 19, 20:55 (3 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3545780
Default Alt Text
D4009.diff (1 KB)
Attached To
Mode
D4009: Read the CARP peer parameter from pillar
Attached
Detach File
Event Timeline
Log In to Comment