mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
AZP fixes (#52)
* Tidy up files * Add Sanity ignore files * Use master as branch name instead of main * Use targets in integration jobs * Remove tests/sanity/requirements.txt (not used by ansible-test) * sanity: prevent import exception for inventory script Co-authored-by: David Moreau Simard <moi@dmsimard.com>
This commit is contained in:
parent
39172b0032
commit
0d955cab88
9 changed files with 125 additions and 32 deletions
|
|
@ -102,8 +102,9 @@ from ansible.release import __version__
|
|||
try:
|
||||
from hcloud import hcloud
|
||||
from hcloud import APIException
|
||||
HAS_HCLOUD = True
|
||||
except ImportError:
|
||||
raise AnsibleError("The Hetzner Cloud dynamic inventory plugin requires hcloud-python.")
|
||||
HAS_HCLOUD = False
|
||||
|
||||
|
||||
class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
|
|
@ -243,6 +244,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
|
||||
def parse(self, inventory, loader, path, cache=True):
|
||||
super(InventoryModule, self).parse(inventory, loader, path, cache)
|
||||
|
||||
if not HAS_HCLOUD:
|
||||
raise AnsibleError("The Hetzner Cloud dynamic inventory plugin requires hcloud-python.")
|
||||
|
||||
self._read_config_data(path)
|
||||
self._configure_hcloud_client()
|
||||
self._test_hcloud_token()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue