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

Function update_ip_zones

python3_cron_scripts/send_remote_server.py:58–79  ·  view source on GitHub ↗

Copy all of the currently known CIDRs to the remote database.

(logger, mongo_connector, rm_connector)

Source from the content-addressed store, hash-verified

56
57
58def 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
82def update_config(logger, mongo_connector, rm_connector):

Callers 1

mainFunction · 0.85

Calls 2

get_ipzone_connectionMethod · 0.45

Tested by

no test coverage detected