Skip to content
Snippets Groups Projects
Commit d64a136b authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Return exit code in 'recall()' and 'migrate()' methods + fixed...

Return exit code in 'recall()' and 'migrate()' methods + fixed 'recallChecksumFiles()' method + minor changes.

Signed-off-by: default avatarCristiano Urban <cristiano.urban@inaf.it>
parent 89452ae7
No related branches found
No related tags found
No related merge requests found
......@@ -94,10 +94,10 @@ class TapeClient(object):
out = open("tape_client_log.txt", "a")
out.write("MIGRATE\n")
out.write(f"exitCode: {exitCode}\n")
out.write(f"stdout: {stdout}\n")
out.write(f"stderr: {stderr}\n\n")
out.close()
return exitCode
def recall(self, fileList):
"""
Recalls from tape all files whose absolute path is
......@@ -118,16 +118,16 @@ class TapeClient(object):
out = open("tape_client_log.txt", "a")
out.write("RECALL\n")
out.write(f"exitCode: {exitCode}\n")
out.write(f"stdout: {stdout}\n")
out.write(f"stderr: {stderr}\n\n")
out.close()
return exitCode
def recallChecksumFiles(self, dirName):
"""
Recursively recalls from tape all the checksum files related to
the 'dirName' directory.
"""
cmd = f"find $(dirname {dirName}) -type f \( -iname \"*-md5sum.txt\" \) | {self.EEADM}"
cmd = f"find $(dirname {dirName}) -type f \( -iname \"*-md5sum.txt\" \) | {self.EEADM} recall"
stdin, stdout, stderr = self.client.exec_command(cmd)
exitCode = stdout.channel.recv_exit_status()
......@@ -135,14 +135,9 @@ class TapeClient(object):
out = open("tape_client_log.txt", "a")
out.write("RECALL_CHECKSUM\n")
out.write(f"exitCode: {exitCode}\n")
out.write(f"stdout: {stdout}\n")
out.write(f"stderr: {stderr}\n\n")
out.close()
if exitCode:
return False
else:
return True
return exitCode
def disconnect(self):
"""Closes the connection."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment