From 21674464360737f3837f25ed2f00284a0d178741 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 22 Sep 2010 09:34:12 +0200 Subject: [PATCH] Sort OS names and variants in LUDiagnoseOS The OS list and variants as returned from LUDiagnoseOS is not sorted, and gnt-instance reinstall doesn't sort it either. This means that it the menu that users are present with is inconsistent across clusters, and that is confusing. To make this consistent across all users of the LU, we sort the names in the LU itself. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/cmdlib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index d1ffec28f..052d4e00b 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3194,7 +3194,8 @@ class LUDiagnoseOS(NoHooksLU): output = [] cluster = self.cfg.GetClusterInfo() - for os_name, os_data in pol.items(): + for os_name in utils.NiceSort(pol.keys()): + os_data = pol[os_name] row = [] valid = True (variants, params, api_versions) = null_state = (set(), set(), set()) @@ -3231,7 +3232,7 @@ class LUDiagnoseOS(NoHooksLU): for node_name, nos_list in os_data.items(): val[node_name] = nos_list elif field == "variants": - val = list(variants) + val = utils.NiceSort(list(variants)) elif field == "parameters": val = list(params) elif field == "api_versions": -- GitLab