Corrected obtaining values from vm_data dict
This commit is contained in:
		
					parent
					
						
							
								f94ed011e5
							
						
					
				
			
			
				commit
				
					
						612e11736e
					
				
			
		
					 1 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
					@ -984,9 +984,9 @@ class VirtualMachineView(LoginRequiredMixin, View):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Remove all keys belonging to the IP(s)
 | 
					        # Remove all keys belonging to the IP(s)
 | 
				
			||||||
        # ssh-keygen -R ip_address
 | 
					        # ssh-keygen -R ip_address
 | 
				
			||||||
        if vm_data.ipv4 is not None:
 | 
					        if vm_data['ipv4'] is not None:
 | 
				
			||||||
            if ', ' in vm_data.ipv4:
 | 
					            if ', ' in vm_data['ipv4']:
 | 
				
			||||||
                vm_ips = vm_data.ipv4.split(', ')
 | 
					                vm_ips = vm_data['ipv4'].split(', ')
 | 
				
			||||||
                for ip_address in vm_ips:
 | 
					                for ip_address in vm_ips:
 | 
				
			||||||
                    try:
 | 
					                    try:
 | 
				
			||||||
                        subprocess.check_output(
 | 
					                        subprocess.check_output(
 | 
				
			||||||
| 
						 | 
					@ -1000,15 +1000,15 @@ class VirtualMachineView(LoginRequiredMixin, View):
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    subprocess.check_output(
 | 
					                    subprocess.check_output(
 | 
				
			||||||
                        ['ssh-keygen', '-R', vm_data.ipv4])
 | 
					                        ['ssh-keygen', '-R', vm_data['ipv4']])
 | 
				
			||||||
                except subprocess.CalledProcessError as cpe:
 | 
					                except subprocess.CalledProcessError as cpe:
 | 
				
			||||||
                    logger.debug(
 | 
					                    logger.debug(
 | 
				
			||||||
                        """Could not remove key belonging to {ip}. 
 | 
					                        """Could not remove key belonging to {ip}. 
 | 
				
			||||||
                        Error details: {details}""".format(ip=vm_data.ipv4,
 | 
					                        Error details: {details}""".format(ip=vm_data['ipv4'],
 | 
				
			||||||
                                                           details=str(cpe)))
 | 
					                                                           details=str(cpe)))
 | 
				
			||||||
        if vm_data.ipv6 is not None:
 | 
					        if vm_data['ipv6'] is not None:
 | 
				
			||||||
            if ', ' in vm_data.ipv6:
 | 
					            if ', ' in vm_data['ipv6']:
 | 
				
			||||||
                vm_ips = vm_data.ipv6.split(', ')
 | 
					                vm_ips = vm_data['ipv6'].split(', ')
 | 
				
			||||||
                for ip_address in vm_ips:
 | 
					                for ip_address in vm_ips:
 | 
				
			||||||
                    try:
 | 
					                    try:
 | 
				
			||||||
                        subprocess.check_output(
 | 
					                        subprocess.check_output(
 | 
				
			||||||
| 
						 | 
					@ -1022,11 +1022,11 @@ class VirtualMachineView(LoginRequiredMixin, View):
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    subprocess.check_output(
 | 
					                    subprocess.check_output(
 | 
				
			||||||
                        ['ssh-keygen', '-R', vm_data.ipv6])
 | 
					                        ['ssh-keygen', '-R', vm_data['ipv6']])
 | 
				
			||||||
                except subprocess.CalledProcessError as cpe:
 | 
					                except subprocess.CalledProcessError as cpe:
 | 
				
			||||||
                    logger.debug(
 | 
					                    logger.debug(
 | 
				
			||||||
                        """Could not remove key belonging to {ip}. 
 | 
					                        """Could not remove key belonging to {ip}. 
 | 
				
			||||||
                        Error details: {details}""".format(ip=vm_data.ipv6,
 | 
					                        Error details: {details}""".format(ip=vm_data['ipv6'],
 | 
				
			||||||
                                                           details=str(cpe)))
 | 
					                                                           details=str(cpe)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return HttpResponseRedirect(self.get_success_url())
 | 
					        return HttpResponseRedirect(self.get_success_url())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue