我正在处理默认路径中的文件,然后阅读以进行验证。如果读取失败,我需要备份副本再次在默认路径中复制,然后阅读。
现在的逻辑如下,任何人都可以建议在备份路径中复制语法,然后在失败的情况下从bakcup复制到默认值吗?
#Copying the dump
cpdump = "cp -rf "+dumpconst.HMC_DEFAULT_DUMP_OFFLOAD_PATH + i_dump_name + \
" "+destPath
self.TestLog("Copying dump file "+i_dump_name+" to path==>"+destPath)
try:
l_fw_con.su_command(suid, destName, suPasswd,cpdump,suIdPasswd)
except LcbCommandsError,e:
raise DumpHelperError(FWErrors.SYSDUMP_SETUP_ERROR,\
"Unable to copy the dump file.Reason:"+e.Reason)
except SshConnectionError,e:
raise DumpHelperError(FWErrors.SYSDUMP_SETUP_ERROR,e.Reason)
self.TestLog("Dump file copy to mount path==>[COMPLETED]")
dump_verify_tool = dumpconst.DUMP_VERIFICATION_TOOL_DIR + \
dumpconst.DUMP_VERIFICATION_UTIL
self.TestLog("Dump content verification==>[IN PROGRESS]")
#Run the content verification
try:
cmd = dump_verify_tool + mountPoint+"/dumps/"+i_dump_name
l_result = lcbcmd.suLcbExecute(cmd)
except (LcbConnectionError, LcbCommandsError) as e:
self.ErrorLog(str(e))
raise DumpHelperError(FWErrors.SYSDUMP_SETUP_ERROR,\
"Dump verification tool execution failed. " +
"Reason: " + e.Reason)