diff options
author | Fathi Boudra <fathi.boudra@linaro.org> | 2014-12-16 15:18:42 +0200 |
---|---|---|
committer | Fathi Boudra <fathi.boudra@linaro.org> | 2014-12-16 15:18:42 +0200 |
commit | a55bf1fd42bbb5316311c3ac6bfb29b5f746f8eb (patch) | |
tree | 95315e8fd684c0bf8f720527ec718d918f0ae750 | |
parent | e48548813f9da77df8c8248e82d8fe4d7c1f711d (diff) |
Ensure json are ordered
it's required for custom commands and customize feature. They are ordered.
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
-rwxr-xr-x | post-build-lava.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/post-build-lava.py b/post-build-lava.py index 68ab768..7dc5159 100755 --- a/post-build-lava.py +++ b/post-build-lava.py @@ -1,6 +1,7 @@ #!/usr/bin/python import base64 +import collections import os import sys import json @@ -217,7 +218,8 @@ def main(): print 'Error code: ', e.code sys.exit('Failed to get last successful artifact.') - config = json.dumps(json.load(response), indent=2) + config = json.dumps(json.load(response, object_pairs_hook=collections.OrderedDict), + indent=2, separators=(',', ': ')) lava_submit(config, lava_server) @@ -347,7 +349,7 @@ def main(): print 'Error code: ', e.code sys.exit('Failed to get last successful artifact.') - deploy_image_parameters.update(json.load(response)) + deploy_image_parameters.update(json.load(response, object_pairs_hook=collections.OrderedDict)) actions[0]['parameters'] = deploy_image_parameters @@ -368,7 +370,7 @@ def main(): print 'Error code: ', e.code sys.exit('Failed to get last successful artifact.') - metadata.update(json.load(response)) + metadata.update(json.load(response, object_pairs_hook=collections.OrderedDict)) actions[0]['metadata'] = metadata @@ -394,7 +396,7 @@ def main(): print 'Error code: ', e.code sys.exit('Failed to get last successful artifact.') - boot_image_parameters = json.load(response) + boot_image_parameters = json.load(response, object_pairs_hook=collections.OrderedDict) if {'command': 'boot_linaro_image'} not in actions: actions.append({ 'command': 'boot_linaro_image' @@ -435,7 +437,7 @@ def main(): hwpack_job_name, hwpack_build_number), 'device_type': device_type, - }, indent=2) + }, indent=2, separators=(',', ': ')) lava_submit(config, lava_server) |