From 3df221eb82f84af4f7e5b827d93e258a39fbade4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Mon, 29 Jun 2020 16:09:16 +0200 Subject: [PATCH] Bugfix: allow hcloud.yml and hcloud.yaml again as inventory configuration. --- ...ory-allow-usage-of-pre-migration-configuration-fuiles.yml | 2 ++ plugins/inventory/hcloud.py | 2 +- plugins/modules/hcloud_load_balancer.py | 5 +++-- tests/utils/gitlab/gitlab.sh | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 changelogs/inventory-allow-usage-of-pre-migration-configuration-fuiles.yml diff --git a/changelogs/inventory-allow-usage-of-pre-migration-configuration-fuiles.yml b/changelogs/inventory-allow-usage-of-pre-migration-configuration-fuiles.yml new file mode 100644 index 0000000..b221051 --- /dev/null +++ b/changelogs/inventory-allow-usage-of-pre-migration-configuration-fuiles.yml @@ -0,0 +1,2 @@ +bugfix: + - hcloud inventory plugin - Allow usage of hcloud.yml and hcloud.yaml - this was removed by error within the migration from build-in ansible to our collection diff --git a/plugins/inventory/hcloud.py b/plugins/inventory/hcloud.py index 48244e9..3118250 100644 --- a/plugins/inventory/hcloud.py +++ b/plugins/inventory/hcloud.py @@ -230,7 +230,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): """Return the possibly of a file being consumable by this plugin.""" return ( super(InventoryModule, self).verify_file(path) and - path.endswith((self.NAME + ".yaml", self.NAME + ".yml")) + path.endswith(("hcloud.yaml", "hcloud.yml")) ) def parse(self, inventory, loader, path, cache=True): diff --git a/plugins/modules/hcloud_load_balancer.py b/plugins/modules/hcloud_load_balancer.py index 4454045..8346cd1 100644 --- a/plugins/modules/hcloud_load_balancer.py +++ b/plugins/modules/hcloud_load_balancer.py @@ -174,7 +174,7 @@ class AnsibleHcloudLoadBalancer(Hcloud): "location": to_native(self.hcloud_load_balancer.location.name), "labels": self.hcloud_load_balancer.labels, "delete_protection": self.hcloud_load_balancer.protection["delete"], - "disable_public_interface": self.hcloud_load_balancer.public_net.enabled + "disable_public_interface": False if self.hcloud_load_balancer.public_net.enabled else True, } def _get_load_balancer(self): @@ -219,7 +219,6 @@ class AnsibleHcloudLoadBalancer(Hcloud): self._mark_as_changed() self._get_load_balancer() - self._update_load_balancer() def _update_load_balancer(self): try: @@ -251,8 +250,10 @@ class AnsibleHcloudLoadBalancer(Hcloud): def present_load_balancer(self): self._get_load_balancer() if self.hcloud_load_balancer is None: + self.module.debug(msg="Create") self._create_load_balancer() else: + self.module.debug(msg="Update") self._update_load_balancer() def delete_load_balancer(self): diff --git a/tests/utils/gitlab/gitlab.sh b/tests/utils/gitlab/gitlab.sh index f4a870a..a48dbaa 100755 --- a/tests/utils/gitlab/gitlab.sh +++ b/tests/utils/gitlab/gitlab.sh @@ -85,7 +85,9 @@ find plugins -type d -empty -print -delete ansible-test env --dump --show --timeout "50" --color -v group="${args[1]}" -if [[ "${test}" =~ integration ]]; then +echo $test +if [[ "${test}" =~ hcloud ]]; then + group="${args[3]}" bash tests/utils/gitlab/integration.sh "shippable/hcloud/group${group}/" else bash tests/utils/gitlab/sanity.sh "sanity/${group}"