[PATCH] error when editing repository entry with no mirrorlist.

After edit a repository entry that contains only the baseurl field, the new content of the entry will not be stored due to an error when using '' string to the mirrorlist field. File "/home/pvital/git/kimchi-test-upstream/src/kimchi/repositories.py", line 267, in updateRepo entry.mirrorlist = mirrorlist File "/usr/lib/python2.7/site-packages/yum/config.py", line 102, in __set__ value, str(e))) ValueError: Error parsing "mirrorlist = u''": URL must be http, ftp, file or https not "" This patch fixes the issue with a verification of the mirrorlist before process it. Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- src/kimchi/repositories.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py index ba432ef..414f146 100644 --- a/src/kimchi/repositories.py +++ b/src/kimchi/repositories.py @@ -262,6 +262,9 @@ class YumRepo(object): if baseurl is not None: entry.baseurl = baseurl + if mirrorlist == '': + mirrorlist = None + if mirrorlist is not None: entry.mirrorlist = mirrorlist -- 1.8.3.1

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 04/11/2014 12:11 AM, Paulo Vital wrote:
After edit a repository entry that contains only the baseurl field, the new content of the entry will not be stored due to an error when using '' string to the mirrorlist field.
File "/home/pvital/git/kimchi-test-upstream/src/kimchi/repositories.py", line 267, in updateRepo entry.mirrorlist = mirrorlist File "/usr/lib/python2.7/site-packages/yum/config.py", line 102, in __set__ value, str(e))) ValueError: Error parsing "mirrorlist = u''": URL must be http, ftp, file or https not ""
This patch fixes the issue with a verification of the mirrorlist before process it.
Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- src/kimchi/repositories.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py index ba432ef..414f146 100644 --- a/src/kimchi/repositories.py +++ b/src/kimchi/repositories.py @@ -262,6 +262,9 @@ class YumRepo(object): if baseurl is not None: entry.baseurl = baseurl
+ if mirrorlist == '': + mirrorlist = None + if mirrorlist is not None: entry.mirrorlist = mirrorlist
participants (2)
-
Aline Manera
-
Paulo Vital