Commit graph

125 commits

Author SHA1 Message Date
Jonas L.
c665629f7e
refactor: reuse exponential_backoff_function from hcloud-python (#535)
Replace the local function with the exponential_backoff_function from
hcloud-python
2024-07-25 16:20:23 +02:00
Jonas L.
b9a1509378
test: update network delete protection error message (#536)
The new network service has a different error message.
2024-07-25 15:42:33 +02:00
Jonas L
4d4941aaa2
ci: update gitlab ci config (#529)
- Remove outdated jobs
- Only run on feature branches
- Remove old gitlab ci scripts
2024-07-09 12:30:49 +02:00
Jonas L
19e586fa22
feat: use exponential backoff algorithm when polling actions (#524)
##### SUMMARY

Replace the constant poll interval of 1 second, with a truncated
exponential back off algorithm with jitter.

Below is a suite of poll interval (in seconds) generated by the new
algorithm:
```
1.49
2.14
5.46
6.51
6.57
5.57
5.98
7.13
6.59
7.10
5.54
5.03
6.56
5.96
6.72
7.21
7.05
5.31
5.60
6.33
6.82
5.42
6.08
6.60
TOTAL: 140.77
```
2024-07-04 15:07:05 +02:00
renovate[bot]
9adb8b3981
chore(deps): update dependency hcloud to v2 (#523)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [hcloud](https://togithub.com/hetznercloud/hcloud-python)
([changelog](https://togithub.com/hetznercloud/hcloud-python/blob/main/CHANGELOG.md))
| `1.35.0` -> `2.0.1` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/hcloud/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/hcloud/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/hcloud/1.35.0/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/hcloud/1.35.0/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-python (hcloud)</summary>

###
[`v2.0.1`](https://togithub.com/hetznercloud/hcloud-python/blob/HEAD/CHANGELOG.md#201-2024-07-03)

[Compare
Source](https://togithub.com/hetznercloud/hcloud-python/compare/v2.0.0...v2.0.1)

##### Bug Fixes

- `assignee_type` is required when creating a primary ip
([#&#8203;409](https://togithub.com/hetznercloud/hcloud-python/issues/409))
([bce5e94](bce5e940e2))
- clean unused arguments in the `Client.servers.rebuild` method
([#&#8203;407](https://togithub.com/hetznercloud/hcloud-python/issues/407))
([6d33c3c](6d33c3cff5))
- details are optional in API errors
([#&#8203;411](https://togithub.com/hetznercloud/hcloud-python/issues/411))
([f1c6594](f1c6594dee))
- rename `trace_id` variable to `correlation_id`
([#&#8203;408](https://togithub.com/hetznercloud/hcloud-python/issues/408))
([66a0f54](66a0f54699))

###
[`v2.0.0`](https://togithub.com/hetznercloud/hcloud-python/blob/HEAD/CHANGELOG.md#200-2024-07-03)

[Compare
Source](https://togithub.com/hetznercloud/hcloud-python/compare/v1.35.0...v2.0.0)

##### ⚠ BREAKING CHANGES

- return full rebuild response in `Client.servers.rebuild`
([#&#8203;406](https://togithub.com/hetznercloud/hcloud-python/issues/406))
- make `datacenter` argument optional when creating a primary ip
([#&#8203;363](https://togithub.com/hetznercloud/hcloud-python/issues/363))
- remove deprecated `include_wildcard_architecture` argument in
`IsosClient.get_list` and `IsosClient.get_all`
([#&#8203;402](https://togithub.com/hetznercloud/hcloud-python/issues/402))
- make `Client.request` `tries` a private argument
([#&#8203;399](https://togithub.com/hetznercloud/hcloud-python/issues/399))
- make `Client.poll_interval` a private property
([#&#8203;398](https://togithub.com/hetznercloud/hcloud-python/issues/398))
- return empty dict on empty responses in `Client.request`
([#&#8203;400](https://togithub.com/hetznercloud/hcloud-python/issues/400))
- remove deprecated `hcloud.hcloud` module
([#&#8203;401](https://togithub.com/hetznercloud/hcloud-python/issues/401))
- move `hcloud.__version__.VERSION` to `hcloud.__version__`
([#&#8203;397](https://togithub.com/hetznercloud/hcloud-python/issues/397))

##### Features

- add `trace_id` to API exceptions
([#&#8203;404](https://togithub.com/hetznercloud/hcloud-python/issues/404))
([8375261](8375261da3))
- allow using a custom poll_interval function
([#&#8203;403](https://togithub.com/hetznercloud/hcloud-python/issues/403))
([93eb56b](93eb56ba4d))
- make `Client.poll_interval` a private property
([#&#8203;398](https://togithub.com/hetznercloud/hcloud-python/issues/398))
([d5f24db](d5f24db281))
- make `Client.request` `tries` a private argument
([#&#8203;399](https://togithub.com/hetznercloud/hcloud-python/issues/399))
([428ea7e](428ea7e3be))
- move `hcloud.__version__.VERSION` to `hcloud.__version__`
([#&#8203;397](https://togithub.com/hetznercloud/hcloud-python/issues/397))
([4e3f638](4e3f638862)),
closes
[#&#8203;234](https://togithub.com/hetznercloud/hcloud-python/issues/234)
- remove deprecated `hcloud.hcloud` module
([#&#8203;401](https://togithub.com/hetznercloud/hcloud-python/issues/401))
([db37e63](db37e633eb))
- remove deprecated `include_wildcard_architecture` argument in
`IsosClient.get_list` and `IsosClient.get_all`
([#&#8203;402](https://togithub.com/hetznercloud/hcloud-python/issues/402))
([6b977e2](6b977e2da5))
- return empty dict on empty responses in `Client.request`
([#&#8203;400](https://togithub.com/hetznercloud/hcloud-python/issues/400))
([9f46adb](9f46adb946))
- return full rebuild response in `Client.servers.rebuild`
([#&#8203;406](https://togithub.com/hetznercloud/hcloud-python/issues/406))
([1970d84](1970d84bec))

##### Bug Fixes

- make `datacenter` argument optional when creating a primary ip
([#&#8203;363](https://togithub.com/hetznercloud/hcloud-python/issues/363))
([ebef774](ebef77464c))

##### Dependencies

- update dependency coverage to >=7.5,<7.6
([#&#8203;386](https://togithub.com/hetznercloud/hcloud-python/issues/386))
([5660691](5660691ebd))
- update dependency mypy to >=1.10,<1.11
([#&#8203;387](https://togithub.com/hetznercloud/hcloud-python/issues/387))
([35c933b](35c933bd21))
- update dependency myst-parser to v3
([#&#8203;385](https://togithub.com/hetznercloud/hcloud-python/issues/385))
([9f18270](9f18270489))
- update dependency pylint to >=3,<3.3
([#&#8203;391](https://togithub.com/hetznercloud/hcloud-python/issues/391))
([4a6f005](4a6f005cb0))
- update dependency pytest to >=8,<8.3
([#&#8203;390](https://togithub.com/hetznercloud/hcloud-python/issues/390))
([584a36b](584a36b658))
- update dependency sphinx to >=7.3.4,<7.4
([#&#8203;383](https://togithub.com/hetznercloud/hcloud-python/issues/383))
([69c2e16](69c2e16073))
- update pre-commit hook asottile/pyupgrade to v3.16.0
([0ce5fbc](0ce5fbccba))
- update pre-commit hook pre-commit/pre-commit-hooks to v4.6.0
([5ef25ab](5ef25ab396))
- update pre-commit hook psf/black-pre-commit-mirror to v24.4.0
([0941fbf](0941fbfab2))
- update pre-commit hook psf/black-pre-commit-mirror to v24.4.1
([fec08c5](fec08c5323))
- update pre-commit hook psf/black-pre-commit-mirror to v24.4.2
([#&#8203;389](https://togithub.com/hetznercloud/hcloud-python/issues/389))
([2b2e21f](2b2e21f613))
- update pre-commit hook pycqa/flake8 to v7.1.0
([3bc651d](3bc651d50d))

##### Documentation

- add v2 upgrade notes
([#&#8203;405](https://togithub.com/hetznercloud/hcloud-python/issues/405))
([c77f771](c77f771e2b))
- cx11 is name, not an id
([#&#8203;381](https://togithub.com/hetznercloud/hcloud-python/issues/381))
([b745d40](b745d4049f))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ansible-collections/hetzner.hcloud).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: jo <ljonas@riseup.net>
2024-07-03 15:05:12 +02:00
Jonas L
f3d697c006
test: use shared variable for server type, image and location (#522)
##### SUMMARY

Use shared variables to store information about which server type, image
or location to use for our integrations tests.

- The location was changed from FSN to HEL.
- The image was changed from ubuntu-22.04 to debian-12.
2024-06-26 16:10:58 +02:00
Jonas L
069b866e57
test: add internal account vswitch ids (#521)
##### SUMMARY

Adds a few vSwitche IDs from our internal Hetzner Account, to run test
manually.
2024-06-26 14:31:49 +02:00
Jonas L
029a7c686b
test: update server type to cax11 (#518)
Ensure we are consistent across our tests, and updates some server types
that were missing from the previous PR updating this:

https://github.com/ansible-collections/hetzner.hcloud/pull/510
2024-06-12 10:57:12 +02:00
Jonas L
8157f9a250
feat!: drop support for ansible-core 2.14 (#512)
##### SUMMARY

ansible-core 2.14 is EOL since 20 May 2024.

https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
2024-06-11 16:21:03 +02:00
Jonas L
fb8c2a9f58
chore: replace deprecated server type with cx22 (#510)
Learn more:
https://docs.hetzner.cloud/changelog#2024-06-06-old-server-types-with-shared-intel-vcpus-are-deprecated

- Updated docs with newer server types
- Use ARM server type for tests
2024-06-11 15:30:47 +02:00
Jonas L
0dc857830d
test: add workaround to prevent a timeout during the server deletion (#513)
When the following steps are executed, the server deletion fails with a
timeout:
- delete primary IP (attached to the server)
- delete server
- timeout after 5 minutes on server delete action


Adding the 2 seconds pause will work around this timeout.
2024-06-10 18:33:41 +02:00
Jonas L
a98cf72f92
fix(inventory): ensure host ipv6 variable is json serializable (#496)
##### SUMMARY

Fix https://github.com/ansible-collections/hetzner.hcloud/issues/495
Related to
https://github.com/ansible-collections/hetzner.hcloud/pull/477

##### ISSUE TYPE

- Bugfix Pull Request


##### COMPONENT NAME
inventory
2024-04-16 11:48:03 +02:00
Jonas L
00a4fdd58a
fix: use empty string to remove server from its placement group (#489)
##### SUMMARY
- Do not remove the server from its placement group when the
`placement_group` argument is not specified.
- Pass an empty string to the `placement_group` argument to remove a
server from its placement group.
2024-04-04 16:53:32 +02:00
Jonas L
8738f369d3
test: check for api error code when possible (#486)
##### SUMMARY

Ensure the error code is correct and replace the error message check in
some cases.
2024-04-04 11:55:45 +02:00
Jonas L
7776905321
test: force firewall cleanup before running server cleanup (#485)
##### SUMMARY

Cleanup the firewall before the server to prevent a server deletion
timeout.
2024-04-04 11:54:54 +02:00
Jonas L
cfdaa0fb82
test: disable fact gathering in integration tests (#482)
##### SUMMARY
This should speed up a little our integrations tests by not gather facts
before each test run.

Docs
https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/integration-aliases.html
2024-04-02 19:21:17 +02:00
jjeff07
51afb23166
feat: assign primary ip to a server on create (#465)
##### SUMMARY

Fixes #464 

##### ISSUE TYPE
- Feature Pull Request

##### COMPONENT NAME
primary_ip

---------

Co-authored-by: jo <ljonas@riseup.net>
2024-03-11 18:20:30 +01:00
Jonas L
e781f48f15
chore: add fail_on_invalid_params helper (#470)
##### SUMMARY

Add a small helper to validate parameters while executing the module.

---------

Co-authored-by: Justin Jeffery <justin.jeffery@ipfabric.io>
2024-03-11 18:03:26 +01:00
Jonas L
46717e2d65
test: improve primary_ip integration using the testing framework (#468)
##### SUMMARY
Use the new testing framework for the primary ip integration tests.
2024-02-29 12:29:18 +01:00
Jonas L
b0cb1a665b
test: do not start server where possible (#461)
##### SUMMARY

Reduce test time by not starting servers when not required.
2024-02-08 17:37:47 +01:00
Jonas L
1ae6769210
fix: return sorted alias_ips in server_network module (#458)
##### SUMMARY

- test: use testing framework for server_network integration tests
- fix: return sorted alias_ips in server_network module

##### ISSUE TYPE

- Bugfix Pull Request


##### COMPONENT NAME

server_network
2024-02-07 11:45:37 +01:00
Jonas L
cf52215864
chore: add dev target helper (#457)
##### SUMMARY

Adds a helper to configure the dev env. For example reexporting a
hcloud_token and reload the integration tests configuration:
```bash
export HCLOUD_TOKEN="$(get-tmp-hcloud-token)"
make dev
```
2024-02-06 14:04:18 +01:00
Jonas L
5358110ed3
test: use longer role namespace to prevent collision (#456)
##### SUMMARY

Use bigger roles namespace, by using the first 2 chars of each word:
`load_balancer_network` => `lobane`

For example, we have such cases:
- `rdns` => `r` => `rd`
- `route` => `r` => `ro`
2024-02-05 15:41:58 +01:00
Jonas L
96f8009214
feat!: drop support for ansible-core 2.13 (#450)
##### SUMMARY

ansible-core 2.13 is EOL since 6 November 2023.

Fixes #400


https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
2024-02-05 14:26:04 +01:00
Jonas L
866e0b564e
test: use testing framework for network integration tests (#448)
##### SUMMARY

Implement the new test framework for the network tests, and reenable the
network tests
2024-02-02 13:42:18 +01:00
Jonas L
559d31561a
feat: allow forcing the deletion of firewalls that are still in use (#447)
##### SUMMARY

  - Do not silence 'firewall still in use' deletions errors.
  - Allow forcing the deletion of a firewall that is still in use.

Fixes #380

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

firewall
2024-02-02 09:48:56 +01:00
Jonas L
2757fe745f
feat: improve firewall resources management (#324)
##### SUMMARY

  - firewall - Return resources the firewall is `applied_to`.
- firewall_info - Add new `firewall_info` module to gather firewalls
info.
- firewall_resource - Add new `firewall_resource` module to manage
firewalls resources.

Fixes #111

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

firewall
firewall_info
firewall_resource

---------

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
2024-02-01 16:50:13 +01:00
Jonas L
9495b9f25a
docs: improve hcloud inventory documentation (#434)
##### SUMMARY

- Re add some examples that were removed during a dep upgrade.
- Improve link to other reference (plugins/modules/options)
- Remove duplicate docs.
2023-12-21 17:49:24 +01:00
Jonas L
3910785025
test: use testing framework for firewall integration tests (#425)
##### SUMMARY

Use the new testing framework for the firewall integration tests and fix
linting errors.
2023-12-15 15:25:35 +01:00
Jonas L
86e476f961
test: fix linting error for integrations setup roles (#426)
##### SUMMARY

Fix ansible lint error for the integrations setup roles.
2023-12-15 15:25:20 +01:00
Jonas L
fe4c924594
test: remove jinja templates where unnecessary (#420)
Attempt to fix the unsafe condition by removing unnecessary jinja
templates.

Example of failing CI:
https://dev.azure.com/ansible/hetzner.hcloud/_build/results?buildId=98486&view=logs&j=86ea7956-35b6-5577-ed45-fe20f8c6b276&t=a2e51dbe-b8d9-5c65-a584-138300c332b7&l=2562
2023-12-14 18:17:53 +01:00
Jonas L
4cfdf50b26
feat: replace ansible.netcommon utils with python3 ipaddress module (#416)
##### SUMMARY

Replace `ansible.netcommon` deprecated ipaddr utils with python
`ipaddress` module. The `ansible.netcommon` collection is no longer
required by the collections. We still use the `ansible.utils`
collections for testing
2023-12-12 11:50:45 +01:00
Jonas L
df8c3b6a59
refactor: add future annotations imports (#398)
##### SUMMARY

This adds future annotations imports to benefit from the modern python
typing system.
2023-11-23 14:53:10 +01:00
Jonas L
7c9fbf85a7
feat: rename api_endpoint module argument (#395)
##### SUMMARY

Make the api endpoint module argument consistent with the api token. 
- Renamed the `endpoint` module argument to `api_endpoint`, backward
compatibility is maintained using an alias.
- Allow to configure it using the `HCLOUD_ENDPOINT` env var.

This makes the inventory config and the modules config a bit more
consistent.

##### ISSUE TYPE

- Feature Pull Request
2023-11-21 10:13:21 +01:00
Jonas L
328dfb8b0f
refactor: start using new modules names (#393)
##### SUMMARY

Update all references to modules to use the new module names.
Continuation of #390
2023-11-21 09:40:11 +01:00
Jonas L
933a16249b
feat: remove hcloud_ prefix from all modules names (#390)
##### SUMMARY

This simplifies the name of the modules from
`hetzner.hcloud.hcloud_firewall` to `hetzner.hcloud.firewall`. While
maintaining backward compatibility with the old names.

Further changes such as updating the test or the documentation will be
done in a future PR to maintain the git history when squashing the PRs.

##### ISSUE TYPE

- Feature Pull Request
2023-11-20 13:21:23 +01:00
Jonas L
c336f47f80
test: improve rdns integration using the testing framework (#372)
##### SUMMARY

Use the new testing framework for the rdns integration tests.
2023-10-23 16:23:33 +02:00
Jonas L
a93dbaa428
feat: add load_balancer algorithm option (#368)
##### SUMMARY

Allow to configure load balancers algorithm.

Closes #289

Depends on #367 

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
hcloud_load_balancer
2023-10-20 12:20:09 +02:00
Jonas L
10a3e4f01e
test: rework load_balancer module tests (#367)
##### SUMMARY

Use the new testing framework and clean up the load_balancer tests.

---------

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
2023-10-19 18:14:18 +02:00
Jonas L
5e425c56c2
feat: allow selecting a resource using its ID (#361)
##### SUMMARY

Allow referring to resources using their IDs for:
- hcloud_load_balancer_network
- hcloud_load_balancer_service
- hcloud_load_balancer_target
- hcloud_rdns
- hcloud_route
- hcloud_server_network
- hcloud_subnetwork


##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
- hcloud_load_balancer_network
- hcloud_load_balancer_service
- hcloud_load_balancer_target
- hcloud_rdns
- hcloud_route
- hcloud_server_network
- hcloud_subnetwork
2023-10-18 10:28:42 +02:00
Jonas L
4044980477
test: fix vswitch subnets ip_range (#359)
##### SUMMARY

The vswitch subnet validation changed: the subnet ip_range must be
smaller than the network ip_range **AND** must not start with the same
IP.
 
See
https://github.com/ansible-collections/hetzner.hcloud/runs/17672011247

In addition, I reworked the tests to use the new testing framework.
2023-10-17 09:18:26 +02:00
Jonas L
76ef636f07
feat: add deprecation field to hcloud_iso_info (#357)
##### SUMMARY

See these changelog entries for the announcement:

-
https://docs.hetzner.cloud/changelog#2023-10-12-deprecation-info-for-isos
-
https://docs.hetzner.cloud/changelog#2023-10-12-field-deprecated-on-isos-is-now-deprecated


##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
hcloud_iso_info
2023-10-16 11:16:31 +02:00
Jonas L
001c3e2089
ci: clean azp scripts (#340)
##### SUMMARY

Clean old scripts and simplify the CI scripts.
2023-09-27 08:59:26 +02:00
Jonas L
f47e49c132
test: fix AnsibleHCloud module unit tests (#337)
##### SUMMARY

We had a race condition between 2 Pull Requests (#336 and #325) and
everything didn't go through the test pipeline. Fixing it now.
2023-09-26 15:44:49 +02:00
Jonas L
9a44bc260f
ci: add unit tests to azure pipelines (#325)
##### SUMMARY

Enable unit testing in the CI. We started to write some unit tests for
the inventory, but they were not enforced in the CI.
2023-09-26 09:41:19 +02:00
Jonas L
94190ae6cb
refactor: move module vars out of __init__ (#336)
##### SUMMARY

- move module vars out of `__init__`
- add modules type hints
- catch hcloud exception for api calls
2023-09-26 09:41:01 +02:00
Jonas L
62ab0570c8
test: setup new temporary project service for integration tests (#316)
##### SUMMARY

Setup new temporary project service for integration tests.

- Use the hc-integrations-test.de domain for certificates creation
- Use new Hetzner account vSwitch
- Use new Hetzner account server IP
- Create snapshots during setup (instead of "always-there-snapshot")
2023-09-08 09:37:43 +02:00
Jonas L
5475a9929a
feat: target health status in hcloud_load_balancer_info (#305) 2023-08-17 15:25:14 +02:00
Jonas L
4bb2bb80fa
feat: query floating ip info by name (#303)
##### SUMMARY

Fixes #302 

The feature was missing, this make the floating_ip_info module consistent with what is expected to be implemented. 

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

floating_ip_info
2023-08-17 11:50:19 +02:00
Jonas L
8b24cf2522
test: improve *_info modules tests (#299)
##### SUMMARY

- Implement the new testing framework (prepare.yml/cleanup.yml #239)
- Fix some uncovered test scenarios (related to #298).
- Structure all the *_info tests using the following structure:
  ```
  gather all
  [gather all with custom options...]
  gather all in check mode
  gather with id
  gather with name
  gather with labels
  [gather with custom option...]
  ```
2023-08-17 09:44:33 +02:00