(cls, lxd_container)
return found
Detects if the container is an "instance" of the considered OS.

        The operations defined in this method assume that OS/distribution information will be
        available through the analysis of files such as ""/etc/os-release", ""/etc/lsb_release" or
        ""/etc/issue". This classmethod should be overriden if these methods cannot be applied to
        the considered OS/distribution.
Detects if the container is an "instance" of the considered OS.
Detects if the container is an instance of the considered OS .
def detect(cls, lxd_container):
        """ Detects if the container is an "instance" of the considered OS.

        The operations defined in this method assume that OS/distribution information will be
        available through the analysis of files such as ""/etc/os-release", ""/etc/lsb_release" or
        ""/etc/issue". This classmethod should be overriden if these methods cannot be applied to
        the considered OS/distribution.
        """
        candidates = [
            ('/etc/os-release', '(id|ID)="?{}"?'.format(cls.name.lower())),
            ('/etc/lsb_release', '(id|ID)="?{}"?'.format(cls.name.lower())),
            ('/etc/issue', cls.name.lower()),
        ]
        found = False
        for candidate, pattern in candidates:
            try:
                candidate_filecontent = lxd_container.files.get(candidate)
            except NotFound:
                continue
            found = len(re.findall(pattern, str(candidate_filecontent.lower()))) > 0
            if found:
                break
        return found
def detect ( cls , lxd_container ) : candidates = [ ( '/etc/os-release' , '(id|ID)="?{}"?' . format ( cls . name . lower ( ) ) ) , ( '/etc/lsb_release' , '(id|ID)="?{}"?' . format ( cls . name . lower ( ) ) ) , ( '/etc/issue' , cls . name . lower ( ) ) , ] found = False for candidate , pattern in candidates : try : candidate_filecontent = lxd_container . files . get ( candidate ) except NotFound : continue found = len ( re . findall ( pattern , str ( candidate_filecontent . lower ( ) ) ) ) > 0 if found : break return found