Ejemplo n.º 1
0
def get_instance_state(request):
    if request.method == "POST":
        post = request.POST
        uuid = eval(post['data'])
        session = Session()
        instance = session.query(Instances).filter_by(uuid=uuid).all()
        return HttpResponse(simplejson.dumps(get_instances_list(instance)))
Ejemplo n.º 2
0
def instances_detail(request):
    session = Session()
    session.autoflush=True
    ins = session.query(Instances).all()
    final_instances = get_instances_detail(ins)
    return render('instances/instance_detail.html',{'instances':simplejson.dumps(final_instances)},request)
Ejemplo n.º 3
0
def instances_list(request):
    session = Session()
    session.autoflush=True
    ins = session.query(Instances).all()
    final_instances = get_instances_list(ins)
    return render('instances/instance_list.html',{'instances':final_instances},request)
Ejemplo n.º 4
0
                ipaddress = ip,
                uuid = uuid,
                notification_state = notification_data,
                moniting_state = moniting_data
            )
            instances.save()
        else:
            Instances_Config.objects.filter(uuid=uuid).update(
                notification_state = notification_data,
                moniting_state = moniting_data
            )
        return render('instances/notification.html',{'finish_update':True},request)
        
        
    uuid = uuid.strip()
    session = Session()
    instance = session.query(Instances).filter(Instances.uuid==uuid).all()
    final_instance = get_instances_list(instance)
    try:
        instance_config = Instances_Config.objects.get(uuid=uuid)
        final_instance_config = get_instances_config(instance_config)
    except:
        final_instance_config = None
    return render('instances/notification.html',{'instance_info':final_instance[0],'instance_config':final_instance_config},request)


@csrf_exempt
def instances_config(request):
    if request.method == "POST":
        instances_config = Instances_Config.objects.all().values()
        return HttpResponse(str(instances_config))