mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
Tests: mkdir_recursive: Don't fail when top-level directory doesn't exist
When the directory directly under root (e.g. /etc) did not exist, mkdir_recursive failed. Fix the issue.
This commit is contained in:
parent
dbf10b83bd
commit
e6c06b08d8
@ -87,10 +87,10 @@ class Transport(object):
|
||||
|
||||
def mkdir_recursive(self, path):
|
||||
"""`mkdir -p` on the remote host"""
|
||||
if not path or path == '/':
|
||||
raise ValueError('Invalid path')
|
||||
if not self.file_exists(path or '/'):
|
||||
self.mkdir_recursive(os.path.dirname(path))
|
||||
if not self.file_exists(path):
|
||||
parent_path = os.path.dirname(path)
|
||||
if path != parent_path:
|
||||
self.mkdir_recursive(parent_path)
|
||||
self.mkdir(path)
|
||||
|
||||
def get_file(self, remotepath, localpath):
|
||||
|
Loading…
Reference in New Issue
Block a user