Get the list of domains based on zones
(all_dns_collection, ip_manager, zone)
| 67 | |
| 68 | |
| 69 | def get_domains(all_dns_collection, ip_manager, zone): |
| 70 | """ |
| 71 | Get the list of domains based on zones |
| 72 | """ |
| 73 | zone_results = all_dns_collection.find({"zone": zone, "type": "a"}) |
| 74 | |
| 75 | domains = [] |
| 76 | for result in zone_results: |
| 77 | if result["fqdn"] not in domains and not ip_manager.is_local_ip( |
| 78 | result["value"] |
| 79 | ): |
| 80 | domains.append(result["fqdn"]) |
| 81 | |
| 82 | random.shuffle(domains) |
| 83 | return domains |
| 84 | |
| 85 | |
| 86 | def insert_result(entry, results_collection): |