From ebca6f7a6a4171598b07b332363002fa051e4a71 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Mon, 26 Sep 2011 14:39:03 -0700 Subject: [PATCH] Fixed issue 858649 on Launchpad -- Distinguishes between tenant name and tenant id. The recent changes to keystone switched from sending the tenant id to sending the tenant name as "tenant", thus breaking various tenant-related calls. This patch differentiates the two and names them as separate attributes on request.user. It also switches to using novaclient for the api.tenant_quota_get function. --- django-openstack/django_openstack/api.py | 6 +++--- .../django_openstack/dash/views/containers.py | 2 +- .../dash/views/floating_ips.py | 8 ++++---- .../django_openstack/dash/views/images.py | 6 +++--- .../django_openstack/dash/views/instances.py | 2 +- .../django_openstack/dash/views/networks.py | 6 +++--- .../django_openstack/dash/views/ports.py | 4 ++-- .../django_openstack/middleware/keystone.py | 19 +++++++++++-------- .../django_openstack/dash/_sidebar.html | 16 ++++++++-------- .../dash/containers/_list.html | 4 ++-- .../dash/containers/index.html | 4 ++-- .../dash/floating_ips/_list.html | 2 +- .../dash/floating_ips/index.html | 2 +- .../django_openstack/dash/images/_list.html | 2 +- .../django_openstack/dash/images/index.html | 2 +- .../dash/instances/_list.html | 8 ++++---- .../dash/instances/index.html | 6 +++--- .../dash/instances/update.html | 4 ++-- .../dash/instances/usage.html | 2 +- .../dash/keypairs/create.html | 2 +- .../django_openstack/dash/keypairs/index.html | 6 +++--- .../dash/networks/_detail.html | 2 +- .../django_openstack/dash/networks/_list.html | 4 ++-- .../dash/networks/create.html | 2 +- .../dash/networks/detail.html | 6 +++--- .../django_openstack/dash/networks/index.html | 6 +++--- .../dash/networks/rename.html | 2 +- .../django_openstack/dash/objects/_list.html | 4 ++-- .../django_openstack/dash/objects/copy.html | 2 +- .../django_openstack/dash/objects/index.html | 6 +++--- .../django_openstack/dash/objects/upload.html | 2 +- .../django_openstack/dash/ports/attach.html | 2 +- .../django_openstack/dash/ports/create.html | 2 +- .../dash/security_groups/_list.html | 2 +- .../dash/security_groups/index.html | 6 +++--- .../dash/snapshots/create.html | 2 +- .../dash/snapshots/index.html | 4 ++-- .../syspanel/instances/_list.html | 4 ++-- .../syspanel/instances/index.html | 2 +- django-openstack/django_openstack/test.py | 11 ++++++----- .../tests/view_tests/auth_tests.py | 2 +- .../tests/view_tests/dash/container_tests.py | 4 ++-- .../tests/view_tests/dash/network_tests.py | 8 ++++---- .../tests/view_tests/dash/port_tests.py | 12 ++++++------ .../dashboard/templates/_topbar.html | 6 +++--- 45 files changed, 110 insertions(+), 106 deletions(-) diff --git a/django-openstack/django_openstack/api.py b/django-openstack/django_openstack/api.py index ab0822688..12000b17d 100644 --- a/django-openstack/django_openstack/api.py +++ b/django-openstack/django_openstack/api.py @@ -374,7 +374,7 @@ def novaclient(request): ' and url "%s"' % (request.user.token, url_for(request, 'nova'))) c = client.Client(username=request.user.username, api_key=request.user.token, - project_id=request.user.tenant, + project_id=request.user.tenant_id, auth_url=url_for(request, 'nova')) c.client.auth_token = request.user.token c.client.management_url=url_for(request, 'nova') @@ -400,7 +400,7 @@ def swift_api(request): def quantum_api(request): tenant = None if hasattr(request, 'user'): - tenant = request.user.tenant + tenant = request.user.tenant_id else: tenant = settings.QUANTUM_TENANT @@ -634,7 +634,7 @@ def token_create_scoped_with_token(request, tenant, token): def tenant_quota_get(request, tenant): - return admin_api(request).quota_sets.get(tenant) + return novaclient(request).quotas.get(tenant) @check_openstackx diff --git a/django-openstack/django_openstack/dash/views/containers.py b/django-openstack/django_openstack/dash/views/containers.py index b3e9ab94e..cf63bccd5 100644 --- a/django-openstack/django_openstack/dash/views/containers.py +++ b/django-openstack/django_openstack/dash/views/containers.py @@ -62,7 +62,7 @@ class CreateContainer(forms.SelfHandlingForm): def handle(self, request, data): api.swift_create_container(request, data['name']) messages.success(request, "Container was successfully created.") - return shortcuts.redirect("dash_containers", request.user.tenant) + return shortcuts.redirect("dash_containers", request.user.tenant_id) @login_required diff --git a/django-openstack/django_openstack/dash/views/floating_ips.py b/django-openstack/django_openstack/dash/views/floating_ips.py index 8a1487cf2..c18f12319 100644 --- a/django-openstack/django_openstack/dash/views/floating_ips.py +++ b/django-openstack/django_openstack/dash/views/floating_ips.py @@ -80,7 +80,7 @@ class FloatingIpAssociate(forms.SelfHandlingForm): LOG.error("ClientException in FloatingIpAssociate", exc_info=True) messages.error(request, 'Error associating Floating IP: %s' % e.message) - return shortcuts.redirect('dash_floating_ips', request.user.tenant) + return shortcuts.redirect('dash_floating_ips', request.user.tenant_id) class FloatingIpDisassociate(forms.SelfHandlingForm): @@ -100,7 +100,7 @@ class FloatingIpDisassociate(forms.SelfHandlingForm): LOG.error("ClientException in FloatingIpAssociate", exc_info=True) messages.error(request, 'Error disassociating Floating IP: %s' % e.message) - return shortcuts.redirect('dash_floating_ips', request.user.tenant) + return shortcuts.redirect('dash_floating_ips', request.user.tenant_id) class FloatingIpAllocate(forms.SelfHandlingForm): @@ -120,7 +120,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm): messages.error(request, 'Error allocating Floating IP "%s"\ to tenant "%s": %s' % (fip.ip, data['tenant_id'], e.message)) - return shortcuts.redirect('dash_floating_ips', request.user.tenant) + return shortcuts.redirect('dash_floating_ips', request.user.tenant_id) @login_required @@ -139,7 +139,7 @@ def index(request, tenant_id): return shortcuts.render_to_response( 'django_openstack/dash/floating_ips/index.html', { 'allocate_form': FloatingIpAllocate(initial={ - 'tenant_id': request.user.tenant}), + 'tenant_id': request.user.tenant_id}), 'disassociate_form': FloatingIpDisassociate(), 'floating_ips': floating_ips, 'release_form': ReleaseFloatingIp(), diff --git a/django-openstack/django_openstack/dash/views/images.py b/django-openstack/django_openstack/dash/views/images.py index 42a1f8979..70e0dddd6 100644 --- a/django-openstack/django_openstack/dash/views/images.py +++ b/django-openstack/django_openstack/dash/views/images.py @@ -118,7 +118,7 @@ def index(request, tenant_id): tenant = {} try: - tenant = api.token_get_tenant(request, request.user.tenant) + tenant = api.token_get_tenant(request, request.user.tenant_id) except api_exceptions.ApiException, e: messages.error(request, "Unable to retrienve tenant info\ from keystone: %s" % e.message) @@ -185,8 +185,8 @@ def launch(request, tenant_id, image_id): # TODO(mgius): Any reason why these can't be after the launchform logic? # If The form is valid, we've just wasted these two api calls image = api.image_get(request, image_id) - tenant = api.token_get_tenant(request, request.user.tenant) - quotas = api.tenant_quota_get(request, request.user.tenant) + tenant = api.token_get_tenant(request, request.user.tenant_id) + quotas = api.tenant_quota_get(request, request.user.tenant_id) try: quotas.ram = int(quotas.ram) / 100 except Exception, e: diff --git a/django-openstack/django_openstack/dash/views/instances.py b/django-openstack/django_openstack/dash/views/instances.py index df3b4b95c..4712f9309 100644 --- a/django-openstack/django_openstack/dash/views/instances.py +++ b/django-openstack/django_openstack/dash/views/instances.py @@ -168,7 +168,7 @@ def usage(request, tenant_id=None): usage = {} if not tenant_id: - tenant_id = request.user.tenant + tenant_id = request.user.tenant_id try: usage = api.usage_get(request, tenant_id, datetime_start, datetime_end) diff --git a/django-openstack/django_openstack/dash/views/networks.py b/django-openstack/django_openstack/dash/views/networks.py index 797a3c4ee..7a97ef946 100644 --- a/django-openstack/django_openstack/dash/views/networks.py +++ b/django-openstack/django_openstack/dash/views/networks.py @@ -65,7 +65,7 @@ class CreateNetwork(forms.SelfHandlingForm): LOG.info(msg) messages.success(request, msg) return shortcuts.redirect('dash_networks', - tenant_id=request.user.tenant) + tenant_id=request.user.tenant_id) class DeleteNetwork(forms.SelfHandlingForm): @@ -147,7 +147,7 @@ def index(request, tenant_id): def create(request, tenant_id): network_form, handled = CreateNetwork.maybe_handle(request) if handled: - return shortcuts.redirect('dash_networks', request.user.tenant) + return shortcuts.redirect('dash_networks', request.user.tenant_id) return shortcuts.render_to_response( 'django_openstack/dash/networks/create.html', { @@ -187,7 +187,7 @@ def rename(request, tenant_id, network_id): network_details = api.quantum_network_details(request, network_id) if handled: - return shortcuts.redirect('dash_networks', request.user.tenant) + return shortcuts.redirect('dash_networks', request.user.tenant_id) return shortcuts.render_to_response( 'django_openstack/dash/networks/rename.html', { diff --git a/django-openstack/django_openstack/dash/views/ports.py b/django-openstack/django_openstack/dash/views/ports.py index 4db3e0c74..672ef131a 100644 --- a/django-openstack/django_openstack/dash/views/ports.py +++ b/django-openstack/django_openstack/dash/views/ports.py @@ -155,7 +155,7 @@ def create(request, tenant_id, network_id): if handled: return shortcuts.redirect( 'dash_networks_detail', - tenant_id=request.user.tenant, + tenant_id=request.user.tenant_id, network_id=network_id ) @@ -172,7 +172,7 @@ def attach(request, tenant_id, network_id, port_id): if handled: return shortcuts.redirect('dash_networks_detail', - request.user.tenant, network_id) + request.user.tenant_id, network_id) # Get all avaliable vifs vifs = _get_available_vifs(request) diff --git a/django-openstack/django_openstack/middleware/keystone.py b/django-openstack/django_openstack/middleware/keystone.py index 19424b69d..8c0af0b3b 100644 --- a/django-openstack/django_openstack/middleware/keystone.py +++ b/django-openstack/django_openstack/middleware/keystone.py @@ -25,10 +25,12 @@ import openstack class User(object): - def __init__(self, token, user, tenant, admin, service_catalog): + def __init__(self, token=None, user=None, tenant_id=None, admin=None, + service_catalog=None, tenant_name=None): self.token = token self.username = user - self.tenant = tenant + self.tenant_id = tenant_id + self.tenant_name = tenant_name self.admin = admin self.service_catalog = service_catalog @@ -42,12 +44,13 @@ class User(object): def get_user_from_request(request): if 'user' not in request.session: - return User(None, None, None, None, None) - return User(request.session['token'], - request.session['user'], - request.session['tenant'], - request.session['admin'], - request.session['serviceCatalog']) + return User() + return User(token=request.session['token'], + user=request.session['user'], + tenant_id=request.session['tenant_id'], + tenant_name=request.session['tenant'], + admin=request.session['admin'], + service_catalog=request.session['serviceCatalog']) class LazyUser(object): diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/_sidebar.html b/django-openstack/django_openstack/templates/django_openstack/dash/_sidebar.html index daf16a886..27438966e 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/_sidebar.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/_sidebar.html @@ -4,20 +4,20 @@

