Fix error when non-existing host is used.
This commit is contained in:
		
					parent
					
						
							
								962839eb69
							
						
					
				
			
			
				commit
				
					
						2fb551131e
					
				
			
		
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -244,16 +244,16 @@ class Config(object):
 | 
				
			||||||
                # (hostname, aliaslist, ipaddrlist)
 | 
					                # (hostname, aliaslist, ipaddrlist)
 | 
				
			||||||
                host_name = socket.gethostbyaddr(ip_addr)[0]
 | 
					                host_name = socket.gethostbyaddr(ip_addr)[0]
 | 
				
			||||||
            except socket.gaierror as e:
 | 
					            except socket.gaierror as e:
 | 
				
			||||||
                log.error("{}: {}".format(e[0], e[1]))
 | 
					                log.warn("{}".format(e))
 | 
				
			||||||
                # in case of error provide empty value
 | 
					                # in case of error provide empty value
 | 
				
			||||||
                host_name = None
 | 
					                host_name = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                host_fqdn = socket.getfqdn(host)
 | 
					                host_fqdn = socket.getfqdn(host)
 | 
				
			||||||
            except socket.herror as e:
 | 
					            except socket.herror as e:
 | 
				
			||||||
                log.error("{}: {}".format(e[0], e[1]))
 | 
					                log.warn("{}: {}".format(e[0], e[1]))
 | 
				
			||||||
                # in case of error provide empty value
 | 
					                # in case of error provide empty value
 | 
				
			||||||
                host_fqdn = None
 | 
					                host_fqdn = ''
 | 
				
			||||||
            target_host = (host, host_name, host_fqdn)
 | 
					            target_host = (host, host_name, host_fqdn)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            local = cdist.exec.local.Local(
 | 
					            local = cdist.exec.local.Local(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue