Skip to content

Commit 330bc36

Browse files
Fix create
1 parent c6ce9cc commit 330bc36

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

linode_api4/groups/lke.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def cluster_create(
131131

132132
result = self.client.post(
133133
"/lke/clusters",
134-
data=_flatten_request_body_recursive(drop_null_keys(params)),
134+
data=drop_null_keys(_flatten_request_body_recursive(params)),
135135
)
136136

137137
if "id" not in result:

test/integration/models/lke/test_lke.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,20 @@ def test_lke_cluster_acl(lke_cluster_with_acl):
298298
assert acl.addresses.ipv4 == ["10.0.0.2/32"]
299299

300300

301+
def test_lke_cluster_update_acl_null_addresses(lke_cluster_with_acl):
302+
cluster = lke_cluster_with_acl
303+
304+
# Addresses should not be included in the request if it's null,
305+
# else an error will be returned by the API.
306+
# See: TPT-3489
307+
acl = cluster.control_plane_acl_update(
308+
{"enabled": False, "addresses": None}
309+
)
310+
311+
assert acl == cluster.control_plane_acl
312+
assert acl.addresses.ipv4 == ["10.0.0.1/32"]
313+
314+
301315
def test_lke_cluster_disable_acl(lke_cluster_with_acl):
302316
cluster = lke_cluster_with_acl
303317

test/unit/objects/lke_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,10 @@ def test_cluster_update_null_addresses(self):
504504

505505
with self.mock_put("lke/clusters/18881/control_plane_acl") as m:
506506
cluster.control_plane_acl_update(
507-
LKEClusterControlPlaneACLOptions(
508-
enabled=True,
509-
addresses=None,
510-
)
507+
{
508+
"enabled": True,
509+
"addresses": None,
510+
}
511511
)
512512

513513
# Addresses should not be included in the API request if it's null

0 commit comments

Comments
 (0)