

def bootstrap(self, hostname):
    hostname = self._validate_host_name(hostname)
    host_source = None
    try:
        (host_data, host_source) = self._lookup_host(hostname)
        (host, host_created) = self._get_or_create_host(hostname, create=True)
        host.uses_ssl = host_data['ssl']
        (cdn, cdn_created) = self._get_or_create_cdn(host_data['cdn'], create=True)
        host.cdn = cdn
    except HostNotAvailableError:
        (host, host_created) = self._get_or_create_host(hostname, create=False)
        if (not host):
            raise
        (cdn, cdn_created) = (host.cdn, False)
    if (cdn_created or (cdn.edge_server is None)):
        try:
            (cdn_data, cdn_source) = host_source._lookup_cdn(cdn.id)
            cdn.name = cdn_data['name']
            cdn.edge_server = cdn_data['edge_server']
            cdn.save()
            logger.info(("CDN '%s' bootstrapped from '%s'" % (cdn, str(cdn_source))))
        except CDNNotAvailableError:
            host.is_active = False
            host.save()
            raise
    host.is_active = True
    host.save()
    if (host_source is not None):
        logger.info(("Host '%s' bootstrapped from '%s'" % (host, str(host_source))))
    return host

dataset/ETHPy150Open CacheBrowser/cachebrowser/cachebrowser/bootstrap.py Bootstrapper.bootstrap/VarMisuse@168/231 `self`->`host_source`