mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-09-19 22:12:04 +00:00
deps: update dependency hcloud to v1.32.0 (#389)
[![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 ([#​276](https://togithub.com/hetznercloud/hcloud-python/issues/276)) ([38e098a](38e098a411
)) ##### Dependencies - update dependency mypy to >=1.7,<1.8 ([#​325](https://togithub.com/hetznercloud/hcloud-python/issues/325)) ([7b59a2d](7b59a2decc
)) - update pre-commit hook pre-commit/mirrors-prettier to v3.1.0 ([#​326](https://togithub.com/hetznercloud/hcloud-python/issues/326)) ([213b661](213b661d89
)) - update pre-commit hook psf/black-pre-commit-mirror to v23.10.1 ([#​322](https://togithub.com/hetznercloud/hcloud-python/issues/322)) ([999afe3](999afe37e0
)) - update pre-commit hook psf/black-pre-commit-mirror to v23.11.0 ([#​324](https://togithub.com/hetznercloud/hcloud-python/issues/324)) ([7b2a24e](7b2a24ecf6
)) </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 <ljonas@riseup.net>
This commit is contained in:
parent
2e82e0e6ef
commit
8c846f3b68
5 changed files with 55 additions and 12 deletions
|
@ -1,3 +1,3 @@
|
|||
from __future__ import annotations
|
||||
|
||||
VERSION = "1.31.0" # x-release-please-version
|
||||
VERSION = "1.32.0" # x-release-please-version
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from typing import TYPE_CHECKING, Any, NamedTuple
|
||||
|
||||
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
|
||||
|
@ -21,6 +22,7 @@ from .domain import (
|
|||
PrivateNet,
|
||||
PublicNetwork,
|
||||
PublicNetworkFirewall,
|
||||
RebuildResponse,
|
||||
RequestConsoleResponse,
|
||||
ResetPasswordResponse,
|
||||
Server,
|
||||
|
@ -299,13 +301,18 @@ class BoundServer(BoundModelBase, Server):
|
|||
"""
|
||||
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,
|
||||
|
@ -930,12 +937,14 @@ class ServersClient(ClientEntityBase):
|
|||
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(
|
||||
|
@ -943,7 +952,22 @@ class ServersClient(ClientEntityBase):
|
|||
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%.
|
||||
|
|
|
@ -247,6 +247,24 @@ class RequestConsoleResponse(BaseDomain):
|
|||
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
|
||||
|
||||
|
|
|
@ -853,7 +853,8 @@ class AnsibleHCloudServer(AnsibleHCloud):
|
|||
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()
|
||||
|
|
|
@ -20,7 +20,7 @@ from textwrap import dedent
|
|||
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"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue