From f14273d1e07a6a7ffe49044d894a81cda48ed8ad Mon Sep 17 00:00:00 2001 From: Kui Shi Date: Fri, 4 Oct 2013 08:08:44 +0800 Subject: [PATCH] py33: sort the files parameters of "--files" In Python 3.3, hash randomization is enabled by default. It causes the iteration order of dicts and sets to be unpredictable and differ across Python runs. Sort the files parameters when multiple files are designated. Close-Bug #1235096 Change-Id: I0db645b3fb92408bd8c6780bfabe7ce8265a65a8 --- novaclient/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/novaclient/base.py b/novaclient/base.py index a5dad823f..d270b316e 100644 --- a/novaclient/base.py +++ b/novaclient/base.py @@ -353,7 +353,8 @@ def _boot(self, resource_url, response_key, name, image, flavor, # either an open file *or* some contents as files here. if files: personality = body['server']['personality'] = [] - for filepath, file_or_string in files.items(): + for filepath, file_or_string in sorted(files.items(), + key=lambda x: x[0]): if hasattr(file_or_string, 'read'): data = file_or_string.read() else: