We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfe7ed7 commit 0317087Copy full SHA for 0317087
templates/octaviaamphoracontroller/bin/setipalias.py
@@ -2,6 +2,7 @@
2
import sys
3
import os
4
import ipaddress
5
+import netifaces
6
from pyroute2 import IPRoute
7
8
try:
@@ -34,9 +35,10 @@
34
35
ipaddr = ipfile.read()
36
ipfile.close()
37
if ipaddr:
- current_addresses = ip.get_addr(label=interface_name)
38
- # TODO(beagles): check IPv6, IIUC the library will do some translation of
39
- # mask but it might not be what we want.
+ # Get our current addresses so we can avoid trying to set the
+ # same address again.
40
+ ifaceinfo = netifaces.ifaddresses(interface_name)[netifaces.AF_INET]
41
+ current_addresses = [x['addr'] for x in ifaceinfo]
42
if ipaddr not in current_addresses:
43
mask_value = 32
44
if ipaddress.ip_address(ipaddr).version == 6:
0 commit comments