File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -77,20 +77,24 @@ def observer(self) -> IPv4Address:
77
77
def _get_network (self ) -> docker .models .networks .Network :
78
78
"""Get supervisor network."""
79
79
try :
80
- return self .docker .networks .get (DOCKER_NETWORK )
80
+ if (network := self .docker .networks .get (DOCKER_NETWORK ))["EnableIPv6" ]:
81
+ return network
82
+ network .remove ()
83
+ _LOGGER .info ("Migrating Supervisor network to IPv4/IPv6 Dual Stack" )
81
84
except docker .errors .NotFound :
82
85
_LOGGER .info ("Can't find Supervisor network, creating a new network" )
83
86
84
- ip6am_pool = docker .types .IPAMPool (subnet = str (DOCKER_IPV6_NETWORK_MASK ))
85
-
86
- ip4am_pool = docker .types .IPAMPool (
87
- subnet = str (DOCKER_IPV4_NETWORK_MASK ),
88
- gateway = str (self .gateway ),
89
- iprange = str (DOCKER_IPV4_NETWORK_RANGE ),
87
+ ipam_config = docker .types .IPAMConfig (
88
+ pool_configs = [
89
+ docker .types .IPAMPool (subnet = str (DOCKER_IPV6_NETWORK_MASK )),
90
+ docker .types .IPAMPool (
91
+ subnet = str (DOCKER_IPV4_NETWORK_MASK ),
92
+ gateway = str (self .gateway ),
93
+ iprange = str (DOCKER_IPV4_NETWORK_RANGE ),
94
+ ),
95
+ ]
90
96
)
91
97
92
- ipam_config = docker .types .IPAMConfig (pool_configs = [ip6am_pool , ip4am_pool ])
93
-
94
98
return self .docker .networks .create (
95
99
DOCKER_NETWORK ,
96
100
driver = "bridge" ,
You can’t perform that action at this time.
0 commit comments