Merge pull request #42181 from garethgreenaway/42137_backport_fix_from_2017_7

fixes to state.py for names parameter
This commit is contained in:
Nicole Thomas 2017-07-11 15:21:31 -06:00 committed by GitHub
commit 7780579c36
3 changed files with 17 additions and 14 deletions

View file

@ -547,7 +547,7 @@ class Compiler(object):
continue
for state, run in six.iteritems(body):
funcs = set()
names = set()
names = []
if state.startswith('__'):
continue
chunk = {'state': state,
@ -564,7 +564,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)
@ -1287,7 +1289,7 @@ class State(object):
continue
for state, run in six.iteritems(body):
funcs = set()
names = set()
names = []
if state.startswith('__'):
continue
chunk = {'state': state,
@ -1306,7 +1308,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

@ -24,11 +24,10 @@ 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)
if __name__ == '__main__':