[Kimchi-devel] [PATCH 2/6] isoinfo: Use absolute path only for local ISO files

Aline Manera alinefm at linux.vnet.ibm.com
Mon Dec 30 17:09:40 UTC 2013


From: Aline Manera <alinefm at br.ibm.com>

When running isoinfo main program to probe a remote ISO file, it returned a
wrong path:

$ python kimchi/isoinfo.py http://localhost/Fedora-Live-Desktop-x86_64-19-1.iso
[{'path': '/home/alinefm/kimchi/src/http:/localhost/Fedora-Live-Desktop-x86_64-19-1.iso',
'version': '19', 'distro': 'fedora'}]

So verify the ISO is a local one and only use abspath() in this case.
Otherwise, use the path entried by user.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 src/kimchi/isoinfo.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/isoinfo.py b/src/kimchi/isoinfo.py
index 8f4738c..59cdd45 100644
--- a/src/kimchi/isoinfo.py
+++ b/src/kimchi/isoinfo.py
@@ -284,8 +284,8 @@ def probe_iso(status_helper, params):
 
     def update_result(iso, ret):
         if ret != ('unknown', 'unknown'):
-            iso = os.path.abspath(iso)
-            updater({'path': iso, 'distro': ret[0], 'version': ret[1]})
+            path = os.path.abspath(iso) if os.path.isfile(iso) else iso
+            updater({'path': path, 'distro': ret[0], 'version': ret[1]})
 
     if os.path.isdir(loc):
         for root, dirs, files in os.walk(loc):
-- 
1.7.10.4




More information about the Kimchi-devel mailing list