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
This commit is contained in:
Kui Shi 2013-10-04 08:08:44 +08:00
parent aadaf23b5e
commit f14273d1e0
1 changed files with 2 additions and 1 deletions

View File

@ -353,7 +353,8 @@ class BootingManagerWithFind(ManagerWithFind):
# 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: