Add DNS record management module for Mail-in-a-Box
This commit is contained in:
19
set-record.py
Executable file
19
set-record.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import miab.dns as miab_dns
|
||||
import argparse
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Set a DNS record in Mail-in-a-Box")
|
||||
parser.add_argument("name", type=str, help="The name of the DNS record to set")
|
||||
parser.add_argument("value", type=str, help="The value of the DNS record to set")
|
||||
parser.add_argument("--type", type=str, default="A", help="The type of the DNS record (default: A)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
miab = miab_dns.MailInABox()
|
||||
response = miab.set_record(name=args.name, value=args.value, type=args.type)
|
||||
if response == "OK":
|
||||
print("Record set successfully.")
|
||||
else:
|
||||
print("Failed to set record.")
|
||||
Reference in New Issue
Block a user