[Kimchi-devel] [PATCH 1/3] Handle empty variables when updating YUM repository
Daniel Henrique Barboza
dhbarboza82 at gmail.com
Mon Mar 30 22:07:37 UTC 2015
Reviewed-by: Daniel Barboza <dhbarboza82 at gmail.com>
Tested-by: Daniel Barboza <dhbarboza82 at gmail.com>
This patch also fixes github #630 (test_repository_update in
test_model.py).
On 03/26/2015 04:49 PM, Aline Manera wrote:
>
> 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:
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
More information about the Kimchi-devel
mailing list