From efae528e70ca3015f34ac4f181e2fa1faa9c0308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Thu, 25 Jun 2020 06:51:07 +0200 Subject: [PATCH] Fix sanity tests --- meta/{routing.yml => runtime.yml} | 16 ++--- plugins/doc_fragments/hcloud.py | 4 +- plugins/modules/hcloud_network_info.py | 87 ++++++++++++++++++++++++ plugins/modules/hcloud_server.py | 6 +- plugins/modules/hcloud_server_network.py | 3 +- 5 files changed, 104 insertions(+), 12 deletions(-) rename meta/{routing.yml => runtime.yml} (76%) diff --git a/meta/routing.yml b/meta/runtime.yml similarity index 76% rename from meta/routing.yml rename to meta/runtime.yml index 1d7eeb3..85a3e13 100644 --- a/meta/routing.yml +++ b/meta/runtime.yml @@ -2,33 +2,33 @@ plugin_routing: modules: hcloud_location_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_server_type_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_image_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_volume_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_floating_ip_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_ssh_key_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_datacenter_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details hcloud_server_facts: deprecation: - removal_date: TBD + removal_date: 2021-03-01 warning_text: see plugin documentation for details diff --git a/plugins/doc_fragments/hcloud.py b/plugins/doc_fragments/hcloud.py index a92b302..2548b1e 100644 --- a/plugins/doc_fragments/hcloud.py +++ b/plugins/doc_fragments/hcloud.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type class ModuleDocFragment(object): - DOCUMENTATION = ''' options: api_token: diff --git a/plugins/modules/hcloud_network_info.py b/plugins/modules/hcloud_network_info.py index 42e1865..b20fdad 100644 --- a/plugins/modules/hcloud_network_info.py +++ b/plugins/modules/hcloud_network_info.py @@ -80,14 +80,101 @@ hcloud_network_info: description: Subnetworks belonging to the network returned: always type: complex + contains: + type: + description: Type of the subnetwork. + returned: always + type: str + sample: cloud + network_zone: + description: Network of the subnetwork. + returned: always + type: str + sample: eu-central + ip_range: + description: IP range of the subnetwork + returned: always + type: str + sample: 10.0.0.0/24 + gateway: + description: Gateway of this subnetwork + returned: always + type: str + sample: 10.0.0.1 routes: description: Routes belonging to the network returned: always type: complex + contains: + ip_range: + description: Destination network or host of this route. + returned: always + type: str + sample: 10.0.0.0/16 + gateway: + description: Gateway of this route + returned: always + type: str + sample: 10.0.0.1 servers: description: Servers attached to the network returned: always type: complex + contains: + id: + description: Numeric identifier of the server + returned: always + type: int + sample: 1937415 + name: + description: Name of the server + returned: always + type: str + sample: my-server + status: + description: Status of the server + returned: always + type: str + sample: running + server_type: + description: Name of the server type of the server + returned: always + type: str + sample: cx11 + ipv4_address: + description: Public IPv4 address of the server + returned: always + type: str + sample: 116.203.104.109 + ipv6: + description: IPv6 network of the server + returned: always + type: str + sample: 2a01:4f8:1c1c:c140::/64 + location: + description: Name of the location of the server + returned: always + type: str + sample: fsn1 + datacenter: + description: Name of the datacenter of the server + returned: always + type: str + sample: fsn1-dc14 + rescue_enabled: + description: True if rescue mode is enabled, Server will then boot into rescue system on next reboot + returned: always + type: bool + sample: false + backup_window: + description: Time window (UTC) in which the backup will run, or null if the backups are not enabled + returned: always + type: bool + sample: 22-02 + labels: + description: User-defined labels (key-value pairs) + returned: always + type: dict delete_protection: description: True if the network is protected for deletion returned: always diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index d53b112..e85d381 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -49,10 +49,12 @@ options: - The key names correspond to the SSH keys configured for your Hetzner Cloud account access. type: list + elements: str volumes: description: - List of Volumes IDs that should be attached to the server on server creation. type: list + elements: str image: description: - Image the server should be created from. @@ -502,8 +504,8 @@ class AnsibleHcloudServer(Hcloud): location={"type": "str"}, datacenter={"type": "str"}, user_data={"type": "str"}, - ssh_keys={"type": "list"}, - volumes={"type": "list"}, + ssh_keys={"type": "list", "elements": "str"}, + volumes={"type": "list", "elements": "str"}, labels={"type": "dict"}, backups={"type": "bool", "default": False}, upgrade_disk={"type": "bool", "default": False}, diff --git a/plugins/modules/hcloud_server_network.py b/plugins/modules/hcloud_server_network.py index 2c6e3cb..347ecde 100644 --- a/plugins/modules/hcloud_server_network.py +++ b/plugins/modules/hcloud_server_network.py @@ -47,6 +47,7 @@ options: description: - Alias IPs the server has. type: list + elements: str state: description: - State of the server_network. @@ -202,7 +203,7 @@ class AnsibleHcloudServerNetwork(Hcloud): network={"type": "str", "required": True}, server={"type": "str", "required": True}, ip={"type": "str"}, - alias_ips={"type": "list"}, + alias_ips={"type": "list", "elements": "str"}, state={ "choices": ["absent", "present"], "default": "present",