Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No helpful output from host cname_show when there is no CNAME #153

Open
paalbra opened this issue Nov 3, 2021 · 0 comments
Open

No helpful output from host cname_show when there is no CNAME #153

paalbra opened this issue Nov 3, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@paalbra
Copy link
Contributor

paalbra commented Nov 3, 2021

host cname_show some-host-without-cnames.example.com. will complete silently. It would be nice if it said something about "No CNAMEs found".

mreg-cli/mreg_cli/host.py

Lines 1390 to 1414 in 5e6bda6

def cname_show(args):
"""Show CNAME records for host. If <name> is an alias the cname hosts
aliases are shown.
"""
try:
info = host_info_by_name(args.name)
for cname in info["cnames"]:
print_cname(cname["name"], info["name"])
cli_info("showed cname aliases for {}".format(info["name"]))
return
except HostNotFoundWarning:
# Try again with the alias
pass
name = clean_hostname(args.name)
path = "/api/v1/hosts/"
params = {
"cnames__name": name,
}
history.record_get(path)
hosts = get_list(path, params=params)
if len(hosts):
print_cname(name, hosts[0]["name"])
else:
cli_warning("No cname found for {}".format(name))

@paalbra paalbra added enhancement New feature or request good first issue Good for newcomers labels Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant