1
0
Fork 0
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.10.0 (#728)

This commit is contained in:
renovate[bot] 2025-11-10 10:23:01 +01:00 committed by GitHub
parent 008045092e
commit 871bc897bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 75 additions and 38 deletions

View file

View file

@ -5,6 +5,8 @@ from typing import Literal
from ansible.errors import AnsibleFilterError
from ansible.module_utils.common.text.converters import to_native
from ..module_utils.vendor.hcloud.exp.zone import format_txt_record
# pylint: disable=unused-argument
def load_balancer_status(load_balancer: dict, *args, **kwargs) -> Literal["unknown", "unhealthy", "healthy"]:
@ -50,18 +52,11 @@ def load_balancer_status(load_balancer: dict, *args, **kwargs) -> Literal["unkno
# pylint: disable=unused-argument
def txt_record(record: str, *args, **kwargs) -> str:
"""
Return the status of a Load Balancer based on its targets.
Format a TXT record by splitting it in quoted strings of 255 characters.
Existing quotes will be escaped.
"""
try:
record = record.replace('"', '\\"')
parts = []
for start in range(0, len(record), 255):
end = min(start + 255, len(record))
parts.append('"' + record[start:end] + '"')
record = " ".join(parts)
return record
return format_txt_record(record)
except Exception as exc:
raise AnsibleFilterError(f"txt_record - {to_native(exc)}", orig_exc=exc) from exc