From 41095ffb6d69422bd2e654a5a0ae97539e631787 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Thu, 5 Apr 2018 16:26:17 +0200 Subject: [PATCH] sshkeys view can send keys in plain format --- instances/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/instances/views.py b/instances/views.py index e81f7c8..8e1d90b 100644 --- a/instances/views.py +++ b/instances/views.py @@ -925,7 +925,12 @@ def sshkeys(request, vname): keys = UserSSHKey.objects.filter(user=ui.user) for k in keys: instance_keys.append(k.keypublic) - return HttpResponse(json.dumps(instance_keys)) + if request.GET.get('plain', ''): + response = '\n'.join(instance_keys) + response += '\n' + else: + response = json.dumps(instance_keys) + return HttpResponse(response) def delete_instance(instance, delete_disk=False): compute = instance.compute