From df099e6bab28f3b0783ae78be7da57637a98ac46 Mon Sep 17 00:00:00 2001 From: "Mark J. Horninger" Date: Sun, 10 Mar 2024 21:52:53 -0400 Subject: [PATCH] Wrapped as an AnsibleException --- plugins/inventory/netbird.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/inventory/netbird.py b/plugins/inventory/netbird.py index 1861ba8..3eead23 100644 --- a/plugins/inventory/netbird.py +++ b/plugins/inventory/netbird.py @@ -149,7 +149,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _get_peer_inventory(self): """Get the inventory from the Netbird API""" - self.peers = self.client.ListPeers() + try: + self.peers = self.client.ListPeers() + except Exception as e: + raise AnsibleError(f"Could not retrieve the Netbird inventory: {e}") def _filter_by_config(self): """Filter peers by user specified configuration."""