(self)
Get the information items from the specified distro release file.

        Returns:
            A dictionary containing all information items.
Get the information items from the specified distro release file.
Get the information items from the specified distro release file .
def _distro_release_info(self):
        """
        Get the information items from the specified distro release file.

        Returns:
            A dictionary containing all information items.
        """
        if self.distro_release_file:
            # If it was specified, we use it and parse what we can, even if
            # its file name or content does not match the expected pattern.
            distro_info = self._parse_distro_release_file(
                self.distro_release_file)
            basename = os.path.basename(self.distro_release_file)
            # The file name pattern for user-specified distro release files
            # is somewhat more tolerant (compared to when searching for the
            # file), because we want to use what was specified as best as
            # possible.
            match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
            if 'name' in distro_info \
               and 'cloudlinux' in distro_info['name'].lower():
                distro_info['id'] = 'cloudlinux'
            elif match:
                distro_info['id'] = match.group(1)
            return distro_info
        else:
            try:
                basenames = os.listdir(_UNIXCONFDIR)
                # We sort for repeatability in cases where there are multiple
                # distro specific files; e.g. CentOS, Oracle, Enterprise all
                # containing `redhat-release` on top of their own.
                basenames.sort()
            except OSError:
                # This may occur when /etc is not readable but we can't be
                # sure about the *-release files. Check common entries of
                # /etc for information. If they turn out to not be there the
                # error is handled in `_parse_distro_release_file()`.
                basenames = ['SuSE-release',
                             'arch-release',
                             'base-release',
                             'centos-release',
                             'fedora-release',
                             'gentoo-release',
                             'mageia-release',
                             'mandrake-release',
                             'mandriva-release',
                             'mandrivalinux-release',
                             'manjaro-release',
                             'oracle-release',
                             'redhat-release',
                             'sl-release',
                             'slackware-version']
            for basename in basenames:
                if basename in _DISTRO_RELEASE_IGNORE_BASENAMES:
                    continue
                match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
                if match:
                    filepath = os.path.join(_UNIXCONFDIR, basename)
                    distro_info = self._parse_distro_release_file(filepath)
                    if 'name' in distro_info:
                        # The name is always present if the pattern matches
                        self.distro_release_file = filepath
                        distro_info['id'] = match.group(1)
                        if 'cloudlinux' in distro_info['name'].lower():
                            distro_info['id'] = 'cloudlinux'
                        return distro_info
            return {}
def _distro_release_info ( self ) : if self . distro_release_file : # If it was specified, we use it and parse what we can, even if # its file name or content does not match the expected pattern. distro_info = self . _parse_distro_release_file ( self . distro_release_file ) basename = os . path . basename ( self . distro_release_file ) # The file name pattern for user-specified distro release files # is somewhat more tolerant (compared to when searching for the # file), because we want to use what was specified as best as # possible. match = _DISTRO_RELEASE_BASENAME_PATTERN . match ( basename ) if 'name' in distro_info and 'cloudlinux' in distro_info [ 'name' ] . lower ( ) : distro_info [ 'id' ] = 'cloudlinux' elif match : distro_info [ 'id' ] = match . group ( 1 ) return distro_info else : try : basenames = os . listdir ( _UNIXCONFDIR ) # We sort for repeatability in cases where there are multiple # distro specific files; e.g. CentOS, Oracle, Enterprise all # containing `redhat-release` on top of their own. basenames . sort ( ) except OSError : # This may occur when /etc is not readable but we can't be # sure about the *-release files. Check common entries of # /etc for information. If they turn out to not be there the # error is handled in `_parse_distro_release_file()`. basenames = [ 'SuSE-release' , 'arch-release' , 'base-release' , 'centos-release' , 'fedora-release' , 'gentoo-release' , 'mageia-release' , 'mandrake-release' , 'mandriva-release' , 'mandrivalinux-release' , 'manjaro-release' , 'oracle-release' , 'redhat-release' , 'sl-release' , 'slackware-version' ] for basename in basenames : if basename in _DISTRO_RELEASE_IGNORE_BASENAMES : continue match = _DISTRO_RELEASE_BASENAME_PATTERN . match ( basename ) if match : filepath = os . path . join ( _UNIXCONFDIR , basename ) distro_info = self . _parse_distro_release_file ( filepath ) if 'name' in distro_info : # The name is always present if the pattern matches self . distro_release_file = filepath distro_info [ 'id' ] = match . group ( 1 ) if 'cloudlinux' in distro_info [ 'name' ] . lower ( ) : distro_info [ 'id' ] = 'cloudlinux' return distro_info return { }