예제 #1
0
def index(request):
    tenant_id = request.user.tenant_id
    delete_form, handled = DeleteGroup.maybe_handle(request, initial={"tenant_id": tenant_id})
    form = CreateGroup(initial={"tenant_id": tenant_id})
    if handled:
        return handled

    try:
        security_groups = api.security_group_list(request)
    except novaclient_exceptions.ClientException, e:
        security_groups = []
        LOG.exception("ClientException in security_groups index")
        messages.error(request, _("Error fetching security_groups: %s") % e.message)
예제 #2
0
파일: views.py 프로젝트: ehazlett/horizon
def index(request):
    tenant_id = request.user.tenant_id
    delete_form, handled = DeleteGroup.maybe_handle(
        request, initial={'tenant_id': tenant_id})
    form = CreateGroup(initial={'tenant_id': tenant_id})
    if handled:
        return handled

    try:
        security_groups = api.security_group_list(request)
    except novaclient_exceptions.ClientException, e:
        security_groups = []
        LOG.exception("ClientException in security_groups index")
        messages.error(request,
                       _('Error fetching security_groups: %s') % e.message)
예제 #3
0
파일: views.py 프로젝트: ehazlett/horizon
        LOG.exception("ClientException in floating ip index")
        messages.error(request,
                    _('Error fetching floating ips: %s') % e.message)
    try:
        keypairs = api.keypair_list(request)
    except novaclient_exceptions.ClientException, e:
        keypairs = []
        LOG.exception("ClientException in keypair index")
        messages.error(request, _('Error fetching keypairs: %s') % e.message)

    context = {'keypairs': keypairs,
               'floating_ips': floating_ips,
               'security_groups': security_groups,
               'keypair_delete_form': DeleteKeypair(),
               'disassociate_form': FloatingIpDisassociate(),
               'release_form': ReleaseFloatingIp(),
               'allocate_form': FloatingIpAllocate(initial={
                                        'tenant_id': request.user.tenant_id}),
               'sec_group_create_form': CreateGroup(
                                            initial={'tenant_id': tenant_id}),
               'sec_group_delete_form': DeleteGroup.maybe_handle(request,
                                            initial={'tenant_id': tenant_id})}

    if request.is_ajax():
        template = 'nova/access_and_security/index_ajax.html'
        context['hide'] = True
    else:
        template = 'nova/access_and_security/index.html'

    return shortcuts.render(request, template, context)