mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
clean up mod_aggregate into a seperate method
also change it to use config.option
This commit is contained in:
parent
87b277f349
commit
203a09a6d4
@ -572,6 +572,20 @@ class State(object):
|
||||
return
|
||||
self.mod_init.add(low['state'])
|
||||
|
||||
def _mod_aggregate(self, low, running, chunks):
|
||||
'''
|
||||
Execute the aggregation systems to runtime modify the low chunk
|
||||
'''
|
||||
if self.functions['config.option']('mod_aggregate') and not low.get('__agg__'):
|
||||
agg_fun = '{0}.mod_aggregate'.format(low['state'])
|
||||
if agg_fun in self.states:
|
||||
try:
|
||||
low = self.states[agg_fun](low, chunks, running)
|
||||
low['__agg__'] = True
|
||||
except TypeError:
|
||||
log.error('Failed to execute aggregate for state {0}'.format(low['state']))
|
||||
return low
|
||||
|
||||
def load_modules(self, data=None):
|
||||
'''
|
||||
Load the modules into the state
|
||||
@ -1595,13 +1609,7 @@ class State(object):
|
||||
Check if a chunk has any requires, execute the requires and then
|
||||
the chunk
|
||||
'''
|
||||
if self.opts.get('state_aggregate') and not low.get('__agg__'):
|
||||
agg_fun = '{0}.mod_aggregate'.format(low['state'])
|
||||
if agg_fun in self.states:
|
||||
try:
|
||||
low = self.states[agg_fun](low, chunks, running)
|
||||
except TypeError:
|
||||
log.error('Failed to execute aggregate for state {0}'.format(low['state']))
|
||||
low = self._mod_aggregate(low, running, chunks)
|
||||
self._mod_init(low)
|
||||
tag = _gen_tag(low)
|
||||
if not low.get('prerequired'):
|
||||
|
Loading…
Reference in New Issue
Block a user