Commit 0f8bc979 authored by Penom Nom's avatar Penom Nom
Browse files

No commit message

No commit message
parent 02bf0b3e
......@@ -28,8 +28,6 @@ def create_archive( ng6_username, email, data_folder, output_folder, ids_dump_pa
import shutil
import subprocess
import tarfile
import smtplib
from email.mime.text import MIMEText
from workflows.download.lib.utils import get_directories_structure_and_content
......@@ -57,20 +55,16 @@ def create_archive( ng6_username, email, data_folder, output_folder, ids_dump_pa
# send mail
try :
msg = MIMEText('Dear user, your archive is ready for download at the following link : %s'%web_archive)
msg['Subject'] = '[NG6] Archive ready to be downloaded'
msg['From'] = 'noreply@ng6-support.fr'
msg['To'] = email
s = smtplib.SMTP('localhost')
s.sendmail( 'noreply@ng6-support.fr' , [email], msg.as_string())
s.quit()
message = 'Dear user, your archive is ready for download at the following link : %s'%web_archive
subject = '[NG6] Archive ready to be downloaded'
subprocess.check_call( "echo '%s' | mail -s %s %s"%(message, subject, email) , shell = True)
except :
raise Exception('Unable to send mail')
class CreateArchive (Component):
def define_parameters(self, login, data_directory, email, data_ids = [], run_ids = [], analysis_ids = []):
self.add_parameter('login', 'The login of the user in ng6', required = True, type = 'ng6userlogin', default = login)
self.add_parameter('login', 'The login of the user in ng6', type = 'ng6userlogin', default = login)
self.add_parameter('data_directory', 'Where are stored all the datas', default = data_directory, required = True)
self.add_parameter('email', 'The email where the url to the archive will be sent', default = email, required = True)
self.add_parameter_list('data_ids', 'Ids of a run from which rawdata will be retrieved', default = data_ids)
......
......@@ -63,7 +63,7 @@ class CreateSymlink (Component):
def define_parameters(self, login, username, password, data_directory, user_directory, data_ids = [], run_ids = [], analysis_ids = []):
self.add_parameter('data_directory', 'data_directory', default = data_directory, required = True)
self.add_parameter('login', 'The login of the user in ng6', required = True, type = 'ng6userlogin', default = login)
self.add_parameter('login', 'The login of the user in ng6', type = 'ng6userlogin', default = login)
self.add_parameter('username', 'Valid username on the server', required = True, default = username)
self.add_parameter('password', 'A password for the usernmae on the server', required = True, default = password)
self.add_parameter('user_directory', 'Destination', required = True, default = user_directory)
......
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