Example #1
0
        print("* Warning: deleting dangerous record:")
        print(list_record)

    if not dangerous or args.include_dangerous:
        delete_records.append(list_record)

delete_commands = []

for delete_record in delete_records:
    delete_commands.append("DELETE " + delete_record)

# Send all the DELETE and new zone entries in one transaction
sync_commands = []
sync_commands.extend(delete_commands)
for zone_record in zone_records:
    if not zone_validate.skip_zone_record(zone_record):
        sync_commands.append(" ".join(zone_record.split()))

if not args.quiet:
    for cmd in sync_commands:
        print(cmd)

if args.perform_sync:
    sync_response = api.call(sync_commands)
    if sync_response.status_code == 200:
        if not args.quiet:
            print(sync_response.text)
        responses = sync_response.text.splitlines()
        # This assumes the API replies in same order as requested
        error = False
        for a, b in zip(sync_commands, responses):
 def test_skip_zone_record_comment(self):
     self.assertTrue(V.skip_zone_record("#"))
     self.assertTrue(V.skip_zone_record(" # "))
     self.assertTrue(V.skip_zone_record("    # blah blah "))
 def test_skip_zone_record_noncomment(self):
     self.assertFalse(V.skip_zone_record("test"))
     self.assertFalse(V.skip_zone_record("     test     "))
     self.assertFalse(V.skip_zone_record("   blah # blah blah "))
 def test_skip_zone_record_blank(self):
     self.assertTrue(V.skip_zone_record(""))
     self.assertTrue(V.skip_zone_record("   "))
     self.assertTrue(V.skip_zone_record("".ljust(200)))