[Kimchi-devel] [PATCH] Github issue #630: fixing None.strip() error

Daniel Henrique Barboza dhbarboza82 at gmail.com
Mon Mar 30 16:49:42 UTC 2015


This simple patch fixes the scenario in repositories.py where
baseurl or mirrorlist is None and the code was executing baseurl.strip()
and mirrorlist.strip(), leading to errors in tests/test_model.py
(test_repository_update) and probably other bugs.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.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:
-- 
1.9.3




More information about the Kimchi-devel mailing list