diff --git a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient index 6375fdc3..7fb58679 100644 --- a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient @@ -96,14 +96,20 @@ def scan_confluents(): if addr[0] == socket.AF_INET6: if addr[-1] in doneidxs: continue - s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1]) + try: + s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1]) + except TypeError: + s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1].tobytes()) try: s6.sendto(msg, ('ff02::c', 1900)) except OSError: pass doneidxs.add(addr[-1]) elif addr[0] == socket.AF_INET: - s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1]) + try: + s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1]) + except TypeError: + s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1].tobytes()) try: s4.sendto(msg, ('239.255.255.250', 1900)) except OSError: diff --git a/confluent_osdeploy/common/profile/scripts/confignet b/confluent_osdeploy/common/profile/scripts/confignet index b8b2d29a..e868a4c4 100644 --- a/confluent_osdeploy/common/profile/scripts/confignet +++ b/confluent_osdeploy/common/profile/scripts/confignet @@ -8,11 +8,17 @@ import sys import time import shlex import subprocess -from importlib.machinery import SourceFileLoader try: - apiclient = SourceFileLoader('apiclient', '/opt/confluent/bin/apiclient').load_module() -except FileNotFoundError: - apiclient = SourceFileLoader('apiclient', '/etc/confluent/apiclient').load_module() + from importlib.machinery import SourceFileLoader + def load_source(mod, path): + return SourceFileLoader(mod, path).load_module() +except ImportError: + from imp import load_source + +try: + apiclient = load_source('apiclient', '/opt/confluent/bin/apiclient') +except IOError: + apiclient = load_source('apiclient', '/etc/confluent/apiclient') def add_lla(iface, mac): pieces = mac.split(':')