2009/8/12 Luca Bigliardi <shamm...@google.com>:
> --- a/lib/backend.py
> +++ b/lib/backend.py
> +def _GenerateUserUploadFileList():
> +  try:
> +    extra_files = set(utils.ReadFile(constants.EXTRA_REDIST).splitlines())
> +  except EnvironmentError, err:

Please make the exception handling more specific to where the
exception would actually happen (I guess ReadFile).

> +    msg = ("Not allowing redistribution of extra files from %s : %s" %
> +           (constants.EXTRA_REDIST, err.strerror))
> +    logging.warning(msg)

Why use an extra variable?

> +    return frozenset()
> +
> +  return frozenset(extra_files)

Why convert list to set first and then to a frozenset? You can do it
in one go (frozenset([])).

> --- a/lib/cmdlib.py
> +++ b/lib/cmdlib.py
> @@ -1785,6 +1785,19 @@ def _RedistributeAncillaryFiles(lu, 
> additional_nodes=None):
>     hv_class = hypervisor.GetHypervisor(hv_name)
>     dist_files.update(hv_class.GetAncillaryFiles())
>
> +  try:
> +    extra_dist_list = utils.ReadFile(constants.EXTRA_REDIST).splitlines()
> +    for file in extra_dist_list:
> +      if os.path.isabs(file):
> +        dist_files.update([file])
> +      else:
> +        msg = ("Not redistributing %s : not absolute path" % file)

No space after %s ("… ing %s: no absolute path").

> +        lu.proc.LogInfo(msg)

Why an extra variable?

> +  except EnvironmentError, err:

Make exception handling more specific (see above).

> +    msg = ("Not redistributing extra files from %s : %s" %
> +           (constants.EXTRA_REDIST, err.strerror))

No space before colon.

Regards,
Michael

Reply via email to