mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
make sure OrderedDict order is preserved in output
sorted(ret) will sort the keys on their own, discarding the original order of the OrderedDict.
This commit is contained in:
parent
ec59ae67c8
commit
625a770a23
1 changed files with 9 additions and 1 deletions
|
@ -25,6 +25,7 @@ Example output::
|
|||
'''
|
||||
from __future__ import absolute_import
|
||||
# Import python libs
|
||||
import collections
|
||||
from numbers import Number
|
||||
|
||||
# Import salt libs
|
||||
|
@ -127,7 +128,14 @@ class NestDisplay(object):
|
|||
'----------'
|
||||
)
|
||||
)
|
||||
for key in sorted(ret):
|
||||
|
||||
# respect key ordering of ordered dicts
|
||||
if isinstance(ret, collections.OrderedDict):
|
||||
keys = ret.keys()
|
||||
else:
|
||||
keys = sorted(ret)
|
||||
|
||||
for key in keys:
|
||||
val = ret[key]
|
||||
out.append(
|
||||
self.ustring(
|
||||
|
|
Loading…
Add table
Reference in a new issue