From c0174af50f23cda2649663ad9a16710d2068cd87 Mon Sep 17 00:00:00 2001 From: Atte Niemi <4998544+hur@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:14:26 +0000 Subject: [PATCH] Fix missing cloud check and update code comment --- caracara/modules/custom_ioa/rules.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/caracara/modules/custom_ioa/rules.py b/caracara/modules/custom_ioa/rules.py index 40182e4..e552fad 100644 --- a/caracara/modules/custom_ioa/rules.py +++ b/caracara/modules/custom_ioa/rules.py @@ -312,9 +312,8 @@ class CustomIoaRule: # This field should exist if this object has been added to a group group: IoaRuleGroup - # All these fields should exist if `exists_in_cloud()` returns True, with the exception of - # instance_id which should exist and initialised to `None` if this object does not exist in the - # cloud + # The fields below will only be populated if `exists_in_cloud()` returns `True`, + # otherwise they will be `None` instance_id: str action_label: str comment: str @@ -610,6 +609,8 @@ def dump(self) -> dict: This object model is defined in the CrowdStrike API Swagger document. """ + if not self.exists_in_cloud(): + raise ValueError("This group does not exist in the cloud!") return { "customer_id": self.customer_id, "instance_id": self.instance_id,