diff options
author | Zuul <zuul@review.openstack.org> | 2017-12-18 04:14:11 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-12-18 04:14:11 +0000 |
commit | 71fa624d776c82bb6ab2c411e8c28bd0f076b4c1 (patch) | |
tree | 908769185f7cc8cdd83a55f2a44b0427afe21503 /openstack_dashboard/dashboards/project/instances/views.py | |
parent | 6210e1ab66d8c33b17444550e82c28464dc3698b (diff) | |
parent | 974f0418efdf171132747ded4a556df7b7af03d1 (diff) | |
download | horizon-71fa624d776c82bb6ab2c411e8c28bd0f076b4c1.tar.gz |
Merge "Redirect VM console dynamically"
Diffstat (limited to 'openstack_dashboard/dashboards/project/instances/views.py')
-rw-r--r-- | openstack_dashboard/dashboards/project/instances/views.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index f6f301e64..b4f2084e6 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -232,6 +232,19 @@ def console(request, instance_id): return http.HttpResponse(data.encode('utf-8'), content_type='text/plain') +def auto_console(request, instance_id): + console_type = getattr(settings, 'CONSOLE_TYPE', 'AUTO') + try: + instance = api.nova.server_get(request, instance_id) + console_url = project_console.get_console(request, console_type, + instance)[1] + return shortcuts.redirect(console_url) + except Exception: + redirect = reverse("horizon:project:instances:index") + msg = _('Unable to get console for instance "%s".') % instance_id + exceptions.handle(request, msg, redirect=redirect) + + def vnc(request, instance_id): try: instance = api.nova.server_get(request, instance_id) |