def cdn_list(self): """ List CDNs registered with CacheBrowser """ cdns = CDN.select() for cdn in cdns: self.send_line("%*s: %s" % (15, cdn.id, ' '.join(cdn.addresses)))
def bootstrap_host(hostname): if hostname not in _host_db: logging.info("Host %s could not be bootstrapped" % hostname) return False cdn_id, uses_ssl = _host_db[hostname] try: cdn = CDN.get(id=cdn_id) except CDN.DoesNotExist: bootstrap_cdn(cdn_id) cdn = CDN.get(id=cdn_id) Host.create(url=hostname, cdn=cdn, ssl=uses_ssl) return True
def bootstrap_cdn(cdn_id): if cdn_id not in _cdn_db: logging.info("CDN %s could not be bootstrapped" % cdn_id) addresses = _cdn_db[cdn_id] CDN.create(id=cdn_id, name=cdn_id, addresses=addresses)