Skip to content

Commit

Permalink
py33: sort the files parameters of "--files"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
skuicloud committed Oct 4, 2013
1 parent aadaf23 commit f14273d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion novaclient/base.py
Expand Up @@ -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:
Expand Down

0 comments on commit f14273d

Please sign in to comment.