Skip to content

Commit 0b53aa4

Browse files
committed
address copilot comments
1 parent 91fde06 commit 0b53aa4

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎linode_api4/groups/linode.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ def instance_create(
163163
interface_generation: Optional[Union[InterfaceGeneration, str]] = None,
164164
network_helper: Optional[bool] = None,
165165
maintenance_policy: Optional[str] = None,
166-
alerts: Optional[
167-
Union[Dict[str, Any], InstanceACLPAlertsOptions]
168-
] = None,
169166
root_pass: Optional[str] = None,
170167
kernel: Optional[str] = None,
171168
boot_size: Optional[int] = None,
172169
authorized_users: Optional[List[str]] = None,
173170
ipv4: Optional[List[str]] = None,
171+
alerts: Optional[
172+
Union[Dict[str, Any], InstanceACLPAlertsOptions]
173+
] = None,
174174
**kwargs,
175175
):
176176
"""
@@ -354,9 +354,6 @@ def instance_create(
354354
:param maintenance_policy: The slug of the maintenance policy to apply during maintenance.
355355
If not provided, the default policy (linode/migrate) will be applied.
356356
:type maintenance_policy: str
357-
:param alerts: ACLP alerts available to define during instance creation.
358-
This is v4beta only and may not be available to all users.
359-
:type alerts: dict[str, Any] or InstanceACLPAlertsOptions
360357
:param kernel: The kernel to boot the Instance with. If provided, this will be used as the
361358
kernel for the default configuration profile.
362359
:type kernel: str
@@ -366,6 +363,9 @@ def instance_create(
366363
:param ipv4: A list of reserved IPv4 addresses to assign to this Instance.
367364
NOTE: Reserved IP feature may not currently be available to all users.
368365
:type ipv4: list[str]
366+
:param alerts: ACLP alerts available to define during instance creation.
367+
This is v4beta only and may not be available to all users.
368+
:type alerts: dict[str, Any] or InstanceACLPAlertsOptions
369369
370370
:returns: A new Instance object
371371
:rtype: Instance

‎test/integration/models/linode/test_linode.py‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ def test_linode_alerts_workflow(test_linode_client, create_linode):
458458
}
459459
linode_save_status = linode.save()
460460
assert linode_save_status == True
461+
linode = test_linode_client.load(Instance, parent_linode_id)
461462
assert linode.alerts["cpu"] == 50
462463
assert linode.alerts["io"] == 6000
463464
assert linode.alerts["network_in"] == 20
@@ -472,15 +473,17 @@ def test_linode_alerts_workflow(test_linode_client, create_linode):
472473
instance_type=linode.type.id,
473474
label=get_test_label(),
474475
)
475-
assert new_linode.alerts.cpu == 90
476-
assert new_linode.alerts.io == 10000
477-
assert new_linode.alerts.network_in == 10
478-
assert new_linode.alerts.network_out == 10
479-
assert new_linode.alerts.transfer_quota == 80
480-
assert isinstance(new_linode.alerts.system_alerts, list)
481-
assert isinstance(new_linode.alerts.user_alerts, list)
482476

483-
wait_for_clone_complete_and_delete_linode(10, 100, new_linode)
477+
try:
478+
assert new_linode.alerts.cpu == 90
479+
assert new_linode.alerts.io == 10000
480+
assert new_linode.alerts.network_in == 10
481+
assert new_linode.alerts.network_out == 10
482+
assert new_linode.alerts.transfer_quota == 80
483+
assert isinstance(new_linode.alerts.system_alerts, list)
484+
assert isinstance(new_linode.alerts.user_alerts, list)
485+
finally:
486+
wait_for_clone_complete_and_delete_linode(10, 100, new_linode)
484487

485488

486489
def test_update_linode_aclp_alerts(
@@ -494,6 +497,7 @@ def test_update_linode_aclp_alerts(
494497
"system_alerts": [sample_system_alert],
495498
}
496499
linode.save()
500+
linode = test_linode_client.load(Instance, linode.id)
497501
assert linode.alerts["user_alerts"] == [create_alert_service_definition.id]
498502
assert linode.alerts["system_alerts"] == [sample_system_alert]
499503

0 commit comments

Comments
 (0)