Refactor "dns" to remove target-domain split
This commit is contained in:
parent
82c25edf8e
commit
810bf9acb5
8 changed files with 33 additions and 72 deletions
playbooks/filter_plugins
|
@ -53,11 +53,7 @@ class FilterModule(object):
|
|||
for service in services:
|
||||
if mon := service.get("monitoring"):
|
||||
if service.get("dns"):
|
||||
dns = service["dns"][0]
|
||||
url = "https://"
|
||||
if dns.get("target") != "@":
|
||||
url += f"{dns["target"]}."
|
||||
url += dns['domain']
|
||||
url = f"https://{service["dns"][0]['domain']}"
|
||||
|
||||
if mon_url := mon.get("url"):
|
||||
if mon_url.startswith("/"):
|
||||
|
|
|
@ -38,9 +38,11 @@ class FilterModule(object):
|
|||
for service in services:
|
||||
for dns in service.get("dns") or []:
|
||||
name = dns.get("name") or service["name"]
|
||||
domain_parts = dns["domain"].split(".")
|
||||
target_parts = domain_parts[:-2] or ["@"]
|
||||
result[name] = {
|
||||
"target": dns["target"],
|
||||
"domain": dns["domain"],
|
||||
"target": ".".join(target_parts),
|
||||
"domain": ".".join(domain_parts[-2:]),
|
||||
}
|
||||
|
||||
if dns.get("alias"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue