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:
Thomas S Hatch 2015-01-26 20:38:53 -07:00
commit d199edde20
3 changed files with 10 additions and 7 deletions

View File

@ -2009,11 +2009,13 @@ class State(object):
)
try:
os.remove(accum_data_path)
log.debug('Deleted accumulator data file %s',
log.debug('Deleted accumulator data file {0}'.format(
accum_data_path)
)
except OSError:
log.debug('File %s does not exist, no need to cleanup.',
log.debug('File {0} does not exist, no need to cleanup.'.format(
accum_data_path)
)
_cleanup_accumulator_data()
return ret

View File

@ -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

View File

@ -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)