Skip to content

Commit 5b12113

Browse files
authored
Merge pull request #1454 from kernelkit/add-migrate-script
Add migration script for confd: prevent IP addresses on bridge ports
2 parents 349a89b + 1659ca2 commit 5b12113

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
# Remove ietf-ip:ipv4 and ietf-ip:ipv6 from bridge port interfaces.
3+
# Bridge ports should not have IP addresses; the IP address should
4+
# be configured on the bridge interface itself.
5+
file=$1
6+
temp=${file}.tmp
7+
8+
jq '
9+
if .["ietf-interfaces:interfaces"]?.interface then
10+
.["ietf-interfaces:interfaces"].interface |= map(
11+
if .["infix-interfaces:bridge-port"] and .type != "infix-if-type:bridge" then
12+
del(.["ietf-ip:ipv4"], .["ietf-ip:ipv6"])
13+
else
14+
.
15+
end
16+
)
17+
else
18+
.
19+
end
20+
' "$file" > "$temp" && mv "$temp" "$file"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
migratedir = $(pkgdatadir)/migrate/1.6
22
dist_migrate_DATA = 10-dhcp-client-to-ipv4.sh \
33
20-autoconf-to-presence.sh \
4-
30-ospf-backbone-area-type.sh
4+
30-ospf-backbone-area-type.sh \
5+
40-bridge-port-remove-ip.sh

0 commit comments

Comments
 (0)