def ssh_settings(request, template_name='admin/ssh_settings.html'): client = SSHClient() key = client.get_user_key() if request.method == 'POST': form = SSHSettingsForm(request.POST, request.FILES) if form.is_valid(): if form.did_request_delete() and client.get_user_key() is not None: try: form.delete() return HttpResponseRedirect('.') except Exception as e: logging.error('Deleting SSH key failed: %s' % e) else: try: form.create(request.FILES) return HttpResponseRedirect('.') except Exception as e: # Fall through. It will be reported inline and in the log. logging.error('Uploading SSH key failed: %s' % e) else: form = SSHSettingsForm() if key: fingerprint = humanize_key(key) else: fingerprint = None return render_to_response(template_name, RequestContext(request, { 'key': key, 'fingerprint': fingerprint, 'public_key': client.get_public_key(key), 'form': form, }))
def ssh_settings(request, template_name='admin/ssh_settings.html'): key = sshutils.get_user_key() if request.method == 'POST': form = SSHSettingsForm(request.POST, request.FILES) if form.is_valid(): try: form.create(request.FILES) return HttpResponseRedirect('.') except Exception, e: # Fall through. It will be reported inline and in the log. logging.error('Uploading SSH key failed: %s' % e)
def ssh_settings(request, template_name='admin/ssh_settings.html'): client = SSHClient() key = client.get_user_key() if request.method == 'POST': form = SSHSettingsForm(request.POST, request.FILES) if form.is_valid(): if form.did_request_delete() and client.get_user_key() is not None: try: form.delete() return HttpResponseRedirect('.') except Exception, e: logging.error('Deleting SSH key failed: %s' % e) else: try: form.create(request.FILES) return HttpResponseRedirect('.') except Exception, e: # Fall through. It will be reported inline and in the log. logging.error('Uploading SSH key failed: %s' % e)
def ssh_settings(request, template_name='admin/ssh_settings.html'): client = SSHClient() key = client.get_user_key() if request.method == 'POST': form = SSHSettingsForm(request.POST, request.FILES) if form.is_valid(): try: form.create(request.FILES) return HttpResponseRedirect('.') except Exception, e: # Fall through. It will be reported inline and in the log. logging.error('Uploading SSH key failed: %s' % e) else: form = SSHSettingsForm() if key: fingerprint = humanize_key(key) else: fingerprint = None return render_to_response(template_name, RequestContext(request, { 'key': key, 'fingerprint': fingerprint, 'public_key': client.get_public_key(key), 'form': form, })) def manual_updates_required(request, updates,