Removed code related removing keys from known_hosts
This commit is contained in:
parent
a08104ba2c
commit
86ed0e5319
1 changed files with 0 additions and 48 deletions
|
@ -1,5 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -981,53 +980,6 @@ class VirtualMachineView(LoginRequiredMixin, View):
|
||||||
'VM_ID': opennebula_vm_id}
|
'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())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue