Copy all the currently known FLDs to the remote database.
(logger, mongo_connector, rm_connector, update_zone_list)
| 33 | |
| 34 | |
| 35 | def update_zones(logger, mongo_connector, rm_connector, update_zone_list): |
| 36 | """ |
| 37 | Copy all the currently known FLDs to the remote database. |
| 38 | """ |
| 39 | logger.info("Starting Zones..") |
| 40 | zones_collection = mongo_connector.get_zone_connection() |
| 41 | remote_zones_collection = rm_connector.get_zone_connection() |
| 42 | |
| 43 | zones = zones_collection.find({}, {"_id": 0}) |
| 44 | zone_list = [] |
| 45 | |
| 46 | if update_zone_list: |
| 47 | remote_zones_collection.delete_many({}) |
| 48 | for zone in zones: |
| 49 | remote_zones_collection.insert_one(zone) |
| 50 | zone_list.append(zone["zone"]) |
| 51 | else: |
| 52 | for zone in zones: |
| 53 | zone_list.append(zone["zone"]) |
| 54 | |
| 55 | return zone_list |
| 56 | |
| 57 | |
| 58 | def update_ip_zones(logger, mongo_connector, rm_connector): |
no test coverage detected