Commit 039f85c8 authored by Gary Ruben's avatar Gary Ruben
Browse files

Change counting newlines to calling splitlines() to account for a last line having no newline.

parent 4f3fa6ec
......@@ -112,10 +112,6 @@ def tar_and_send_directory(node):
echo=True
)
files = files.stdout.strip()
# if not c.is_connected():
# print(f'Connection failed on {node.src}')
# node.error = "Connection failure on initial file find"
# return
node.count = len(files.splitlines())
print(f'Node:{node.src}, file count:{node.count}')
......@@ -146,9 +142,6 @@ def tar_and_send_directory(node):
f"ssh {REMOTE_LOGIN} 'cd {node.src};"
f"find -maxdepth 1 -type f -print0 |"
f"cpio -o -H ustar -0' | cat > {node.dest}/{filename}.tar",
# f"ssh {REMOTE_LOGIN} 'cd {node.src};"
# rf"find -maxdepth 1 -type f -printf '%f\n' -print0 | tee >(md5sum >)"
# f"cpio -o -H ustar -0' | cat > {node.dest}/{filename}.tar",
shell=True,
check=True
)
......@@ -185,7 +178,7 @@ if __name__ == "__main__":
# Get the directory tree from remote server as a list
with Connection(REMOTE_LOGIN) as c:
result = c.run(f'find {SRC_PATH} -type d')
remote_dirs = result.stdout.strip().split('\n')
remote_dirs = result.stdout.strip().splitlines()
# Create a tree data structure that represents both source and
# destination tree paths.
......
......@@ -148,7 +148,7 @@ if __name__ == "__main__":
# Get the directory tree from remote server as a list
with Connection(REMOTE_LOGIN) as c:
result = c.run(f'find {SRC_PATH} -type d')
remote_dirs = result.stdout.strip().split('\n')
remote_dirs = result.stdout.strip().splitlines()
# Create a tree data structure that represents both source and
# destination tree paths.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment