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

Sheldon shaohef at linux.vnet.ibm.com
Mon Jan 6 15:23:01 UTC 2014


Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

On 01/06/2014 11:05 PM, 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 3d57533..121241a 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):


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list