From 6d83275ffac6c1f35302c10db312da98ab65b170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Mon, 29 Jun 2020 13:53:01 +0200 Subject: [PATCH] Polish old modules and collection for release (#11) --- .gitlab-ci.yml | 104 ++++++++++++++++++--- README.md | 15 +++ changelogs/.gitignore | 1 + changelogs/config.yaml | 28 ++++++ galaxy.yml | 10 +- meta/{routing.yml => runtime.yml} | 17 ++-- plugins/doc_fragments/hcloud.py | 4 +- plugins/modules/hcloud_datacenter_info.py | 10 +- plugins/modules/hcloud_floating_ip.py | 6 -- plugins/modules/hcloud_floating_ip_info.py | 8 +- plugins/modules/hcloud_image_info.py | 8 +- plugins/modules/hcloud_location_info.py | 8 +- plugins/modules/hcloud_network.py | 6 -- plugins/modules/hcloud_network_info.py | 93 ++++++++++++++++-- plugins/modules/hcloud_rdns.py | 6 -- plugins/modules/hcloud_route.py | 6 -- plugins/modules/hcloud_server.py | 12 +-- plugins/modules/hcloud_server_info.py | 8 +- plugins/modules/hcloud_server_network.py | 9 +- plugins/modules/hcloud_server_type_info.py | 8 +- plugins/modules/hcloud_ssh_key.py | 6 -- plugins/modules/hcloud_ssh_key_info.py | 8 +- plugins/modules/hcloud_subnetwork.py | 6 -- plugins/modules/hcloud_volume.py | 6 -- plugins/modules/hcloud_volume_info.py | 6 -- shippable.yml | 29 ++++-- tests/integration/requirements.txt | 2 + tests/sanity/extra/changelog.json | 13 +++ tests/sanity/extra/changelog.py | 29 ++++++ tests/sanity/ignore-2.10.txt | 5 - tests/sanity/ignore-2.9.txt | 5 - tests/utils/gitlab/gitlab.sh | 20 +++- tests/utils/gitlab/sanity.sh | 5 + tests/utils/shippable/sanity.sh | 5 + tests/utils/shippable/shippable.sh | 20 +++- 35 files changed, 364 insertions(+), 168 deletions(-) create mode 100644 changelogs/.gitignore create mode 100644 changelogs/config.yaml rename meta/{routing.yml => runtime.yml} (75%) create mode 100644 tests/integration/requirements.txt create mode 100644 tests/sanity/extra/changelog.json create mode 100644 tests/sanity/extra/changelog.py delete mode 100644 tests/sanity/ignore-2.10.txt delete mode 100644 tests/sanity/ignore-2.9.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c39fc7..a524eb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,47 +2,127 @@ stages: - sanity - integration -test:sanity1-devel-py38: +ansible-devel-1/4: stage: sanity image: python:3.8-buster except: - tags script: - - bash tests/utils/gitlab/gitlab.sh sanity/1 + - bash tests/utils/gitlab/gitlab.sh devel/sanity/1 tags: - hc-bladerunner -test:sanity2-devel-py38: +ansible-devel-2/4: stage: sanity image: python:3.8-buster except: - tags script: - - bash tests/utils/gitlab/gitlab.sh sanity/2 + - bash tests/utils/gitlab/gitlab.sh devel/sanity/2 tags: - hc-bladerunner -test:sanity3-devel-py38: +ansible-devel-3/4: stage: sanity image: python:3.8-buster except: - tags script: - - bash tests/utils/gitlab/gitlab.sh sanity/3 + - bash tests/utils/gitlab/gitlab.sh devel/sanity/3 tags: - hc-bladerunner -test:sanity4-devel-py38: +ansible-devel-4/4: stage: sanity image: python:3.8-buster except: - tags script: - - bash tests/utils/gitlab/gitlab.sh sanity/4 + - bash tests/utils/gitlab/gitlab.sh devel/sanity/4 tags: - hc-bladerunner -test:integration1-devel-py38: +ansible-210-1/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.10/sanity/1 + tags: + - hc-bladerunner + +ansible-210-2/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.10/sanity/2 + tags: + - hc-bladerunner + +ansible-210-3/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.10/sanity/3 + tags: + - hc-bladerunner + +ansible-210-4/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.10/sanity/4 + tags: + - hc-bladerunner + +ansible-29-1/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.9/sanity/1 + tags: + - hc-bladerunner + +ansible-29-2/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.9/sanity/2 + tags: + - hc-bladerunner + +ansible-29-3/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.9/sanity/3 + tags: + - hc-bladerunner + +ansible-29-4/4: + stage: sanity + image: python:3.8-buster + except: + - tags + script: + - bash tests/utils/gitlab/gitlab.sh 2.9/sanity/4 + tags: + - hc-bladerunner + +ansible-devel-1/2: stage: integration image: python:3.8-buster except: @@ -50,12 +130,12 @@ test:integration1-devel-py38: script: - echo "$HCLOUD_TOKEN" >> "$(pwd)/hcloud_token.txt" - echo "py38-$CI_JOB_ID" >> "$(pwd)/prefix.txt" - - bash tests/utils/gitlab/gitlab.sh integration/1 + - bash tests/utils/gitlab/gitlab.sh devel/hcloud/3.8/1 tags: - hc-bladerunner -test:integration2-devel-py38: +ansible-devel-2/2: stage: integration image: python:3.8-buster except: @@ -63,6 +143,6 @@ test:integration2-devel-py38: script: - echo "$HCLOUD_TOKEN" >> "$(pwd)/hcloud_token.txt" - echo "py39-$CI_JOB_ID" >> "$(pwd)/prefix.txt" - - bash tests/utils/gitlab/gitlab.sh integration/2 + - bash tests/utils/gitlab/gitlab.sh devel/hcloud/3.8/2 tags: - hc-bladerunner diff --git a/README.md b/README.md index 451cc52..eed6600 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,18 @@ Ansible Collection: hetzner.hcloud ================================================= Ansible Hetzner Cloud Collection for controlling your Hetzner Cloud Resources. + +## Release notes + +See [here](https://github.com/ansible-collections/hetzner.hcloud/tree/master/CHANGELOG.rst). + + +## Publishing New Version + + +TBD Basic instructions without release branches: + +1. Create `changelogs/fragments/.yml` with `release_summary:` section (which must be a string, not a list). +2. Run `antsibull-changelog release --collection-flatmap yes` +3. Make sure `CHANGELOG.rst` and `changelogs/changelog.yaml` are added to git, and the deleted fragments have been removed. +4. Tag the commit with ``. Push changes and tag to the main repository. diff --git a/changelogs/.gitignore b/changelogs/.gitignore new file mode 100644 index 0000000..6be6b53 --- /dev/null +++ b/changelogs/.gitignore @@ -0,0 +1 @@ +/.plugin-cache.yaml diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..f3f52f8 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,28 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Hetzner Cloud Ansible Collection diff --git a/galaxy.yml b/galaxy.yml index 603332d..6850795 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -3,11 +3,13 @@ name: hcloud version: 0.1.0 readme: README.md authors: - - Lukas Kaemmerling (github.com/LKaemmerling) -description: null + - Hetzner Cloud (github.com/hetznercloud) +description: A Collection for managing Hetzner Cloud resources license: GPL-3.0-or-later -license_file: COPYING -tags: null +tags: + - hetzner + - cloud + - hcloud dependencies: ansible.netcommon: '>=0.0.1' repository: https://github.com:ansible-collections/hetzner.hcloud diff --git a/meta/routing.yml b/meta/runtime.yml similarity index 75% rename from meta/routing.yml rename to meta/runtime.yml index 1d7eeb3..1f7fb2f 100644 --- a/meta/routing.yml +++ b/meta/runtime.yml @@ -1,34 +1,35 @@ +requires_ansible: '>=2.9.10' plugin_routing: modules: hcloud_location_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_server_type_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_image_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_volume_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_floating_ip_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_ssh_key_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_datacenter_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 warning_text: see plugin documentation for details hcloud_server_facts: deprecation: - removal_date: TBD + removal_version: 2.0.0 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_datacenter_info.py b/plugins/modules/hcloud_datacenter_info.py index 9625274..d15a2a3 100644 --- a/plugins/modules/hcloud_datacenter_info.py +++ b/plugins/modules/hcloud_datacenter_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_datacenter_info @@ -23,7 +17,7 @@ short_description: Gather info about the Hetzner Cloud datacenters. description: - Gather info about your Hetzner Cloud datacenters. - This module was called C(hcloud_datacenter_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_datacenter_facts). - Note that the M(hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! + Note that the M(hetzner.hcloud.hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -56,7 +50,7 @@ hcloud_datacenter_info: description: - The datacenter info as list - This module was called C(hcloud_datacenter_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_datacenter_facts). - Note that the M(hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! + Note that the M(hetzner.hcloud.hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! returned: always type: complex contains: diff --git a/plugins/modules/hcloud_floating_ip.py b/plugins/modules/hcloud_floating_ip.py index 9ecb89c..e1c26ad 100644 --- a/plugins/modules/hcloud_floating_ip.py +++ b/plugins/modules/hcloud_floating_ip.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_floating_ip diff --git a/plugins/modules/hcloud_floating_ip_info.py b/plugins/modules/hcloud_floating_ip_info.py index 95086c6..003acf4 100644 --- a/plugins/modules/hcloud_floating_ip_info.py +++ b/plugins/modules/hcloud_floating_ip_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_floating_ip_info @@ -23,7 +17,7 @@ short_description: Gather infos about the Hetzner Cloud Floating IPs. description: - Gather facts about your Hetzner Cloud Floating IPs. - This module was called C(hcloud_floating_ip_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_floating_ip_facts). - Note that the M(hcloud_floating_ip_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_floating_ip_info)! + Note that the M(hetzner.hcloud.hcloud_floating_ip_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_floating_ip_info)! author: - Lukas Kaemmerling (@LKaemmerling) diff --git a/plugins/modules/hcloud_image_info.py b/plugins/modules/hcloud_image_info.py index 2cd506d..2a126a5 100644 --- a/plugins/modules/hcloud_image_info.py +++ b/plugins/modules/hcloud_image_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_image_info @@ -24,7 +18,7 @@ short_description: Gather infos about your Hetzner Cloud images. description: - Gather infos about your Hetzner Cloud images. - This module was called C(hcloud_location_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_location_facts). - Note that the M(hcloud_image_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_image_info)! + Note that the M(hetzner.hcloud.hcloud_image_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_image_info)! author: - Lukas Kaemmerling (@LKaemmerling) diff --git a/plugins/modules/hcloud_location_info.py b/plugins/modules/hcloud_location_info.py index bba440f..13c1ecc 100644 --- a/plugins/modules/hcloud_location_info.py +++ b/plugins/modules/hcloud_location_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_location_info @@ -24,7 +18,7 @@ short_description: Gather infos about your Hetzner Cloud locations. description: - Gather infos about your Hetzner Cloud locations. - This module was called C(hcloud_location_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_location_facts). - Note that the M(hcloud_location_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_location_info)! + Note that the M(hetzner.hcloud.hcloud_location_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_location_info)! author: - Lukas Kaemmerling (@LKaemmerling) diff --git a/plugins/modules/hcloud_network.py b/plugins/modules/hcloud_network.py index 3e04100..c511b5f 100644 --- a/plugins/modules/hcloud_network.py +++ b/plugins/modules/hcloud_network.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_network diff --git a/plugins/modules/hcloud_network_info.py b/plugins/modules/hcloud_network_info.py index 42e1865..05fecb9 100644 --- a/plugins/modules/hcloud_network_info.py +++ b/plugins/modules/hcloud_network_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_network_info @@ -80,14 +74,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_rdns.py b/plugins/modules/hcloud_rdns.py index 41ac959..d1f5462 100644 --- a/plugins/modules/hcloud_rdns.py +++ b/plugins/modules/hcloud_rdns.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_rdns diff --git a/plugins/modules/hcloud_route.py b/plugins/modules/hcloud_route.py index 25ede26..b5481a4 100644 --- a/plugins/modules/hcloud_route.py +++ b/plugins/modules/hcloud_route.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_route diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index d53b112..9cfe301 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_server @@ -49,10 +43,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 +498,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_info.py b/plugins/modules/hcloud_server_info.py index 3a488d7..252f679 100644 --- a/plugins/modules/hcloud_server_info.py +++ b/plugins/modules/hcloud_server_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_server_info @@ -24,7 +18,7 @@ short_description: Gather infos about your Hetzner Cloud servers. description: - Gather infos about your Hetzner Cloud servers. - This module was called C(hcloud_server_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_server_facts). - Note that the M(hcloud_server_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_info)! + Note that the M(hetzner.hcloud.hcloud_server_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_info)! author: - Lukas Kaemmerling (@LKaemmerling) diff --git a/plugins/modules/hcloud_server_network.py b/plugins/modules/hcloud_server_network.py index 2c6e3cb..545c2ed 100644 --- a/plugins/modules/hcloud_server_network.py +++ b/plugins/modules/hcloud_server_network.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_server_network @@ -47,6 +41,7 @@ options: description: - Alias IPs the server has. type: list + elements: str state: description: - State of the server_network. @@ -202,7 +197,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", diff --git a/plugins/modules/hcloud_server_type_info.py b/plugins/modules/hcloud_server_type_info.py index 8415de0..232f3b5 100644 --- a/plugins/modules/hcloud_server_type_info.py +++ b/plugins/modules/hcloud_server_type_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_server_type_info @@ -24,7 +18,7 @@ short_description: Gather infos about the Hetzner Cloud server types. description: - Gather infos about your Hetzner Cloud server types. - This module was called C(hcloud_server_type_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_server_type_facts). - Note that the M(hcloud_server_type_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_type_info)! + Note that the M(hetzner.hcloud.hcloud_server_type_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_type_info)! author: - Lukas Kaemmerling (@LKaemmerling) diff --git a/plugins/modules/hcloud_ssh_key.py b/plugins/modules/hcloud_ssh_key.py index 88ae270..791f233 100644 --- a/plugins/modules/hcloud_ssh_key.py +++ b/plugins/modules/hcloud_ssh_key.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_ssh_key diff --git a/plugins/modules/hcloud_ssh_key_info.py b/plugins/modules/hcloud_ssh_key_info.py index d56a40f..fa5982a 100644 --- a/plugins/modules/hcloud_ssh_key_info.py +++ b/plugins/modules/hcloud_ssh_key_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_ssh_key_info @@ -21,7 +15,7 @@ short_description: Gather infos about your Hetzner Cloud ssh_keys. description: - Gather facts about your Hetzner Cloud ssh_keys. - This module was called C(hcloud_ssh_key_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_ssh_key_facts). - Note that the M(hcloud_ssh_key_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_ssh_key_info)! + Note that the M(hetzner.hcloud.hcloud_ssh_key_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_ssh_key_info)! author: - Christopher Schmitt (@cschmitt-hcloud) options: diff --git a/plugins/modules/hcloud_subnetwork.py b/plugins/modules/hcloud_subnetwork.py index 200264d..111db86 100644 --- a/plugins/modules/hcloud_subnetwork.py +++ b/plugins/modules/hcloud_subnetwork.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_subnetwork diff --git a/plugins/modules/hcloud_volume.py b/plugins/modules/hcloud_volume.py index 98f2d2c..be59f40 100644 --- a/plugins/modules/hcloud_volume.py +++ b/plugins/modules/hcloud_volume.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_volume diff --git a/plugins/modules/hcloud_volume_info.py b/plugins/modules/hcloud_volume_info.py index e34958d..ded6331 100644 --- a/plugins/modules/hcloud_volume_info.py +++ b/plugins/modules/hcloud_volume_info.py @@ -8,12 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} - DOCUMENTATION = ''' --- module: hcloud_volume_info diff --git a/shippable.yml b/shippable.yml index 9e8572e..8da0b50 100644 --- a/shippable.yml +++ b/shippable.yml @@ -8,13 +8,30 @@ matrix: exclude: - env: T=none include: - - env: T=sanity/1 - - env: T=sanity/2 - - env: T=sanity/3 - - env: T=sanity/4 + - env: T=devel/sanity/1 + - env: T=devel/sanity/2 + - env: T=devel/sanity/3 + - env: T=devel/sanity/4 + - env: T=devel/sanity/extra - - env: T=hcloud/3.8/1 - - env: T=hcloud/3.8/2 + - env: T=devel/hcloud/3.8/1 + - env: T=devel/hcloud/3.8/2 + + + - env: T=2.10/sanity/1 + - env: T=2.10/sanity/2 + - env: T=2.10/sanity/3 + - env: T=2.10/sanity/4 + - env: T=2.10/sanity/extra + + - env: T=2.10/hcloud/3.8/1 + - env: T=2.10/hcloud/3.8/2 + + + - env: T=2.9/sanity/1 + - env: T=2.9/sanity/2 + - env: T=2.9/sanity/3 + - env: T=2.9/sanity/4 branches: except: diff --git a/tests/integration/requirements.txt b/tests/integration/requirements.txt new file mode 100644 index 0000000..d3249de --- /dev/null +++ b/tests/integration/requirements.txt @@ -0,0 +1,2 @@ +netaddr +hcloud diff --git a/tests/sanity/extra/changelog.json b/tests/sanity/extra/changelog.json new file mode 100644 index 0000000..63cfa5e --- /dev/null +++ b/tests/sanity/extra/changelog.json @@ -0,0 +1,13 @@ +{ + "python": "3.8", + "output": "path-line-column-message", + "prefixes": [ + "changelogs/fragments/" + ], + "exclude_prefixes": [ + "changelogs/fragments/." + ], + "requirements": [ + "git+git://github.com/ansible-community/ansibulled.git@pip-installable#egg=ansibulled" + ] +} diff --git a/tests/sanity/extra/changelog.py b/tests/sanity/extra/changelog.py new file mode 100644 index 0000000..243ce95 --- /dev/null +++ b/tests/sanity/extra/changelog.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# Copyright (c) Ansible Project +# 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 + + +import os +import sys +import subprocess + + +def main(): + paths = sys.argv[1:] or sys.stdin.read().splitlines() + + allowed_extensions = ('.yml', '.yaml') + + for path in paths: + ext = os.path.splitext(path)[1] + + if ext not in allowed_extensions: + print('%s:%d:%d: extension must be one of: %s' % (path, 0, 0, ', '.join(allowed_extensions))) + + cmd = ['ansibulled-changelog', 'lint'] + paths + subprocess.check_call(cmd) + + +if __name__ == '__main__': + main() diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index c70dfdb..0000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,5 +0,0 @@ -plugins/modules/hcloud_network_info.py validate-modules:return-syntax-error -plugins/modules/hcloud_server.py validate-modules:parameter-list-no-elements -plugins/modules/hcloud_server_network.py validate-modules:parameter-list-no-elements -plugins/doc_fragments/hcloud.py future-import-boilerplate -plugins/doc_fragments/hcloud.py metaclass-boilerplate \ No newline at end of file diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt deleted file mode 100644 index c70dfdb..0000000 --- a/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,5 +0,0 @@ -plugins/modules/hcloud_network_info.py validate-modules:return-syntax-error -plugins/modules/hcloud_server.py validate-modules:parameter-list-no-elements -plugins/modules/hcloud_server_network.py validate-modules:parameter-list-no-elements -plugins/doc_fragments/hcloud.py future-import-boilerplate -plugins/doc_fragments/hcloud.py metaclass-boilerplate \ No newline at end of file diff --git a/tests/utils/gitlab/gitlab.sh b/tests/utils/gitlab/gitlab.sh index 4c91c97..8f4439d 100755 --- a/tests/utils/gitlab/gitlab.sh +++ b/tests/utils/gitlab/gitlab.sh @@ -6,7 +6,16 @@ declare -a args IFS='/:' read -ra args <<< "$1" -test="${args[0]}" +ansible_version="${args[0]}" +script="${args[1]}" + +function join { + local IFS="$1"; + shift; + echo "$*"; +} + +test="$(join / "${args[@]:1}")" command -v python python -V @@ -29,8 +38,11 @@ function retry command -v pip pip --version pip list --disable-pip-version-check -retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check - +if [ "${ansible_version}" == "devel" ]; then + retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check +else + retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check +fi export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible" SHIPPABLE_RESULT_DIR="$(pwd)/shippable" TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/hetzner/hcloud" @@ -41,7 +53,7 @@ cd "${TEST_DIR}" # STAR: HACK install dependencies retry ansible-galaxy -vvv collection install community.general retry ansible-galaxy -vvv collection install ansible.netcommon - +retry ansible-galaxy -vvv collection install community.internal_test_tools retry pip install netaddr --disable-pip-version-check retry pip install hcloud # END: HACK diff --git a/tests/utils/gitlab/sanity.sh b/tests/utils/gitlab/sanity.sh index 5b0a68d..1418edc 100755 --- a/tests/utils/gitlab/sanity.sh +++ b/tests/utils/gitlab/sanity.sh @@ -13,6 +13,11 @@ else base_branch="" fi +if [ "${group}" == "extra" ]; then + ../internal_test_tools/tools/run.py --color + exit +fi + case "${group}" in 1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;; 2) options=( --test ansible-doc --test validate-modules) ;; diff --git a/tests/utils/shippable/sanity.sh b/tests/utils/shippable/sanity.sh index a52030c..7449dcd 100755 --- a/tests/utils/shippable/sanity.sh +++ b/tests/utils/shippable/sanity.sh @@ -13,6 +13,11 @@ else base_branch="" fi +if [ "${group}" == "extra" ]; then + ../../community/internal_test_tools/tools/run.py --color + exit +fi + case "${group}" in 1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;; 2) options=( --test ansible-doc --test validate-modules) ;; diff --git a/tests/utils/shippable/shippable.sh b/tests/utils/shippable/shippable.sh index 866fd6c..9edec6c 100755 --- a/tests/utils/shippable/shippable.sh +++ b/tests/utils/shippable/shippable.sh @@ -5,9 +5,16 @@ set -o pipefail -eux declare -a args IFS='/:' read -ra args <<< "$1" -script="${args[0]}" +ansible_version="${args[0]}" +script="${args[1]}" -test="$1" +function join { + local IFS="$1"; + shift; + echo "$*"; +} + +test="$(join / "${args[@]:1}")" docker images ansible/ansible docker images quay.io/ansible/* @@ -45,8 +52,11 @@ function retry command -v pip pip --version pip list --disable-pip-version-check -retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check - +if [ "${ansible_version}" == "devel" ]; then + retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check +else + retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check +fi export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible" SHIPPABLE_RESULT_DIR="$(pwd)/shippable" TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/hetzner/hcloud" @@ -59,6 +69,8 @@ retry ansible-galaxy -vvv collection install community.general retry ansible-galaxy -vvv collection install ansible.netcommon retry pip install hcloud +retry pip install netaddr --disable-pip-version-check +retry git clone https://github.com/ansible-collections/community.internal_test_tools.git "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/internal_test_tools" # END: HACK export PYTHONIOENCODING='utf-8'