summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/instances/views.py
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-12-18 04:14:11 +0000
committerGerrit Code Review <review@openstack.org>2017-12-18 04:14:11 +0000
commit71fa624d776c82bb6ab2c411e8c28bd0f076b4c1 (patch)
tree908769185f7cc8cdd83a55f2a44b0427afe21503 /openstack_dashboard/dashboards/project/instances/views.py
parent6210e1ab66d8c33b17444550e82c28464dc3698b (diff)
parent974f0418efdf171132747ded4a556df7b7af03d1 (diff)
downloadhorizon-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.py13
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)