In LUQueryGroups.Exec(), NiceSort was being applied to group UUIDs, and not to group names. We use a temporary name to UUID map to sort the list of UUIDs by group name instead.
Signed-off-by: Adeodato Simo <[email protected]> --- lib/cmdlib.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 523043d..be09c76 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -10450,13 +10450,14 @@ class LUQueryGroups(NoHooksLU): """ all_groups = self.cfg.GetAllNodeGroupsInfo() + name_to_uuid = dict((g.name, g.uuid) for g in all_groups.values()) if not self.op.names: - my_groups = utils.NiceSort(all_groups.keys()) + sorted_names = utils.NiceSort(name_to_uuid.keys()) + my_groups = [name_to_uuid[n] for n in sorted_names] else: # Accept names to be either names or UUIDs. all_uuid = frozenset(all_groups.keys()) - name_to_uuid = dict((g.name, g.uuid) for g in all_groups.values()) my_groups = [] missing = [] @@ -10502,8 +10503,8 @@ class LUQueryGroups(NoHooksLU): output = [] - for name in my_groups: - group = all_groups[name] + for uuid in my_groups: + group = all_groups[uuid] group_output = [] for field in self.op.output_fields: -- 1.7.3.1
