mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
chore(deps): update dependency hcloud to v2.5.0 (#626)
This commit is contained in:
parent
c37cdf0bc6
commit
cf220a229f
5 changed files with 24 additions and 7 deletions
|
|
@ -4,11 +4,15 @@ from typing import Any
|
||||||
|
|
||||||
|
|
||||||
class HCloudException(Exception):
|
class HCloudException(Exception):
|
||||||
"""There was an error while using the hcloud library"""
|
"""There was an error while using the hcloud library.
|
||||||
|
|
||||||
|
All exceptions in the hcloud library inherit from this exception. It may be used as
|
||||||
|
catch-all exception.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class APIException(HCloudException):
|
class APIException(HCloudException):
|
||||||
"""There was an error while performing an API Request"""
|
"""There was an error while performing an API Request."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
__version__ = "2.4.0" # x-releaser-pleaser-version
|
__version__ = "2.5.0" # x-releaser-pleaser-version
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,22 @@ class ActionException(HCloudException):
|
||||||
def __init__(self, action: Action | BoundAction):
|
def __init__(self, action: Action | BoundAction):
|
||||||
assert self.__doc__ is not None
|
assert self.__doc__ is not None
|
||||||
message = self.__doc__
|
message = self.__doc__
|
||||||
if action.error is not None and "message" in action.error:
|
|
||||||
|
extras = []
|
||||||
|
if (
|
||||||
|
action.error is not None
|
||||||
|
and "code" in action.error
|
||||||
|
and "message" in action.error
|
||||||
|
):
|
||||||
message += f": {action.error['message']}"
|
message += f": {action.error['message']}"
|
||||||
|
|
||||||
|
extras.append(action.error["code"])
|
||||||
|
else:
|
||||||
|
extras.append(action.command)
|
||||||
|
|
||||||
|
extras.append(str(action.id))
|
||||||
|
message += f" ({', '.join(extras)})"
|
||||||
|
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.message = message
|
self.message = message
|
||||||
self.action = action
|
self.action = action
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ from textwrap import dedent
|
||||||
logger = logging.getLogger("vendor")
|
logger = logging.getLogger("vendor")
|
||||||
|
|
||||||
HCLOUD_SOURCE_URL = "https://github.com/hetznercloud/hcloud-python"
|
HCLOUD_SOURCE_URL = "https://github.com/hetznercloud/hcloud-python"
|
||||||
HCLOUD_VERSION = "v2.4.0"
|
HCLOUD_VERSION = "v2.5.0"
|
||||||
HCLOUD_VENDOR_PATH = "plugins/module_utils/vendor/hcloud"
|
HCLOUD_VENDOR_PATH = "plugins/module_utils/vendor/hcloud"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ def test_hcloud_fail_json_hcloud(module):
|
||||||
hcloud.fail_json_hcloud(exception)
|
hcloud.fail_json_hcloud(exception)
|
||||||
# pylint: disable=unreachable
|
# pylint: disable=unreachable
|
||||||
module.fail_json.assert_called_with(
|
module.fail_json.assert_called_with(
|
||||||
msg="The pending action failed: Server does not exist anymore",
|
msg="The pending action failed: Server does not exist anymore (server_does_not_exist_anymore, 1084730887)",
|
||||||
exception=traceback.format_exc(),
|
exception=traceback.format_exc(),
|
||||||
failure={
|
failure={
|
||||||
"action": {
|
"action": {
|
||||||
|
|
@ -103,7 +103,7 @@ def test_hcloud_fail_json_hcloud(module):
|
||||||
hcloud.fail_json_hcloud(exception)
|
hcloud.fail_json_hcloud(exception)
|
||||||
# pylint: disable=unreachable
|
# pylint: disable=unreachable
|
||||||
module.fail_json.assert_called_with(
|
module.fail_json.assert_called_with(
|
||||||
msg="The pending action timed out",
|
msg="The pending action timed out (create_server, 1084659545)",
|
||||||
exception=traceback.format_exc(),
|
exception=traceback.format_exc(),
|
||||||
failure={
|
failure={
|
||||||
"action": {
|
"action": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue