[Kimchi-devel] [PATCH v2 1/3] Handle empty variables when updating YUM repository
Crístian Viana
vianac at linux.vnet.ibm.com
Tue Mar 31 19:02:24 UTC 2015
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:
--
2.1.0
More information about the Kimchi-devel
mailing list