Skip to content

Commit c6ce9cc

Browse files
Drop addresses key from ACL if None
1 parent 4e590c1 commit c6ce9cc

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

linode_api4/objects/lke.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Region,
1515
Type,
1616
)
17+
from linode_api4.util import drop_null_keys
1718

1819

1920
class LKEType(Base):
@@ -574,7 +575,7 @@ def control_plane_acl_update(
574575
result = self._client.put(
575576
f"{LKECluster.api_endpoint}/control_plane_acl",
576577
model=self,
577-
data={"acl": acl},
578+
data={"acl": drop_null_keys(acl)},
578579
)
579580

580581
acl = result.get("acl")

test/unit/objects/lke_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,18 @@ def test_populate_with_mixed_types(self):
498498
assert self.pool.nodes[0].id == "node7"
499499
assert self.pool.nodes[1].id == "node8"
500500
assert self.pool.nodes[2].id == "node9"
501+
502+
def test_cluster_update_null_addresses(self):
503+
cluster = LKECluster(self.client, 18881)
504+
505+
with self.mock_put("lke/clusters/18881/control_plane_acl") as m:
506+
cluster.control_plane_acl_update(
507+
LKEClusterControlPlaneACLOptions(
508+
enabled=True,
509+
addresses=None,
510+
)
511+
)
512+
513+
# Addresses should not be included in the API request if it's null
514+
# See: TPT-3489
515+
assert m.call_data == {"acl": {"enabled": True}}

0 commit comments

Comments
 (0)