mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #47827 from twangboy/fix_47791
Fix issue when archive is on mapped drive
This commit is contained in:
commit
5c56b8c755
@ -63,14 +63,28 @@ def _gen_checksum(path):
|
||||
|
||||
|
||||
def _checksum_file_path(path):
|
||||
relpath = '.'.join((os.path.relpath(path, __opts__['cachedir']), 'hash'))
|
||||
if re.match(r'..[/\\]', relpath):
|
||||
# path is a local file
|
||||
relpath = salt.utils.path_join(
|
||||
'local',
|
||||
os.path.splitdrive(path)[-1].lstrip('/\\'),
|
||||
)
|
||||
return salt.utils.path_join(__opts__['cachedir'], 'archive_hash', relpath)
|
||||
try:
|
||||
relpath = '.'.join((os.path.relpath(path, __opts__['cachedir']), 'hash'))
|
||||
if re.match(r'..[/\\]', relpath):
|
||||
# path is a local file
|
||||
relpath = salt.utils.path_join(
|
||||
'local',
|
||||
os.path.splitdrive(path)[-1].lstrip('/\\'),
|
||||
)
|
||||
except ValueError as exc:
|
||||
# The path is on a different drive (Windows)
|
||||
if str(exc).startswith('path is on'):
|
||||
drive, path = os.path.splitdrive(path)
|
||||
relpath = salt.utils.path_join(
|
||||
'local',
|
||||
drive.rstrip(':'),
|
||||
path.lstrip('/\\'),
|
||||
)
|
||||
else:
|
||||
raise
|
||||
ret = salt.utils.path_join(__opts__['cachedir'], 'archive_hash', relpath)
|
||||
log.debug('Using checksum file %s for cached archive file %s', ret, path)
|
||||
return ret
|
||||
|
||||
|
||||
def _update_checksum(path):
|
||||
|
Loading…
Reference in New Issue
Block a user