mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #1258 from jhutchins/top_warning
Add useful warning if top file can't be found.
This commit is contained in:
commit
005a71e2e3
@ -1418,6 +1418,25 @@ class BaseHighState(object):
|
|||||||
'''
|
'''
|
||||||
Run the sequence to execute the salt highstate for this minion
|
Run the sequence to execute the salt highstate for this minion
|
||||||
'''
|
'''
|
||||||
|
#Check that top file exists
|
||||||
|
crazy_name = 'no_|-states_|-states_|-None'
|
||||||
|
ret = {crazy_name: {
|
||||||
|
'result': False,
|
||||||
|
'comment': 'No states found for this minion',
|
||||||
|
'name': 'No States',
|
||||||
|
'changes': {},
|
||||||
|
'__run_num__': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_roots = self.opts['file_roots']['base'][0]
|
||||||
|
state_top = os.path.basename(self.opts['state_top'])
|
||||||
|
state_top = os.path.join(file_roots, state_top)
|
||||||
|
if not os.path.exists(state_top):
|
||||||
|
msg = 'Top file not found at {0}'.format(state_top)
|
||||||
|
ret[crazy_name]['comment'] = msg
|
||||||
|
return ret
|
||||||
|
|
||||||
|
#File exists so continue
|
||||||
err = []
|
err = []
|
||||||
top = self.get_top()
|
top = self.get_top()
|
||||||
err += self.verify_tops(top)
|
err += self.verify_tops(top)
|
||||||
@ -1428,14 +1447,7 @@ class BaseHighState(object):
|
|||||||
if err:
|
if err:
|
||||||
return err
|
return err
|
||||||
if not high:
|
if not high:
|
||||||
return {'no_|-states_|-states_|-None': {
|
return ret
|
||||||
'result': False,
|
|
||||||
'comment': 'No states found for this minion',
|
|
||||||
'name': 'No States',
|
|
||||||
'changes': {},
|
|
||||||
'__run_num__': 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return self.state.call_high(high)
|
return self.state.call_high(high)
|
||||||
|
|
||||||
def compile_highstate(self):
|
def compile_highstate(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user