[Yum-devel] [PATCH 2/2] Add dynamic yumvars from the filesystem.

Seth Vidal skvidal at fedoraproject.org
Fri Apr 9 20:16:35 UTC 2010



On Fri, 9 Apr 2010, James Antill wrote:
> +
> +Also note that all new line characters are removed, as a convienience, but no
> +other checking is performed on the data. This means it's possible to have bad
> +character data in baseurl etc.

maybe change this to:

Also note that only the first line will be read and all new line 
characters are removed, as a convenience. However, no other checking is 
performed on the data. This means it is possible to have bad character 
data in any value.

> +
> +    # Read the FS yumvars
> +    try:
> +        dir_fsvars = yumconf.persistdir + "/vars/"
> +        fsvars = os.listdir(dir_fsvars)
> +    except OSError:
> +        fsvars = []
> +    for fsvar in fsvars:

            if os.path.islink(fsvar):
                continue

- just to keep me from feeling creeped about ../../../.../....// things

> +        try:
> +            val = open(dir_fsvars + fsvar).read().replace('\n', '')

                val = open(dir_favars + fsvar).readline().replace('\n', '')

- it means we're only reading the one line and don't end up with someone 
complaining a giant amount of data read in.


> +        except (OSError, IOError):
> +            continue
> +        yumvars[fsvar] = val
> +
> +    # These can use the above FS yumvars
> +    for option in ('cachedir', 'logfile'):
> +        _apply_installroot(yumconf, option)
> +
>     # Add in some extra attributes which aren't actually configuration values
>     yumconf.yumvar = yumvars
>     yumconf.uid = 0


otherwise ack.
-sv



More information about the Yum-devel mailing list