mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix issue when archive is on mapped drive
This commit is contained in:
parent
8008fca2f6
commit
980d99d74b
1 changed files with 17 additions and 7 deletions
|
@ -63,13 +63,23 @@ 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('/\\'),
|
||||
)
|
||||
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 network drive (Windows)
|
||||
if 'path is on drive' in exc.message:
|
||||
relpath = salt.utils.path_join(
|
||||
'network',
|
||||
os.path.splitdrive(path)[-1].lstrip('/\\'),
|
||||
)
|
||||
else:
|
||||
raise
|
||||
return salt.utils.path_join(__opts__['cachedir'], 'archive_hash', relpath)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue