From 86ed0e531992a92cc2ef575035ce5e33f2f1e519 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Wed, 13 Sep 2017 14:32:33 +0200 Subject: [PATCH] Removed code related removing keys from known_hosts --- hosting/views.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index b174acad..9f041333 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1,5 +1,4 @@ import logging -import subprocess import uuid from django.conf import settings @@ -981,53 +980,6 @@ class VirtualMachineView(LoginRequiredMixin, View): 'VM_ID': opennebula_vm_id} ) - # Remove all keys belonging to the IP(s) - # ssh-keygen -R ip_address - if vm_data['ipv4'] is not None: - if ', ' in vm_data['ipv4']: - vm_ips = vm_data['ipv4'].split(', ') - for ip_address in vm_ips: - try: - subprocess.check_output( - ['ssh-keygen', '-R', ip_address]) - except subprocess.CalledProcessError as cpe: - logger.debug( - """Could not remove key belonging to {ip}. - Error details: {details}""".format(ip=ip_address, - details=str( - cpe))) - else: - try: - subprocess.check_output( - ['ssh-keygen', '-R', vm_data['ipv4']]) - except subprocess.CalledProcessError as cpe: - logger.debug( - """Could not remove key belonging to {ip}. - Error details: {details}""".format(ip=vm_data['ipv4'], - details=str(cpe))) - if vm_data['ipv6'] is not None: - if ', ' in vm_data['ipv6']: - vm_ips = vm_data['ipv6'].split(', ') - for ip_address in vm_ips: - try: - subprocess.check_output( - ['ssh-keygen', '-R', ip_address]) - except subprocess.CalledProcessError as cpe: - logger.debug( - """Could not remove key belonging to {ip}. - Error details: {details}""".format(ip=ip_address, - details=str( - cpe))) - else: - try: - subprocess.check_output( - ['ssh-keygen', '-R', vm_data['ipv6']]) - except subprocess.CalledProcessError as cpe: - logger.debug( - """Could not remove key belonging to {ip}. - Error details: {details}""".format(ip=vm_data['ipv6'], - details=str(cpe))) - return HttpResponseRedirect(self.get_success_url())