def _parse_os_release(*os_release_files):
    '''
    Parse os-release and return a parameter dictionary

    See http://www.freedesktop.org/software/systemd/man/os-release.html
    for specification of the file format.
    '''
    ret = {}
    for filename in os_release_files:
        try:
            with salt.utils.files.fopen(filename) as ifile:
                regex = re.compile('^([\\w]+)=(?:\'|")?(.*?)(?:\'|")?$')
                for line in ifile:
                    match = regex.match(line.strip())
                    if match:
                        # Shell special characters ("$", quotes, backslash,
                        # backtick) are escaped with backslashes
                        ret[match.group(1)] = re.sub(
                            r'\\([$"\'\\`])', r'\1', match.group(2)
                        )
            break
        except (IOError, OSError):
            pass

    return ret
def _parse_os_release ( * os_release_files ) : ret = { } for filename in os_release_files : try : with salt . utils . files . fopen ( filename ) as ifile : regex = re . compile ( '^([\\w]+)=(?:\'|")?(.*?)(?:\'|")?$' ) for line in ifile : match = regex . match ( line . strip ( ) ) if match : ret [ match . group ( 1 ) ] = re . sub ( r'\\([$"\'\\`])' , r'\1' , match . group ( 2 ) ) break except ( IOError , OSError ) : pass return ret
Parse os-release and return a parameter dictionary

    See http://www.freedesktop.org/software/systemd/man/os-release.html
    for specification of the file format.