Skip to content

Commit

Permalink
deps: update dependency hcloud to v1.32.0 (ansible-collections#389)
Browse files Browse the repository at this point in the history
[![Mend Renovate logo
banner](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.31.0` -> `1.32.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/hcloud/1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/hcloud/1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/hcloud/1.31.0/1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/hcloud/1.31.0/1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

###
[`v1.32.0`](https://togithub.com/hetznercloud/hcloud-python/blob/HEAD/CHANGELOG.md#1320-2023-11-17)

[Compare
Source](https://togithub.com/hetznercloud/hcloud-python/compare/v1.31.0...v1.32.0)

##### Features

- allow returning root_password in servers rebuild
([#&#8203;276](https://togithub.com/hetznercloud/hcloud-python/issues/276))
([38e098a](https://togithub.com/hetznercloud/hcloud-python/commit/38e098a41154e6561578cd723608fcd7577c3d01))

##### Dependencies

- update dependency mypy to >=1.7,<1.8
([#&#8203;325](https://togithub.com/hetznercloud/hcloud-python/issues/325))
([7b59a2d](https://togithub.com/hetznercloud/hcloud-python/commit/7b59a2decc9bb5152dc9de435bfe12ce1f34ac1c))
- update pre-commit hook pre-commit/mirrors-prettier to v3.1.0
([#&#8203;326](https://togithub.com/hetznercloud/hcloud-python/issues/326))
([213b661](https://togithub.com/hetznercloud/hcloud-python/commit/213b661d897cdd327f478b52aeb79844826694d8))
- update pre-commit hook psf/black-pre-commit-mirror to v23.10.1
([#&#8203;322](https://togithub.com/hetznercloud/hcloud-python/issues/322))
([999afe3](https://togithub.com/hetznercloud/hcloud-python/commit/999afe37e02a113639930aff6879f50918ac0e89))
- update pre-commit hook psf/black-pre-commit-mirror to v23.11.0
([#&#8203;324](https://togithub.com/hetznercloud/hcloud-python/issues/324))
([7b2a24e](https://togithub.com/hetznercloud/hcloud-python/commit/7b2a24ecf69c0bead7f9113053fda37a0cc31d1b))

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: jo <[email protected]>
  • Loading branch information
renovate[bot] and jooola authored Nov 20, 2023
1 parent 2e82e0e commit 8c846f3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugins/module_utils/vendor/hcloud/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

VERSION = "1.31.0" # x-release-please-version
VERSION = "1.32.0" # x-release-please-version
42 changes: 33 additions & 9 deletions plugins/module_utils/vendor/hcloud/servers/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING, Any, NamedTuple

from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
Expand All @@ -21,6 +22,7 @@
PrivateNet,
PublicNetwork,
PublicNetworkFirewall,
RebuildResponse,
RequestConsoleResponse,
ResetPasswordResponse,
Server,
Expand Down Expand Up @@ -299,13 +301,18 @@ def create_image(
"""
return self._client.create_image(self, description, type, labels)

def rebuild(self, image: Image | BoundImage) -> BoundAction:
def rebuild(
self,
image: Image | BoundImage,
*,
return_response: bool = False,
) -> RebuildResponse | BoundAction:
"""Rebuilds a server overwriting its disk with the content of an image, thereby destroying all data on the target server.
:param image: :class:`BoundImage <hcloud.images.client.BoundImage>` or :class:`Image <hcloud.servers.domain.Image>`
:return: :class:`BoundAction <hcloud.actions.client.BoundAction>`
:param image: Image to use for the rebuilt server
:param return_response: Whether to return the full response or only the action.
"""
return self._client.rebuild(self, image)
return self._client.rebuild(self, image, return_response=return_response)

def change_type(
self,
Expand Down Expand Up @@ -930,20 +937,37 @@ def rebuild(
self,
server: Server | BoundServer,
image: Image | BoundImage,
) -> BoundAction:
*,
return_response: bool = False,
) -> RebuildResponse | BoundAction:
"""Rebuilds a server overwriting its disk with the content of an image, thereby destroying all data on the target server.
:param server: :class:`BoundServer <hcloud.servers.client.BoundServer>` or :class:`Server <hcloud.servers.domain.Server>`
:param image: :class:`BoundImage <hcloud.images.client.BoundImage>` or :class:`Image <hcloud.servers.domain.Image>`
:return: :class:`BoundAction <hcloud.actions.client.BoundAction>`
:param server: Server to rebuild
:param image: Image to use for the rebuilt server
:param return_response: Whether to return the full response or only the action.
"""
data: dict[str, Any] = {"image": image.id_or_name}
response = self._client.request(
url=f"/servers/{server.id}/actions/rebuild",
method="POST",
json=data,
)
return BoundAction(self._client.actions, response["action"])

rebuild_response = RebuildResponse(
action=BoundAction(self._client.actions, response["action"]),
root_password=response.get("root_password"),
)

if not return_response:
warnings.warn(
"Returning only the 'action' is deprecated, please set the "
"'return_response' keyword argument to 'True' to return the full "
"rebuild response and update your code accordingly.",
DeprecationWarning,
stacklevel=2,
)
return rebuild_response.action
return rebuild_response

def enable_backup(self, server: Server | BoundServer) -> BoundAction:
"""Enables and configures the automatic daily backup option for the server. Enabling automatic backups will increase the price of the server by 20%.
Expand Down
18 changes: 18 additions & 0 deletions plugins/module_utils/vendor/hcloud/servers/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,24 @@ def __init__(
self.password = password


class RebuildResponse(BaseDomain):
"""Rebuild Response Domain
:param action: Shows the progress of the server rebuild action
:param root_password: The root password of the server when not using SSH keys
"""

__slots__ = ("action", "root_password")

def __init__(
self,
action: BoundAction,
root_password: str | None,
):
self.action = action
self.root_password = root_password


class PublicNetwork(BaseDomain):
"""Public Network Domain
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/hcloud_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ def rebuild_server(self):
if not self.module.check_mode:
image = self._get_image(self.hcloud_server.server_type)
# When we rebuild the server progress takes some more time.
self.client.servers.rebuild(self.hcloud_server, image).wait_until_finished(1000)
resp = self.client.servers.rebuild(self.hcloud_server, image, return_response=True)
resp.action.wait_until_finished(1000)
self._mark_as_changed()

self._get_server()
Expand Down
2 changes: 1 addition & 1 deletion scripts/vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
logger = logging.getLogger("vendor")

HCLOUD_SOURCE_URL = "https://github.com/hetznercloud/hcloud-python"
HCLOUD_VERSION = "v1.31.0"
HCLOUD_VERSION = "v1.32.0"
HCLOUD_VENDOR_PATH = "plugins/module_utils/vendor/hcloud"


Expand Down

0 comments on commit 8c846f3

Please sign in to comment.