Describe the bug
Two crashes in purefa_network's update_interface() on freshly-provisioned interfaces, both instances of the pydantic model raising when a declared field is unset. Both hit after PR #1014 landed in everpure.flasharray 1.44.0. Under Mitogen they surface as Module result deserialization failed: No start of json char found.
Bug 1 — raw interface.eth.gateway access at line 383
if not module.params["gateway"] and interface.eth.gateway not in [
None,
IPNetwork(module.params["address"]),
]:
On an interface with no gateway configured (typical for iSCSI ports on a flat L2 SAN), interface.eth.gateway is None. The generated pydantic model raises AttributeError in that case rather than returning None (network_interface_eth_v_2_4.py:101). The current_state dict just above (lines 344-346) already reads gateway/address/netmask via getattr(interface.eth, ..., None) — line 383 is the one that was missed.
Traceback:
File ".../purefa_network.py", line 383, in update_interface
File ".../pypureclient/flasharray/_common/models/network_interface_eth_v_2_4.py", line 101, in __getattribute__
raise AttributeError
AttributeError
Bug 2 — no or [] guard on interface.eth.subinterfaces
Two spots, both introduced/left by PR #1014:
- Line 227 (
_check_subinterfaces()): [0].eth.subinterfaces → TypeError: 'NoneType' object is not iterable when the interface has no subinterfaces (plain physical ports).
- Line 349 (
current_state["subinterfaces"]): sorted(sub.name for sub in interface.eth.subinterfaces) — same failure mode.
interface.eth.subinterfaces is declared Optional[conlist(FixedReferenceNoId)] with default=None, so None is a legitimate value the SDK returns for interfaces without any children.
To Reproduce
- Install
everpure.flasharray==1.44.0 with py-pure-client==1.88.0.
- Run
purefa_network against any freshly-provisioned eth port that has no gateway or no subinterfaces — e.g. an iSCSI interface being brought up with address/mtu/servicelist but no gateway.
Expected behavior
Same as before the pydantic-strict schema landed: unset fields read as None, module treats them as such.
Suggested fix
Bug 1 — swap the raw access for getattr(..., None):
if not module.params["gateway"] and getattr(interface.eth, "gateway", None) not in [
None,
IPNetwork(module.params["address"]),
]:
Bug 2 — add or [] at both sites:
# _check_subinterfaces()
subinterfaces = list(
array.get_network_interfaces(names=[module.params["name"]]).items
)[0].eth.subinterfaces or []
# update_interface() current_state
"subinterfaces": sorted(sub.name for sub in (interface.eth.subinterfaces or [])),
Happy to open a PR.
Environment
- everpure.flasharray 1.44.0 · py-pure-client 1.88.0 · ansible-core 2.18 · Python 3.13 · Mitogen
Additional context
Follow-up to #1013 / PR #1014. The or [] gap was flagged during PR review; the line-383 issue is a distinct regression from the same eth-schema migration series (bcc1643, 083ce5c) that only got half-fixed.
Describe the bug
Two crashes in
purefa_network'supdate_interface()on freshly-provisioned interfaces, both instances of the pydantic model raising when a declared field is unset. Both hit after PR #1014 landed ineverpure.flasharray1.44.0. Under Mitogen they surface asModule result deserialization failed: No start of json char found.Bug 1 — raw
interface.eth.gatewayaccess at line 383On an interface with no gateway configured (typical for iSCSI ports on a flat L2 SAN),
interface.eth.gatewayisNone. The generated pydantic model raisesAttributeErrorin that case rather than returningNone(network_interface_eth_v_2_4.py:101). Thecurrent_statedict just above (lines 344-346) already readsgateway/address/netmaskviagetattr(interface.eth, ..., None)— line 383 is the one that was missed.Traceback:
Bug 2 — no
or []guard oninterface.eth.subinterfacesTwo spots, both introduced/left by PR #1014:
_check_subinterfaces()):[0].eth.subinterfaces→TypeError: 'NoneType' object is not iterablewhen the interface has no subinterfaces (plain physical ports).current_state["subinterfaces"]):sorted(sub.name for sub in interface.eth.subinterfaces)— same failure mode.interface.eth.subinterfacesis declaredOptional[conlist(FixedReferenceNoId)]withdefault=None, soNoneis a legitimate value the SDK returns for interfaces without any children.To Reproduce
everpure.flasharray==1.44.0withpy-pure-client==1.88.0.purefa_networkagainst any freshly-provisioned eth port that has no gateway or no subinterfaces — e.g. an iSCSI interface being brought up withaddress/mtu/servicelistbut nogateway.Expected behavior
Same as before the pydantic-strict schema landed: unset fields read as
None, module treats them as such.Suggested fix
Bug 1 — swap the raw access for
getattr(..., None):Bug 2 — add
or []at both sites:Happy to open a PR.
Environment
Additional context
Follow-up to #1013 / PR #1014. The
or []gap was flagged during PR review; the line-383 issue is a distinct regression from the same eth-schema migration series (bcc1643,083ce5c) that only got half-fixed.