Esempio n. 1
0
 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)))
Esempio n. 2
0
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
Esempio n. 3
0
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)