[Kimchi-devel] [PATCH 2/6] isoinfo: Use absolute path only for local ISO files
Royce Lv
lvroyce at linux.vnet.ibm.com
Tue Dec 31 02:55:18 UTC 2013
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 2013年12月31日 01:09, Aline Manera wrote:
> 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):
More information about the Kimchi-devel
mailing list