def nsupdate_cmd(name, domain, host_records):
"""
Create nsupdate command line.
"""
pathname = "%s.%s." % (name, domain)
cmd = "server %s\n" % (DNS_SERVER1,)
cmd += "zone %s.\n" % (domain,)
cmd += "update delete %s\n" % (pathname,)
for rec in host_records:
cmd += "update add %s %d %s %s\n" % (pathname, rec[4], rec[2], rec[3])
cmd += "show\n"
cmd += "send\n"
return cmd.encode('utf-8')
评论列表
文章目录