Wrapped as an AnsibleException

This commit is contained in:
Mark J. Horninger 2024-03-10 21:52:53 -04:00
parent e390a3aae8
commit df099e6bab
1 changed files with 4 additions and 1 deletions

View File

@ -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."""