Example #1
0
    def handle_encrypted(my, base_dir, transaction_code, encrypted):

        key = my.ticket

        from_path = "%s/%s" % (base_dir, encrypted)
        tmp_dir = Environment.get_tmp_dir(include_ticket=True)
        if encrypted.endswith(".enc"):
            to_path = "%s/%s" % (tmp_dir, encrypted)
            to_path = to_path.replace(".enc", "")

            encrypt_util = EncryptUtil(key)
            encrypt_util.decrypt_file(from_path, to_path)

            zip_util = ZipUtil()
            to_dir = os.path.dirname(to_path)
            zip_util.extract(to_path)

        else:
            to_path = from_path
            to_dir = tmp_dir
            zip_util = ZipUtil()
            zip_util.extract(to_path, to_dir)

        dirname = encrypted.replace(".enc", "")
        dirname = dirname.replace(".zip", "")

        print "Running transaction: [%s]" % transaction_code
        my.handle_transaction(to_dir, transaction_code, dirname)
Example #2
0
    def handle_encrypted(my, base_dir, transaction_code, encrypted):

        key = my.ticket

        from_path = "%s/%s" % (base_dir, encrypted)
        tmp_dir = Environment.get_tmp_dir(include_ticket=True)
        if encrypted.endswith(".enc"):
            to_path = "%s/%s" % (tmp_dir, encrypted)
            to_path = to_path.replace(".enc", "")

            encrypt_util = EncryptUtil(key)
            encrypt_util.decrypt_file(from_path, to_path)


            zip_util = ZipUtil()
            to_dir = os.path.dirname(to_path)
            zip_util.extract(to_path)


        else:
            to_path = from_path
            to_dir = tmp_dir
            zip_util = ZipUtil()
            zip_util.extract(to_path, to_dir)



        dirname = encrypted.replace(".enc", "")
        dirname = dirname.replace(".zip", "")

        print "Running transaction: [%s]" % transaction_code
        my.handle_transaction(to_dir, transaction_code, dirname)