fixed confusing logging
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							
								
								
									
										15
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								app.py
									
									
									
									
									
								
							@@ -78,19 +78,20 @@ def main():
 | 
			
		||||
 | 
			
		||||
        # Test ip change stuff
 | 
			
		||||
 | 
			
		||||
        current_ip = r.get('current_ip')
 | 
			
		||||
        old_ip = r.get('current_ip')
 | 
			
		||||
 | 
			
		||||
        if current_ip:
 | 
			
		||||
            current_ip = current_ip.decode('utf-8')
 | 
			
		||||
        if old_ip:
 | 
			
		||||
            old_ip = old_ip.decode('utf-8')
 | 
			
		||||
 | 
			
		||||
        if not current_ip:  # Not set yet. I this case no update required
 | 
			
		||||
        current_ip = socket.gethostbyname(host_name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if not old_ip:  # Not set yet. I this case no update required
 | 
			
		||||
            r.set('current_ip', current_ip.encode('utf-8'))
 | 
			
		||||
            logging.debug(f"Previous info about the ip address could not be found! Current: {current_ip}")
 | 
			
		||||
 | 
			
		||||
        elif current_ip != socket.gethostbyname(host_name):
 | 
			
		||||
            logging.info(f'IP changed: {current_ip} Pushing updates...')
 | 
			
		||||
            current_ip = socket.gethostbyname(host_name)
 | 
			
		||||
        elif old_ip != current_ip:
 | 
			
		||||
            logging.info(f'IP changed: {old_ip} -> {current_ip} Pushing updates...')
 | 
			
		||||
            r.set('current_ip', current_ip.encode('utf-8'))
 | 
			
		||||
 | 
			
		||||
            # pushing updates...
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user