def sync_domains(self, pool_id, pool_target_id, batch_size): pool, target = self._get_config(pool_id, pool_target_id) client = impl_akamai.EnhancedDNSClient( target.options.get("username"), target.options.get("password")) LOG.info(_LI("Doing batches of %i") % batch_size) criterion = {"pool_id": pool_id} marker = None while (marker is not False): zones = self.central_api.find_domains( self.context, criterion, limit=batch_size, marker=marker) update = [] if len(zones) == 0: LOG.info(_LI("Stopping as there are no more zones.")) break else: marker = zones[-1]['id'] for zone in zones: z = impl_akamai.build_zone(client, target, zone) update.append(z) LOG.info(_LI('Uploading %d Zones') % len(update)) client.setZones(update)
def sync_zones(self, pool_id, pool_target_id, batch_size): pool, target = self._get_config(pool_id, pool_target_id) client = impl_akamai.EnhancedDNSClient(target.options.get("username"), target.options.get("password")) LOG.info("Doing batches of %i", batch_size) criterion = {"pool_id": pool_id} marker = None # Bug 1519356 - Init policy after configuration has been read policy.init() self.context.all_tenants = True while (marker is not False): zones = self.central_api.find_zones(self.context, criterion, limit=batch_size, marker=marker) update = [] if len(zones) == 0: LOG.info("Stopping as there are no more zones.") break else: marker = zones[-1]['id'] for zone in zones: z = impl_akamai.build_zone(client, target, zone) update.append(z) LOG.info('Uploading %d Zones', len(update)) client.setZones(update)
def debug_zone(self, pool_id, target_id, zone_name): pool, target = self._get_config(pool_id, target_id) client = impl_akamai.EnhancedDNSClient( target.options.get("username"), target.options.get("password")) zone = self.central_api.find_domain(self.context, {"name": zone_name}) akamai_zone = client.getZone(zone_name) print("Designate zone\n%s" % pformat(zone.to_dict())) print("Akamai Zone:\n%s" % repr(akamai_zone))
def debug_zone(self, pool_id, target_id, zone_name): pool, target = self._get_config(pool_id, target_id) client = impl_akamai.EnhancedDNSClient(target.options.get("username"), target.options.get("password")) # Bug 1519356 - Init policy after configuration has been read policy.init() self.context.all_tenants = True zone = self.central_api.find_zone(self.context, {"name": zone_name}) akamai_zone = client.getZone(zone_name) print("Designate zone\n%s" % pformat(zone.to_dict())) print("Akamai Zone:\n%s" % repr(akamai_zone))