Don't expect any ordering from sets!!!!!

This commit is contained in:
Pedro Algarvio 2017-03-03 18:24:44 +00:00
parent 08eba84cfb
commit adacf4cc28
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
3 changed files with 17 additions and 14 deletions

View File

@ -566,7 +566,7 @@ class Compiler(object):
continue
for state, run in six.iteritems(body):
funcs = set()
names = set()
names = []
if state.startswith('__'):
continue
chunk = {'state': state,
@ -583,7 +583,9 @@ class Compiler(object):
if isinstance(arg, dict):
for key, val in six.iteritems(arg):
if key == 'names':
names.update(val)
for _name in val:
if _name not in names:
names.append(_name)
continue
else:
chunk.update(arg)
@ -1266,7 +1268,7 @@ class State(object):
continue
for state, run in six.iteritems(body):
funcs = set()
names = set()
names = []
if state.startswith('__'):
continue
chunk = {'state': state,
@ -1285,7 +1287,9 @@ class State(object):
if isinstance(arg, dict):
for key, val in six.iteritems(arg):
if key == 'names':
names.update(val)
for _name in val:
if _name not in names:
names.append(_name)
elif key == 'state':
# Don't pass down a state override
continue

View File

@ -1,9 +1,9 @@
handle-iorder:
cmd:
- cwd: /tmp/ruby-1.9.2-p320
- names:
- ./configure
- make
- make install
- run
- cwd: /tmp/ruby-1.9.2-p320
- names:
- ./configure
- make
- make install
- run

View File

@ -20,8 +20,7 @@ class HandleOrderTest(integration.ModuleCase):
'''
ret = self.run_function('state.show_low_sls', mods='issue-7649-handle-iorder')
sorted_chunks = sorted(ret, key=lambda c: c.get('order'))
sorted_chunks = [chunk['name'] for chunk in sorted(ret, key=lambda c: c.get('order'))]
self.assertEqual(sorted_chunks[0]['name'], './configure')
self.assertEqual(sorted_chunks[1]['name'], 'make')
self.assertEqual(sorted_chunks[2]['name'], 'make install')
expected = ['./configure', 'make', 'make install']
self.assertEqual(expected, sorted_chunks)