mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixes #22959: Trying to add a directory to an unmapped drive in windows
This commit is contained in:
parent
3e9df883d6
commit
88e5495b2d
1 changed files with 8 additions and 0 deletions
|
@ -1675,6 +1675,14 @@ def directory(name,
|
|||
if not os.path.isdir(os.path.dirname(name)):
|
||||
# The parent directory does not exist, create them
|
||||
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'](
|
||||
name, user=user, group=group, mode=dir_mode
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue