introduce remote_mkdir()

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-09 20:53:09 +02:00
parent db2562303a
commit 14ac0e3ad1

View file

@ -139,6 +139,10 @@ class Cdist:
log.error(*args) log.error(*args)
sys.exit(1) sys.exit(1)
def remote_mkdir(directory):
"""Create directory on remote side"""
self.run_or_fail(["mkdir", "-p", directory], remote=True)
def remote_cat(filename): def remote_cat(filename):
cmd = self.remote_prefix cmd = self.remote_prefix
cmd.append("cat") cmd.append("cat")
@ -234,14 +238,11 @@ class Cdist:
for content in os.listdir(starting_point): for content in os.listdir(starting_point):
full_path = os.path.join(starting_point, content) full_path = os.path.join(starting_point, content)
print(full_path)
if os.path.isdir(full_path): if os.path.isdir(full_path):
log.debug("Recursing for %s", full_path)
object_paths.extend(self.list_object_paths(starting_point = full_path)) object_paths.extend(self.list_object_paths(starting_point = full_path))
# Directory contains .cdist -> is an object # Directory contains .cdist -> is an object
if content == DOT_CDIST: if content == DOT_CDIST:
log.debug("Adding Object Path %s", starting_point)
object_paths.append(starting_point) object_paths.append(starting_point)
return object_paths return object_paths
@ -314,7 +315,7 @@ class Cdist:
# Only continue, if there is at least the directory # Only continue, if there is at least the directory
if os.path.isdir(src): if os.path.isdir(src):
# Ensure that the path exists # Ensure that the path exists
self.run_or_fail(["mkdir", "-p", remote_base], remote=True) self.remote_mkdir(remote_base)
self.transfer_dir(src, dst) self.transfer_dir(src, dst)