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