mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge pull request #20076 from rallytime/fix_states_file_tests
Add some mocked variables to fix the file_test failures
This commit is contained in:
commit
d199edde20
@ -2009,11 +2009,13 @@ class State(object):
|
||||
)
|
||||
try:
|
||||
os.remove(accum_data_path)
|
||||
log.debug('Deleted accumulator data file %s',
|
||||
accum_data_path)
|
||||
log.debug('Deleted accumulator data file {0}'.format(
|
||||
accum_data_path)
|
||||
)
|
||||
except OSError:
|
||||
log.debug('File %s does not exist, no need to cleanup.',
|
||||
accum_data_path)
|
||||
log.debug('File {0} does not exist, no need to cleanup.'.format(
|
||||
accum_data_path)
|
||||
)
|
||||
_cleanup_accumulator_data()
|
||||
|
||||
return ret
|
||||
|
@ -974,7 +974,7 @@ def exists(name):
|
||||
if not name:
|
||||
return _error(ret, 'Must provide name to file.exists')
|
||||
if not os.path.exists(name):
|
||||
return _error(ret, ('Specified path {0} does not exist').format(name))
|
||||
return _error(ret, 'Specified path {0} does not exist'.format(name))
|
||||
|
||||
ret['comment'] = 'Path {0} exists'.format(name)
|
||||
return ret
|
||||
@ -995,7 +995,7 @@ def missing(name):
|
||||
if not name:
|
||||
return _error(ret, 'Must provide name to file.missing')
|
||||
if os.path.exists(name):
|
||||
return _error(ret, ('Specified path {0} exists').format(name))
|
||||
return _error(ret, 'Specified path {0} exists'.format(name))
|
||||
|
||||
ret['comment'] = 'Path {0} is missing'.format(name)
|
||||
return ret
|
||||
|
@ -18,7 +18,8 @@ import salt.states.file as filestate
|
||||
|
||||
filestate.__env__ = 'base'
|
||||
filestate.__salt__ = {'file.manage_file': False}
|
||||
filestate.__opts__ = {'test': False}
|
||||
filestate.__opts__ = {'test': False, 'cachedir': ''}
|
||||
filestate.__instance_id__ = ''
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
|
Loading…
Reference in New Issue
Block a user