[Kimchi-devel] [PATCH V2 2/2] Support ppc64 isos in Templates: Filter remote isos and change UI

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Mar 6 15:27:30 UTC 2014


The patch is breaking tests ... I am fixing.
Sorry.

Rodrigo
On 03/06/2014 12:08 PM, Rodrigo Trujillo wrote:
> This patch filters remote isos that should be showed to user by the
> system architecture. The UI now shows the architecture of the remote
> iso and sort the names of the distros.
> If host architecture is not found, all remote ISOs will be showed.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
> ---
>   src/kimchi/distroloader.py      | 10 +++++++++-
>   src/kimchi/model/config.py      |  2 +-
>   ui/pages/template-add.html.tmpl |  8 ++++++--
>   3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py
> index daa5d5b..142cab6 100644
> --- a/src/kimchi/distroloader.py
> +++ b/src/kimchi/distroloader.py
> @@ -28,6 +28,11 @@ from kimchi.exception import NotFoundError, OperationFailed
>   from kimchi.utils import kimchi_log
>
>
> +ARCHS = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
> +         'amd64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
> +         'ppc64': ['ppc', 'ppc64']}
> +
> +
>   class DistroLoader(object):
>
>       def __init__(self, location=None):
> @@ -49,9 +54,12 @@ class DistroLoader(object):
>               raise OperationFailed("KCHDL0002E", msg_args)
>
>       def get(self):
> +        arch_list = ARCHS.get(os.uname()[4])
>           all_json_files = glob.glob("%s/%s" % (self.location, "*.json"))
>           distros = []
>           for f in all_json_files:
>               distros.extend(self._get_json_info(f))
>
> -        return dict([(distro['name'], distro) for distro in distros])
> +        # Return all remote ISOs arch not found
> +        return dict([(distro['name'], distro) for distro in distros if \
> +                     (arch_list is None or distro['os_arch'] in arch_list)])
> diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
> index e201737..5c90f0d 100644
> --- a/src/kimchi/model/config.py
> +++ b/src/kimchi/model/config.py
> @@ -91,7 +91,7 @@ class DistrosModel(object):
>           self.distros = distroloader.get()
>
>       def get_list(self):
> -        return self.distros.keys()
> +        return sorted(self.distros.keys())
>
>
>   class DistroModel(object):
> diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl
> index edce8d2..5c66753 100644
> --- a/ui/pages/template-add.html.tmpl
> +++ b/ui/pages/template-add.html.tmpl
> @@ -158,11 +158,15 @@
>                                                   <div class="iso-info-item" title="{os_distro}">
>                                                       $_("OS: "){os_distro}
>                                                   </div>
> -                                            </div>
> -                                            <div class="iso-info-col">
>                                                   <div class="iso-info-item" title="{os_version}">
>                                                       $_("Version: "){os_version}
>                                                   </div>
> +
> +                                            </div>
> +                                            <div class="iso-info-col">
> +                                                <div class="iso-info-item" title="{os_arch}">
> +                                                    $_("Arch: "){os_arch}
> +                                                </div>
>                                               </div>
>                                           </div>
>                                       </div>




More information about the Kimchi-devel mailing list