--- cloudinit/net/eni.py.orig +++ cloudinit/net/eni.py @@ -81,7 +81,7 @@ def _iface_add_subnet(iface, subnet): if key == "address": value = "%s/%s" % (subnet["address"], subnet["prefix"]) if value and key in valid_map: - if type(value) == list: + if isinstance(value, list): value = " ".join(value) if "_" in key: key = key.replace("_", "-") @@ -126,7 +126,7 @@ def _iface_add_attrs(iface, index, ipv4_ for key, value in iface.items(): # convert bool to string for eni - if type(value) == bool: + if isinstance(value, bool): value = "on" if iface[key] else "off" if not value or key in ignore_map: continue @@ -144,7 +144,7 @@ def _iface_add_attrs(iface, index, ipv4_ for v in value: content.append(" {0} {1}".format(renames.get(key, key), v)) continue - if type(value) == list: + if isinstance(value, list): value = " ".join(value) content.append(" {0} {1}".format(renames.get(key, key), value)) --- cloudinit/net/network_state.py.orig +++ cloudinit/net/network_state.py @@ -559,7 +559,7 @@ class NetworkStateInterpreter(metaclass= # convert value to boolean bridge_stp = iface.get("bridge_stp") - if bridge_stp is not None and type(bridge_stp) != bool: + if bridge_stp is not None and not isinstance(bridge_stp, bool): if bridge_stp in ["on", "1", 1]: bridge_stp = True elif bridge_stp in ["off", "0", 0]: @@ -582,7 +582,7 @@ class NetworkStateInterpreter(metaclass= search = [] if "address" in command: addrs = command["address"] - if not type(addrs) == list: + if not isinstance(addrs, list): addrs = [addrs] for addr in addrs: nameservers.append(addr) --- cloudinit/sources/helpers/netlink.py.orig +++ cloudinit/sources/helpers/netlink.py @@ -137,7 +137,7 @@ def unpack_rta_attr(data, offset): :raises: AssertionError if data is None or offset is not integer. """ assert data is not None, "data is none" - assert type(offset) == int, "offset is not integer" + assert isinstance(offset, int), "offset is not integer" assert ( offset >= RTATTR_START_OFFSET ), "rta offset is less than expected length"