Rename audit -> auditlog and add support for changelog

main
Micke Nordin 2 months ago
parent f6915b3e4a
commit 35593bb503

@ -81,7 +81,7 @@ def run_add(url: str, jsonout: bool, headers: dict):
output(out, jsonout)
def run_audit(url: str, jsonout: bool, headers: dict):
def run_log(url: str, jsonout: bool, headers: dict):
response = requests.get(url, headers=headers)
string = response.content.decode("utf-8")
if jsonout:
@ -362,8 +362,12 @@ def main() -> int:
addcmd.add_argument("-t", "--ttl")
addcmd.add_argument("-z", "--zone", required=True)
audit_description = "Audit the log file for errors."
subparsers.add_parser("audit", description=audit_description)
auditlog_description = "Audit the log file for errors."
subparsers.add_parser("auditlog", description=auditlog_description)
changelog_description = "View the changelog of a zone."
changelogcmd = subparsers.add_parser("changelog", description=changelog_description)
changelogcmd.add_argument("-z", "--zone", required=True)
complete_description = "Generate shell completion script."
completecmd = subparsers.add_parser("completion", description=complete_description)
@ -482,8 +486,8 @@ def main() -> int:
soa_url = setup_url(baseurl, None, None, zname, "SOA", None, args.zone)
soa_json = run_list(soa_url, True, headers, ret=True)
ttl = soa_json[0]["ttl"]
if args.command == "audit":
url = baseurl + "/user/auditlog"
elif args.command in ["auditlog", "changelog"]:
pass
else:
try:
url = setup_url(
@ -508,8 +512,12 @@ def main() -> int:
run_list(url, args.json, headers)
elif args.command == "update":
run_update(url, args.json, headers)
elif args.command == "audit":
run_audit(url, args.json, headers)
elif args.command == "auditlog":
url = baseurl + "/user/auditlog"
run_log(url, args.json, headers)
elif args.command == "changelog":
url = baseurl + f"/zones/changelog/{args.zone.rstrip('.')}"
run_log(url, args.json, headers)
else:
parser.print_help(sys.stderr)
return 1

Loading…
Cancel
Save