MCPcopy Create free account
hub / github.com/adobe/Marinus / update_all_dns

Function update_all_dns

python3_cron_scripts/send_remote_server.py:157–174  ·  view source on GitHub ↗

Update the entire collection by deleting all previous records before inserting new records. Performing a zone by zone upload to minimize the chances of the zgrab script pulling a zone at the same time it is being deleted.

(logger, mongo_connector, rm_connector, zone_list)

Source from the content-addressed store, hash-verified

155
156
157def update_all_dns(logger, mongo_connector, rm_connector, zone_list):
158 """
159 Update the entire collection by deleting all previous records before
160 inserting new records.
161
162 Performing a zone by zone upload to minimize the chances of the zgrab script
163 pulling a zone at the same time it is being deleted.
164 """
165 logger.info("Starting All DNS..")
166 all_dns_collection = mongo_connector.get_all_dns_connection()
167 remote_all_dns_collection = rm_connector.get_all_dns_connection()
168
169 for zone in zone_list:
170 all_dns = all_dns_collection.find({"zone": zone}, {"_id": 0}).batch_size(50)
171
172 remote_all_dns_collection.delete_many({"zone": zone})
173 for ip_addr in all_dns:
174 remote_all_dns_collection.insert_one(ip_addr)
175
176
177def update_all_dns_diff_mode(

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected