mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fixes #22959: Trying to add a directory to an unmapped drive in windows
This commit is contained in:
parent
3e9df883d6
commit
88e5495b2d
@ -1675,6 +1675,14 @@ def directory(name,
|
|||||||
if not os.path.isdir(os.path.dirname(name)):
|
if not os.path.isdir(os.path.dirname(name)):
|
||||||
# The parent directory does not exist, create them
|
# The parent directory does not exist, create them
|
||||||
if makedirs:
|
if makedirs:
|
||||||
|
# Make sure the drive is mapped before trying to create the
|
||||||
|
# path in windows
|
||||||
|
if salt.utils.is_windows():
|
||||||
|
drive, path = os.path.splitdrive(name)
|
||||||
|
if not os.path.isdir(drive):
|
||||||
|
return _error(
|
||||||
|
ret, 'Drive {0} is not mapped'.format(drive))
|
||||||
|
# Everything's good, create the path
|
||||||
__salt__['file.makedirs'](
|
__salt__['file.makedirs'](
|
||||||
name, user=user, group=group, mode=dir_mode
|
name, user=user, group=group, mode=dir_mode
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user