Exemple #1
0
def salt_index(request):
    line_list = Line.objects.filter()
    business = Project.objects.filter(line__isnull=False)
    no_business = Project.objects.filter(line__isnull=True)
    # business = Project.objects.all()

    data = host_all()
    ztree_data = ztree_tag(request.user.username)

    idc_count = IDC.objects.all()

    idc_data = {}
    for idc in idc_count:
        idc_data[idc.name] = Host.objects.filter(idc=idc).count()
    user_count = CustomUser.objects.filter().count()

    department_count = department_Mode.objects.filter().count()
    # idc = IDC.objects.get(uuid='9cd9516af1454c619af617d92050fc99')
    # f = open("/Users/voilet/python_code/cmdb/doc/cmdb.txt", "r")
    # s = f.readlines()
    # for i in s:
    #     i = i.split()
    #     t = Host(eth1=i[0], number=i[1], Services_Code=i[3], server_sn=i[2], status=1, brand=u'Dell R420',
    #              idc=idc, system=u"CentOS")
    #     t.save()
    # f.close()

    return render_to_response('default/default.html', locals(), context_instance=RequestContext(request))
Exemple #2
0
def salt_index(request):
    line_list = Line.objects.filter()
    business = Project.objects.filter(line__isnull=False)
    no_business = Project.objects.filter(line__isnull=True)
    # business = Project.objects.all()

    data = host_all()
    ztree_data = ztree_tag(request.user.username)

    idc_count = IDC.objects.all()

    idc_data = {}
    for idc in idc_count:
        idc_data[idc.name] = Host.objects.filter(idc=idc).count()
    user_count = CustomUser.objects.filter().count()

    department_count = department_Mode.objects.filter().count()
    # idc = IDC.objects.get(uuid='9cd9516af1454c619af617d92050fc99')
    # f = open("/Users/voilet/python_code/cmdb/doc/cmdb.txt", "r")
    # s = f.readlines()
    # for i in s:
    #     i = i.split()
    #     t = Host(eth1=i[0], number=i[1], Services_Code=i[3], server_sn=i[2], status=1, brand=u'Dell R420',
    #              idc=idc, system=u"CentOS")
    #     t.save()
    # f.close()

    return render_to_response('default/default.html',
                              locals(),
                              context_instance=RequestContext(request))
def auto_index(request):
    status = check_auth(request, "auth_highstate")
    if not status:
        return render_to_response('default/error_auth.html', locals(), context_instance=RequestContext(request))

    content = {}
    line_list = Line.objects.filter()
    content["line_list"] = line_list
    content["business_noline"] = Project.objects.filter(line__isnull=True)
    content.update(csrf(request))
    data = host_all()

    return render_to_response('autoinstall/install_list.html', locals(), context_instance=RequestContext(request))
Exemple #4
0
def auto_index(request):
    status = check_auth(request, "auth_highstate")
    if not status:
        return render_to_response('default/error_auth.html',
                                  locals(),
                                  context_instance=RequestContext(request))

    content = {}
    line_list = Line.objects.filter()
    content["line_list"] = line_list
    content["business_noline"] = Project.objects.filter(line__isnull=True)
    content.update(csrf(request))
    data = host_all()

    return render_to_response('autoinstall/install_list.html',
                              locals(),
                              context_instance=RequestContext(request))