add failhard to the master config file

This commit is contained in:
Thomas S Hatch 2011-11-24 00:22:31 -07:00
parent d62254c1d0
commit e9b048d5b4
3 changed files with 10 additions and 1 deletions

View file

@ -50,6 +50,10 @@
#
# The renderer to use on the minions to render the state data
#renderer: yaml_jinja
#
# The failhard option tells the minions to stop immediately after the first
# failure detected in the state execution, defaults to False
#failhard: False
##### File Server settings #####
##########################################

View file

@ -61,6 +61,7 @@ def minion_config(path):
'cachedir': '/var/cache/salt',
'conf_file': path,
'renderer': 'yaml_jinja',
'failhard': False,
'disable_modules': [],
'disable_returners': [],
'module_dirs': [],
@ -122,6 +123,7 @@ def master_config(path):
'open_mode': False,
'auto_accept': False,
'renderer': 'yaml_jinja',
'failhard': False,
'state_top': 'top.sls',
'order_masters': False,
'log_file': '/var/log/salt/master',

View file

@ -424,7 +424,9 @@ class State(object):
Check if the low data chunk should send a failhard signal
'''
tag = '{0[state]}.{0[name]}.{0[fun]}'.format(low)
if low.get('failhard', False) and tag in running:
if low.get('failhard', False) \
or self.opts['failhard'] \
and tag in running:
if not running[tag]['result']:
return True
return False
@ -623,6 +625,7 @@ class HighState(object):
return opts
mopts = self.client.master_opts()
opts['renderer'] = mopts['renderer']
opts['failhard'] = mopts['failhard']
if mopts['state_top'].startswith('salt://'):
opts['state_top'] = mopts['state_top']
elif mopts['state_top'].startswith('/'):