Skip to content

Commit

Permalink
Avoid unexpected reordering of dictionaries from how it was specified…
Browse files Browse the repository at this point in the history
… in the JMESPath expression for the --query parameter.

Especially annoying when using the tsv output formatter....
  • Loading branch information
johanste committed Mar 30, 2016
1 parent 35b2b82 commit adaf644
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/azure/cli/extensions/query.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import collections

def register(event_dispatcher):
def handle_query_parameter(_, event_data):
try:
Expand All @@ -10,7 +12,6 @@ def handle_query_parameter(_, event_data):
else:
def filter_output(_, event_data):
import jmespath
event_data['result'] = jmespath.search(query_value, event_data['result'])

event_data['result'] = jmespath.search(query_value, event_data['result'], jmespath.Options(collections.OrderedDict))
event_dispatcher.register(event_dispatcher.FILTER_RESULT, filter_output)
event_dispatcher.register(event_dispatcher.REGISTER_GLOBAL_PARAMETERS, handle_query_parameter)

0 comments on commit adaf644

Please sign in to comment.