[Kimchi-devel] [PATCH 1/3] Handle empty variables when updating YUM repository

Aline Manera alinefm at linux.vnet.ibm.com
Thu Mar 26 19:49:41 UTC 2015


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 24/03/2015 15:16, Crístian Viana wrote:
> When the user tries to update a YUM repository and some of the variables
> are not passed, the code will try to use those variables anyway and an
> exception will be raised.
>
> Check if some YUM repository variables are empty before using them.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
>   src/kimchi/repositories.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py
> index f1e1eb3..19c5810 100644
> --- a/src/kimchi/repositories.py
> +++ b/src/kimchi/repositories.py
> @@ -275,10 +275,10 @@ class YumRepo(object):
>           config = params.get('config', {})
>           mirrorlist = config.get('mirrorlist', None)
>   
> -        if len(baseurl.strip()) == 0:
> +        if baseurl is not None and len(baseurl.strip()) == 0:
>               baseurl = None
>   
> -        if len(mirrorlist.strip()) == 0:
> +        if mirrorlist is not None and len(mirrorlist.strip()) == 0:
>               mirrorlist = None
>   
>           if baseurl is None and mirrorlist is None:




More information about the Kimchi-devel mailing list