Manage Compute

{% if swift_configured %}

Manage Object Store

{% endif %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/containers/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/containers/_list.html index 86a81092d..56222219d 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/containers/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/containers/_list.html @@ -9,8 +9,8 @@ diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/containers/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/containers/index.html index a0ad37439..e685d5498 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/containers/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/containers/index.html @@ -7,12 +7,12 @@ {% endblock %} {% block page_header %} - {% url dash_images request.user.tenant as refresh_link %} + {% url dash_images request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Containers" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} {% block dash_main %} {% include 'django_openstack/dash/containers/_list.html' %} - Create New Container >> + Create New Container >> {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/_list.html index 1c4e83cb4..124825214 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/_list.html @@ -26,7 +26,7 @@ {% if ip.fixed_ip %}
  • {% include "django_openstack/dash/floating_ips/_disassociate.html" with form=disassociate_form %}
  • {% else %} -
  • Associate to instance
  • +
  • Associate to instance
  • {% endif %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/index.html index 7784ceb4a..bc3cd359f 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/floating_ips/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_floating_ips request.user.tenant as refresh_link %} + {% url dash_floating_ips request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Floating IPs" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/images/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/images/_list.html index f1cf125ce..11c8ba8bf 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/images/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/images/_list.html @@ -16,7 +16,7 @@ {{image.status|capfirst}} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/images/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/images/index.html index cc180d7f7..c16041eff 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/images/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/images/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_images request.user.tenant as refresh_link %} + {% url dash_images request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Images" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/instances/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/instances/_list.html index d8408fd5d..1c3a8942d 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/instances/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/instances/_list.html @@ -59,10 +59,10 @@ diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/instances/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/instances/index.html index c4717a14e..4ca6a9885 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/instances/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/instances/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_instances request.user.tenant as refresh_link %} + {% url dash_instances request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Instances" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -18,7 +18,7 @@ {% else %}

    Info

    -

    There are currently no instances. You can launch an instance from the Images Page.

    +

    There are currently no instances. You can launch an instance from the Images Page.

    {% endif %} {% endblock %} @@ -29,7 +29,7 @@ function loadInstances(){ if ($("#ajax_option_box").is(':checked')) { $('.refresh').addClass("refreshing"); - $('#instances').load('{% url dash_instances_refresh request.user.tenant %}', function(){ + $('#instances').load('{% url dash_instances_refresh request.user.tenant_id %}', function(){ $('.refresh').removeClass("refreshing"); }); }; diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/instances/update.html b/django-openstack/django_openstack/templates/django_openstack/dash/instances/update.html index 32bd962a3..13a261405 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/instances/update.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/instances/update.html @@ -15,7 +15,7 @@
    {% include 'django_openstack/dash/instances/_form.html' with form=form %} -

    << Return to Instances List

    +

    << Return to Instances List

    @@ -32,7 +32,7 @@ $("#spinner").hide() function loadInstances(){ $('#spinner').show(); - $('#instances').load('{% url dash_instances_refresh request.user.tenant %}', function(){ + $('#instances').load('{% url dash_instances_refresh request.user.tenant_id %}', function(){ $("#spinner").hide() }); } diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/instances/usage.html b/django-openstack/django_openstack/templates/django_openstack/dash/instances/usage.html index 153dbfd71..6bf7821d8 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/instances/usage.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/instances/usage.html @@ -93,7 +93,7 @@ {% else %}

    Info

    -

    There are currently no instances.

    You can launch an instance from the Images Page.

    +

    There are currently no instances.

    You can launch an instance from the Images Page.

    {% endif %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/create.html b/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/create.html index fcac945da..f3ad41b1b 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/create.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/create.html @@ -28,7 +28,7 @@

    Your private key is being downloaded.

    {% include 'django_openstack/dash/keypairs/_form.html' with form=create_form %} -

    << Return to keypairs list

    +

    << Return to keypairs list

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/index.html index 2b096466a..5c9a223bd 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/keypairs/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_keypairs request.user.tenant as refresh_link %} + {% url dash_keypairs request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Keypairs" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -15,11 +15,11 @@ {% block dash_main %} {% if keypairs %} {% include 'django_openstack/dash/keypairs/_list.html' %} - Create New Keypair + Create New Keypair {% else %}

    Info

    -

    There are currently no keypairs. Create A Keypair >>

    +

    There are currently no keypairs. Create A Keypair >>

    {% endif %} {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/_detail.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/_detail.html index a67faf510..a3b6f23da 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/_detail.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/_detail.html @@ -32,7 +32,7 @@ {% if port.attachment %}
  • {% include "django_openstack/dash/networks/_detach_port.html" with form=detach_port_form %}
  • {% else %} -
  • Attach
  • +
  • Attach
  • {% endif %}
  • {% include "django_openstack/dash/networks/_delete_port.html" with form=delete_port_form %}
  • {% include "django_openstack/dash/networks/_toggle_port.html" with form=toggle_port_form %}
  • diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/_list.html index 0177afd15..75eb8feb0 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/_list.html @@ -10,7 +10,7 @@ {% for network in networks %} - {{network.id}} + {{network.id}} {{network.name}} {{network.total}} {{network.available}} @@ -18,7 +18,7 @@
    • {% include "django_openstack/dash/networks/_delete.html" with form=delete_form %}
    • -
    • Rename
    • +
    • Rename
    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/create.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/create.html index 62e389fb2..d8a331f20 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/create.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/create.html @@ -15,7 +15,7 @@
    {% include 'django_openstack/dash/networks/_form.html' with form=network_form %} -

    << Return to networks list

    +

    << Return to networks list

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/detail.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/detail.html index 38ab1b271..7c789d3f1 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/detail.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/detail.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_networks_detail request.user.tenant network.id as refresh_link %} + {% url dash_networks_detail request.user.tenant_id network.id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title=network.name refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -20,11 +20,11 @@ {% block dash_main %} {% if network.ports %} {% include 'django_openstack/dash/networks/_detail.html' %} - Create Ports + Create Ports {% else %}

    Info

    -

    There are currently no ports in this network. Create Ports >>

    +

    There are currently no ports in this network. Create Ports >>

    {% endif %} {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/index.html index ea0f62a24..31373faa5 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_networks request.user.tenant as refresh_link %} + {% url dash_networks request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Networks" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -15,11 +15,11 @@ {% block dash_main %} {% if networks %} {% include 'django_openstack/dash/networks/_list.html' %} - Create New Network + Create New Network {% else %}

    Info

    -

    There are currently no networks. Create A Network >>

    +

    There are currently no networks. Create A Network >>

    {% endif %}
    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/networks/rename.html b/django-openstack/django_openstack/templates/django_openstack/dash/networks/rename.html index 9bd1f9224..2f9e0222e 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/networks/rename.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/networks/rename.html @@ -23,7 +23,7 @@
    {% include 'django_openstack/dash/networks/_rename_form.html' with form=rename_form %} -

    << Return to networks list

    +

    << Return to networks list

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/objects/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/objects/_list.html index 65ccd6800..16529f12a 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/objects/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/objects/_list.html @@ -8,9 +8,9 @@ {{ object.name }} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/objects/copy.html b/django-openstack/django_openstack/templates/django_openstack/dash/objects/copy.html index bef46a2e1..81e07a591 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/objects/copy.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/objects/copy.html @@ -17,7 +17,7 @@

    Copy Object: '{{object_name}}'

    {% include 'django_openstack/dash/objects/_copy.html' with form=copy_form greeting="HI" %} -

    << Return to objects list

    +

    << Return to objects list

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/objects/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/objects/index.html index 6c7c5a870..59cbc5d1a 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/objects/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/objects/index.html @@ -13,7 +13,7 @@ - Refresh List + Refresh List
    {% endblock %} @@ -26,9 +26,9 @@ {% else %}

    Info

    -

    There are currently no objects in the container {{container_name}}. You can upload a new object from the Object Upload Page >>

    +

    There are currently no objects in the container {{container_name}}. You can upload a new object from the Object Upload Page >>

    {% endif %} - Upload New Object >> + Upload New Object >> {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/objects/upload.html b/django-openstack/django_openstack/templates/django_openstack/dash/objects/upload.html index 56e86366c..c0e5ba8c5 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/objects/upload.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/objects/upload.html @@ -16,7 +16,7 @@
    {% include 'django_openstack/dash/objects/_form.html' with form=upload_form %} -

    << Return to objects list

    +

    << Return to objects list

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/ports/attach.html b/django-openstack/django_openstack/templates/django_openstack/dash/ports/attach.html index d0de5ae3d..bd275fae3 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/ports/attach.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/ports/attach.html @@ -34,7 +34,7 @@
    {% include 'django_openstack/dash/ports/_attach.html' with form=attach_form %} -

    << Return to network detail

    +

    << Return to network detail

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/ports/create.html b/django-openstack/django_openstack/templates/django_openstack/dash/ports/create.html index f5018775e..c69314559 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/ports/create.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/ports/create.html @@ -15,7 +15,7 @@
    {% include 'django_openstack/dash/ports/_create.html' with form=create_form %} -

    << Return to network detail

    +

    << Return to network detail

    diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/_list.html b/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/_list.html index 52c753562..dea3d3c9e 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/_list.html @@ -12,7 +12,7 @@ {{ security_group.description }}
      -
    • Edit Rules
    • +
    • Edit Rules
    • {% if security_group.name != 'default' %}
    • {% include "django_openstack/dash/security_groups/_delete.html" with form=delete_form %}
    • {% endif %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/index.html index a22b9a8a9..de9b16f66 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/security_groups/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_security_groups request.user.tenant as refresh_link %} + {% url dash_security_groups request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Security Groups" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -15,11 +15,11 @@ {% block dash_main %} {% if security_groups %} {% include 'django_openstack/dash/security_groups/_list.html' %} - Create Security Group + Create Security Group {% else %}

      Info

      -

      There are currently no security groups. Create A Security Group >>

      +

      There are currently no security groups. Create A Security Group >>

      {% endif %} {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/create.html b/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/create.html index b0038f62a..84ca7bb69 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/create.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/create.html @@ -23,7 +23,7 @@

      Choose a name for your snapshot.

      {% include 'django_openstack/dash/snapshots/_form.html' with form=create_form %} -

      << Return to snapshots list

      +

      << Return to snapshots list

      diff --git a/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/index.html b/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/index.html index df407e5c4..7de5590cc 100644 --- a/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/dash/snapshots/index.html @@ -7,7 +7,7 @@ {% endblock %} {% block page_header %} - {% url dash_snapshots request.user.tenant as refresh_link %} + {% url dash_snapshots request.user.tenant_id as refresh_link %} {# to make searchable false, just remove it from the include statement #} {% include "django_openstack/common/_page_header.html" with title="Snapshots" refresh_link=refresh_link searchable="true" %} {% endblock page_header %} @@ -18,7 +18,7 @@ {% else %}

      Info

      -

      There are currently no snapshots. You can create snapshots from running instances. View Running Instances >>

      +

      There are currently no snapshots. You can create snapshots from running instances. View Running Instances >>

      {% endif %} {% endblock %} diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/_list.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/_list.html index 8672d8edf..b3c2569c8 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/_list.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/_list.html @@ -44,8 +44,8 @@
      • {% include "django_openstack/common/instances/_terminate.html" with form=terminate_form %}
      • {% include "django_openstack/common/instances/_reboot.html" with form=reboot_form %}
      • -
      • Console Log
      • -
      • VNC Console
      • +
      • Console Log
      • +
      • VNC Console
      diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/index.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/index.html index 32c89669a..b891ce3ed 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/index.html @@ -18,7 +18,7 @@ {% else %}

      Info

      -

      There are currently no instances. You can launch an instance from the Images Page.

      +

      There are currently no instances. You can launch an instance from the Images Page.

      {% endif %} {% endblock %} diff --git a/django-openstack/django_openstack/test.py b/django-openstack/django_openstack/test.py index fc3345425..7835f1d6e 100644 --- a/django-openstack/django_openstack/test.py +++ b/django-openstack/django_openstack/test.py @@ -27,7 +27,8 @@ from django_openstack.middleware import keystone class TestCase(test.TestCase): TEST_STAFF_USER = 'staffUser' - TEST_TENANT = 'aTenant' + TEST_TENANT = '1' + TEST_TENANT_NAME = 'aTenant' TEST_TOKEN = 'aToken' TEST_USER = 'test' @@ -82,8 +83,8 @@ class TestCase(test.TestCase): self.mox.UnsetStubs() keystone.get_user_from_request = self._real_get_user_from_request - def setActiveUser(self, token, username, - tenant, is_admin, service_catalog): + def setActiveUser(self, token=None, username=None, tenant_id=None, + is_admin=None, service_catalog=None, tenant_name=None): keystone.get_user_from_request = \ - lambda x: keystone.User(token, username, tenant, - is_admin, service_catalog) + lambda x: keystone.User(token, username, tenant_id, + is_admin, service_catalog, tenant_name) diff --git a/django-openstack/django_openstack/tests/view_tests/auth_tests.py b/django-openstack/django_openstack/tests/view_tests/auth_tests.py index 3cfbfbb9c..1848a142a 100644 --- a/django-openstack/django_openstack/tests/view_tests/auth_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/auth_tests.py @@ -29,7 +29,7 @@ from mox import IsA class AuthViewTests(base.BaseViewTests): def setUp(self): super(AuthViewTests, self).setUp() - self.setActiveUser(None, None, None, None, None) + self.setActiveUser() self.PASSWORD = 'secret' def test_login_index(self): diff --git a/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py index 9ea198a79..a27d4eb86 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py @@ -114,8 +114,8 @@ class ContainerViewTests(base.BaseViewTests): messages.success(IgnoreArg(), IsA(str)) res = self.client.post(reverse('dash_containers_create', - args=[self.request.user.tenant]), + args=[self.request.user.tenant_id]), formData) self.assertRedirectsNoFollow(res, reverse('dash_containers', - args=[self.request.user.tenant])) + args=[self.request.user.tenant_id])) diff --git a/django-openstack/django_openstack/tests/view_tests/dash/network_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/network_tests.py index 5bd37c693..ebd17046b 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/network_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/network_tests.py @@ -95,11 +95,11 @@ class NetworkViewTests(base.BaseViewTests): 'method': 'CreateNetwork'} res = self.client.post(reverse('dash_network_create', - args=[self.request.user.tenant]), + args=[self.request.user.tenant_id]), formData) self.assertRedirectsNoFollow(res, reverse('dash_networks', - args=[self.request.user.tenant])) + args=[self.request.user.tenant_id])) self.mox.VerifyAll() def test_network_delete(self): @@ -128,7 +128,7 @@ class NetworkViewTests(base.BaseViewTests): 'method': 'DeleteNetwork'} res = self.client.post(reverse('dash_networks', - args=[self.request.user.tenant]), + args=[self.request.user.tenant_id]), formData) def test_network_rename(self): @@ -158,7 +158,7 @@ class NetworkViewTests(base.BaseViewTests): 'method': 'RenameNetwork'} res = self.client.post(reverse('dash_network_rename', - args=[self.request.user.tenant, "n1"]), + args=[self.request.user.tenant_id, "n1"]), formData) def test_network_details(self): diff --git a/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py index 2dbeb939d..a220d549e 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py @@ -43,11 +43,11 @@ class PortViewTests(base.BaseViewTests): messages.success(IgnoreArg(), IsA(str)) res = self.client.post(reverse('dash_ports_create', - args=[self.request.user.tenant, "n1"]), + args=[self.request.user.tenant_id, "n1"]), formData) self.assertRedirectsNoFollow(res, reverse('dash_networks_detail', - args=[self.request.user.tenant, + args=[self.request.user.tenant_id, "n1"])) def test_port_delete(self): @@ -63,7 +63,7 @@ class PortViewTests(base.BaseViewTests): messages.success(IgnoreArg(), IsA(str)) res = self.client.post(reverse('dash_networks_detail', - args=[self.request.user.tenant, "n1"]), + args=[self.request.user.tenant_id, "n1"]), formData) def test_port_attach(self): @@ -80,11 +80,11 @@ class PortViewTests(base.BaseViewTests): messages.success(IgnoreArg(), IsA(str)) res = self.client.post(reverse('dash_ports_attach', - args=[self.request.user.tenant, "n1", "p1"]), + args=[self.request.user.tenant_id, "n1", "p1"]), formData) self.assertRedirectsNoFollow(res, reverse('dash_networks_detail', - args=[self.request.user.tenant, + args=[self.request.user.tenant_id, "n1"])) def test_port_detach(self): @@ -100,5 +100,5 @@ class PortViewTests(base.BaseViewTests): messages.success(IgnoreArg(), IsA(str)) res = self.client.post(reverse('dash_networks_detail', - args=[self.request.user.tenant, "n1"]), + args=[self.request.user.tenant_id, "n1"]), formData) diff --git a/openstack-dashboard/dashboard/templates/_topbar.html b/openstack-dashboard/dashboard/templates/_topbar.html index 024947c54..432e242e8 100644 --- a/openstack-dashboard/dashboard/templates/_topbar.html +++ b/openstack-dashboard/dashboard/templates/_topbar.html @@ -11,10 +11,10 @@ NOT _LOGGED_IN_TOPBAR {% endif %}
    - + - +