|
24 | 24 | 'PTR': PTRRecord, 'PX': PXRecord, 'NSAP': NSAPRecord, |
25 | 25 | 'RP': RPRecord, 'NS': NSRecord, 'SOA': SOARecord, |
26 | 26 | 'SPF': SPFRecord, 'SRV': SRVRecord, 'TLSA': TLSARecord, |
27 | | - 'TXT': TXTRecord, 'SSHFP': SSHFPRecord } |
| 27 | + 'TXT': TXTRecord, 'SSHFP': SSHFPRecord, 'UNKNOWN': UNKNOWNRecord} |
28 | 28 |
|
29 | 29 |
|
30 | 30 | def get_all_zones(): |
@@ -452,7 +452,10 @@ def get_all_records(self): |
452 | 452 | records = {} |
453 | 453 | for key, record_list in record_lists.items(): |
454 | 454 | search = key.split('_')[0].upper() |
455 | | - constructor = RECS[search] |
| 455 | + try: |
| 456 | + constructor = RECS[search] |
| 457 | + except KeyError: |
| 458 | + constructor = RECS['UNKNOWN'] |
456 | 459 | list_records = [] |
457 | 460 | for record in record_list: |
458 | 461 | del record['zone'] |
@@ -522,7 +525,10 @@ def get_any_records(self): |
522 | 525 | records = {} |
523 | 526 | for key, record_list in record_lists.items(): |
524 | 527 | search = key.split('_')[0].upper() |
525 | | - constructor = RECS[search] |
| 528 | + try: |
| 529 | + constructor = RECS[search] |
| 530 | + except KeyError: |
| 531 | + constructor = RECS['UNKNOWN'] |
526 | 532 | list_records = [] |
527 | 533 | for record in record_list: |
528 | 534 | del record['zone'] |
@@ -933,7 +939,10 @@ def get_all_records(self): |
933 | 939 | records = {} |
934 | 940 | for key, record_list in record_lists.items(): |
935 | 941 | search = key.split('_')[0].upper() |
936 | | - constructor = RECS[search] |
| 942 | + try: |
| 943 | + constructor = RECS[search] |
| 944 | + except KeyError: |
| 945 | + constructor = RECS['UNKNOWN'] |
937 | 946 | list_records = [] |
938 | 947 | for record in record_list: |
939 | 948 | del record['zone'] |
@@ -999,7 +1008,10 @@ def get_any_records(self): |
999 | 1008 | records = {} |
1000 | 1009 | for key, record_list in record_lists.items(): |
1001 | 1010 | search = key.split('_')[0].upper() |
1002 | | - constructor = RECS[search] |
| 1011 | + try: |
| 1012 | + constructor = RECS[search] |
| 1013 | + except KeyError: |
| 1014 | + constructor = RECS['UNKNOWN'] |
1003 | 1015 | list_records = [] |
1004 | 1016 | for record in record_list: |
1005 | 1017 | del record['zone'] |
|
0 commit comments