mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #26853 from UtahDave/2015.8local
Fix salt-cloud on windows
This commit is contained in:
commit
4c1abe41a7
@ -7,9 +7,15 @@ Utility functions for SMB connections
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
# Import python libs
|
||||||
|
import logging
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import impacket.smbconnection
|
import impacket.smbconnection
|
||||||
from impacket.smb3 import SessionError
|
from impacket.smbconnection import SessionError as smbSessionError
|
||||||
|
from impacket.smb3 import SessionError as smb3SessionError
|
||||||
HAS_IMPACKET = True
|
HAS_IMPACKET = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_IMPACKET = False
|
HAS_IMPACKET = False
|
||||||
@ -65,7 +71,8 @@ def mkdirs(path, share='C$', conn=None, host=None, username=None, password=None)
|
|||||||
cwd = '\\'.join(comps[0:pos])
|
cwd = '\\'.join(comps[0:pos])
|
||||||
try:
|
try:
|
||||||
conn.listPath(share, cwd)
|
conn.listPath(share, cwd)
|
||||||
except SessionError:
|
except (smbSessionError, smb3SessionError) as exc:
|
||||||
|
log.debug('Exception: {0}'.format(exc))
|
||||||
conn.createDirectory(share, cwd)
|
conn.createDirectory(share, cwd)
|
||||||
pos += 1
|
pos += 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user