Ejemplo n.º 1
0
 def setupPushThanksCmd(self):
     '''
     called by TransferBase to setup the command that pushes a ThankYou file 
     to the target
     '''
     if self.thankyou_file_path != None:
         try:
             os.remove(self.thankyou_file_path)
         except:
             pass
     # there should be no issue here as this is only called after
     # a receipt file has been proven to be valid
     try:
         rcpt = ReceiptFile(self.rcpt_file_path)
         rcpt_data = rcpt.read()
     except Exception, err:
         self.info("push thanks setup fail %s" % err)
         return ""
Ejemplo n.º 2
0
from TransferModules.TransferUtils import TransferUtils
from ReceiptFile import ReceiptFile
if __name__ == '__main__':
    if len(sys.argv) == 2:
        print sys.argv
        if sys.argv[1] == "--checkVars":
            s = MiStaMoverController.MiStaMoverController("test/conf/ftp_global.ini")
            d = s.dconfigs['ftp']
            r = FtpTransfer(d)
            r.checkVars()
            r.setFile("testfile")
            print r.setupStopFileCmd()
            print r.setupPushCmd()
            print r.setupPullRcptCmd()
            # create a dummy receipt file
            rf = ReceiptFile(r.config.get("data_stream.directory") + "/" + "." + r.getFile() + "." + \
                r.config.get("outgoing.receipt_file_extension"))
            data_file_name = r.getFile()
            rcpt_args = [data_file_name] + [0, 12, "ac761519fdaf77899202c34692d64c98"]
            ts = TransferUtils.timeStamp()
            thankyou_file_name = (".%s.%s%s" %
                              (r.getFile(),
                               ts,
                               r.config.get("outgoing.thankyou_file_extension")))
            kwargs = {"thankyou_file": thankyou_file_name}
            rf.create(*rcpt_args, **kwargs)
            r.rcpt_file_path = "test/." + r.getFile() + "." + r.config.get("outgoing.receipt_file_extension") 
            print r.setupPushThanksCmd()
            try:
                os.remove("test/testfiles/." + r.getFile() + "." + r.config.get("outgoing.control_file_extension"))
                os.remove("test/testfiles/." + r.getFile() + "." + r.config.get("outgoing.receipt_file_extension"))
            except Exception, ex: