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(a)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:
--
2.1.0