diff --git a/cloud-init-flake8-fixes.patch b/cloud-init-flake8-fixes.patch new file mode 100644 index 0000000..052cc0f --- /dev/null +++ b/cloud-init-flake8-fixes.patch @@ -0,0 +1,60 @@ +--- 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" diff --git a/cloud-init.changes b/cloud-init.changes index cffc404..b0eddc3 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Aug 14 12:05:01 UTC 2023 - Robert Schweikert + +- Add cloud-init-flake8-fixes.patch + ------------------------------------------------------------------- Thu Jul 6 12:06:22 UTC 2023 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index 2f43852..78b5450 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -41,6 +41,8 @@ Patch6: cloud-init-write-routes.patch Patch7: cloud-init-cve-2023-1786-redact-instance-data-json-main.patch # FIXME https://github.com/canonical/cloud-init/pull/2148 Patch8: cloud-init-power-rhel-only.patch +# FIXME https://github.com/canonical/cloud-init/pull/4340 +Patch9: cloud-init-flake8-fixes.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -148,6 +150,7 @@ Documentation and examples for cloud-init tools %patch6 %patch7 %patch8 +%patch9 # patch in the full version to version.py version_pys=$(find . -name version.py -type f)