RFC: [PATCH] Add --includepkg argument

Chris Lumens clumens at redhat.com
Wed Nov 26 18:21:36 UTC 2014


I'll leave the merits of the rest of the patch to others to debate,
though I think this is a pretty clean approach.  Just wanted to comment
on one thing...

> diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
> index d4add39..8dc835e 100644
> --- a/src/pylorax/__init__.py
> +++ b/src/pylorax/__init__.py
> @@ -152,6 +152,7 @@ class Lorax(BaseLoraxClass):
>      def run(self, ybo, product, version, release, variant="", bugurl="",
>              isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None,
>              domacboot=True, doupgrade=True, remove_temp=False,
> +            includepkgs=[],
>              size=2,
>              add_templates=None,
>              add_template_vars=None):

Default arguments should never be an empty list or dict.  Search for
"python dangerous default value" for an explanation.

Typically, the way to do this in python is:

    def run(..., includepkgs=None, ...):
        if not includepkgs:
            includepkgs=[]

- Chris


More information about the anaconda-patches mailing list