Esempio n. 1
0
def newKoala2User(request):
    """Generate directory structure for a new user in Koala2"""

    import paramiko
    from workflowCodeManager.form import koalaUserForm

    if request.method == 'POST':
        form = koalaUserForm(request.POST)
        if form.is_valid(): # All validation rules pass
            user = form.cleaned_data['user']
            password = form.cleaned_data['password']

            ssh = servicios.conexKoala2(paramiko)
            stdin, stdout, stderr = ssh.exec_command("sudo /home/django/Crear_nuevo_usuario_ftp '" + user + "'")
            out = stdout.readlines()
            err = stderr.readlines()
            ssh.close()

            return render_to_response('workflowCodeManager/newKoala2User.html', {'error': err, 'out': out, 'usuario': user, 'password': password}, context_instance=RequestContext(request))
        else:
            return render_to_response('workflowCodeManager/errorKoalaForm.html', {'form': form}, context_instance=RequestContext(request))
    else:
        err = "Esta funcion debe ser llamada con un metodo POST"
        return render_to_response('workflowCodeManager/error.html', {'error': err}, context_instance=RequestContext(request))
Esempio n. 2
0
def index(request):
	"""Show the index page with principal actions"""
	
	from workflowCodeManager.form import koalaUserForm
	formKoala = koalaUserForm()
	return render_to_response('workflowCodeManager/index.html', {'formKoala': formKoala}, context_instance=RequestContext(request))