(self, mirror_url)
return value
Make sure a mirror serves :attr:`distribution_codename`.

        :param mirror_url: The base URL of the mirror (a string).
        :returns: One of the values in the :class:`MirrorStatus` enumeration.
Make sure a mirror serves :attr:`distribution_codename`.
Make sure a mirror serves : attr : distribution_codename .
def validate_mirror(self, mirror_url):
        """
        Make sure a mirror serves :attr:`distribution_codename`.

        :param mirror_url: The base URL of the mirror (a string).
        :returns: One of the values in the :class:`MirrorStatus` enumeration.

        """
        mirror_url = normalize_mirror_url(mirror_url)
        key = (mirror_url, self.distribution_codename)
        value = self.validated_mirrors.get(key)
        if value is None:
            logger.info("Checking if %s is available on %s ..", self.release, mirror_url)
            # Try to download the Release.gpg file, in the assumption that
            # this file should always exist and is more or less guaranteed
            # to be relatively small.
            try:
                mirror = CandidateMirror(mirror_url=mirror_url, updater=self)
                mirror.release_gpg_contents = fetch_url(mirror.release_gpg_url, retry=False)
                value = (MirrorStatus.AVAILABLE if mirror.is_available else MirrorStatus.UNAVAILABLE)
            except NotFoundError:
                # When the mirror is serving 404 responses it can be an
                # indication that the release has gone end of life. In any
                # case the mirror is unavailable.
                value = MirrorStatus.MAYBE_EOL
            except Exception:
                # When we get an unspecified error that is not a 404
                # response we conclude that the mirror is unavailable.
                value = MirrorStatus.UNAVAILABLE
            # Cache the mirror status that we just determined.
            self.validated_mirrors[key] = value
        return value
def validate_mirror ( self , mirror_url ) : mirror_url = normalize_mirror_url ( mirror_url ) key = ( mirror_url , self . distribution_codename ) value = self . validated_mirrors . get ( key ) if value is None : logger . info ( "Checking if %s is available on %s .." , self . release , mirror_url ) # Try to download the Release.gpg file, in the assumption that # this file should always exist and is more or less guaranteed # to be relatively small. try : mirror = CandidateMirror ( mirror_url = mirror_url , updater = self ) mirror . release_gpg_contents = fetch_url ( mirror . release_gpg_url , retry = False ) value = ( MirrorStatus . AVAILABLE if mirror . is_available else MirrorStatus . UNAVAILABLE ) except NotFoundError : # When the mirror is serving 404 responses it can be an # indication that the release has gone end of life. In any # case the mirror is unavailable. value = MirrorStatus . MAYBE_EOL except Exception : # When we get an unspecified error that is not a 404 # response we conclude that the mirror is unavailable. value = MirrorStatus . UNAVAILABLE # Cache the mirror status that we just determined. self . validated_mirrors [ key ] = value return value