Copy all of the currently known CIDRs to the remote database.
(logger, mongo_connector, rm_connector)
| 56 | |
| 57 | |
| 58 | def update_ip_zones(logger, mongo_connector, rm_connector): |
| 59 | """ |
| 60 | Copy all of the currently known CIDRs to the remote database. |
| 61 | """ |
| 62 | logger.info("Starting IPZones..") |
| 63 | ipzones_collection = mongo_connector.get_ipzone_connection() |
| 64 | remote_ipzones_collection = rm_connector.get_ipzone_connection() |
| 65 | |
| 66 | ipzones = ipzones_collection.find({}, {"_id": 0}) |
| 67 | |
| 68 | remote_ipzones_collection.delete_many({}) |
| 69 | for zone in ipzones: |
| 70 | remote_ipzones_collection.insert_one(zone) |
| 71 | |
| 72 | ipv6_zones_collection = mongo_connector.get_ipv6_zone_connection() |
| 73 | remote_ipv6_zones_collection = rm_connector.get_ipv6_zone_connection() |
| 74 | |
| 75 | ipv6_zones = ipv6_zones_collection.find({}, {"_id": 0}) |
| 76 | |
| 77 | remote_ipv6_zones_collection.delete_many({}) |
| 78 | for zone in ipv6_zones: |
| 79 | remote_ipv6_zones_collection.insert_one(zone) |
| 80 | |
| 81 | |
| 82 | def update_config(logger, mongo_connector, rm_connector): |
no test coverage detected