if nic_slot and nic_ports:
dmidecode = subprocess.check_output(['dmidecode', '-t', 'slot'])
- regex = r"(?<=SlotID:%s).*?(....:..:..\..)" % nic_slot
- match = re.search(regex, dmidecode, flags=re.DOTALL)
+ regex = r"(?<=SlotID:{}).*?(....:..:..\..)".format(nic_slot)
+ match = re.search(regex, dmidecode.decode('utf-8'), flags=re.DOTALL)
if not match:
return None
devices = ''
for driver in ['i40e', 'ixgbe']:
- matches = re.findall(regex.format(hx=hx, driver=driver), devices)
+ matches = re.findall(regex.format(hx=hx, driver=driver), devices.decode("utf-8"))
if not matches:
continue
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
intf_info, _ = process.communicate()
- if not re.search('team_slave|bond_slave', intf_info):
+ if not re.search('team_slave|bond_slave', intf_info.decode("utf-8")):
pcis.append(port[1])
-
if len(pcis) == 2:
break