Merge pull request #13511 from cachedout/more_gitfs_fix

Create gitfs cache dir if does not exist
This commit is contained in:
Thomas S Hatch 2014-06-17 13:58:45 -06:00
commit 82c8440f09
2 changed files with 3 additions and 0 deletions

View file

@ -1150,6 +1150,8 @@ def file_hash(load, fnd):
'{0}.hash.{1}'.format(relpath,
__opts__['hash_type']))
if not os.path.isfile(hashdest):
if not os.path.exists(os.path.dirname(hashdest)):
os.makedirs(os.path.dirname(hashdest))
with salt.utils.fopen(path, 'rb') as fp_:
ret['hsum'] = getattr(hashlib, __opts__['hash_type'])(
fp_.read()).hexdigest()

View file

@ -131,6 +131,7 @@ class GitFSTest(integration.ModuleCase):
'sock_dir': self.master_opts['sock_dir'],
'hash_type': 'sha1'}):
tmp_load = LOAD.copy()
tmp_load['loc'] = 0
tmp_load['path'] = 'testfile'
fnd = {'rel': 'testfile',
'path': 'testfile'}