Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enabled compatibility with legacy raw string literals yet again.
  • Loading branch information
springcomp committed Feb 27, 2023
commit 9e7a86a67792184feab2f19b4868337fd3038a23
6 changes: 4 additions & 2 deletions src/azure-cli-core/azure/cli/core/commands/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,12 @@ def show_exception_handler(ex):


def verify_property(instance, condition):
from jmespath import Options
from jmespath import compile as compile_jmespath
options = Options(dict_cls=OrderedDict, enable_legacy_literals=True)
result = todict(instance)
jmes_query = compile_jmespath(condition)
value = jmes_query.search(result)
jmes_query = compile_jmespath(condition, options)
value = jmes_query.search(result, options)
return value


Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli/azure/cli/command_modules/acs/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _aks_agentpool_table_format(result):
maxPods: maxPods,
provisioningState: provisioningState,
mode: mode
}""")
}""", Options(enable_legacy_literals=True))
# use ordered dicts so headers are predictable
# enable compatibility with legacy JSON literals
return parsed.search(result,
Expand Down Expand Up @@ -72,7 +72,7 @@ def _aks_table_format(result):
currentKubernetesVersion: currentKubernetesVersion,
provisioningState: provisioningState,
fqdn: fqdn || privateFqdn
}""")
}""", Options(enable_legacy_literals=True))
# use ordered dicts so headers are predictable
# enable compatibility with legacy JSON literals
return parsed.search(result,
Expand All @@ -96,7 +96,7 @@ def find_preview_versions(versions_bag):
resourceGroup: resourceGroup,
masterVersion: controlPlaneProfile.kubernetesVersion || `unknown`,
upgrades: controlPlaneProfile.upgrades[].kubernetesVersion || [`None available`] | sort_versions(@) | set_preview_array(@) | join(`, `, @)
}""")
}""", Options(enable_legacy_literals=True))
# use ordered dicts so headers are predictable
# enable compatibility with legacy JSON literals
return parsed.search(result,
Expand All @@ -117,7 +117,7 @@ def find_preview_versions():
parsed = compile_jmes("""orchestrators[].{
kubernetesVersion: orchestratorVersion | set_preview(@),
upgrades: upgrades[].orchestratorVersion || [`None available`] | sort_versions(@) | set_preview_array(@) | join(`, `, @)
}""")
}""", Options(enable_legacy_literals=True))

# use ordered dicts so headers are predictable
# enable compatibility with legacy JSON literals
Expand Down Expand Up @@ -145,7 +145,7 @@ def _aks_nodepool_snapshot_table_format(result):
kubernetesVersion: kubernetesVersion,
osType: osType,
enableFIPS: enableFIPS
}""")
}""", Options(enable_legacy_literals=True))
# use ordered dicts so headers are predictable
# enable compatibility with legacy JSON literals
return parsed.search(result,
Expand Down