mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-04 12:48:00 +00:00 
			
		
		
		
	lf_check.py: tests for fully qualified host name to see if it has a domain name, otherwise use IP address
Browsers can do weird things like transform $host to "www.${host}.com" if they don't detect a domain.
Signed-off-by: Jed Reynolds <jed@candelatech.com>
			
			
This commit is contained in:
		@@ -317,8 +317,14 @@ class lf_check():
 | 
				
			|||||||
        # Mail
 | 
					        # Mail
 | 
				
			||||||
        # command to check if mail running : systemctl status postfix
 | 
					        # command to check if mail running : systemctl status postfix
 | 
				
			||||||
        # command = 'echo "$HOSTNAME mail system works!" | mail -s "Test: $HOSTNAME $(date)" chuck.rekiere@candelatech.com'
 | 
					        # command = 'echo "$HOSTNAME mail system works!" | mail -s "Test: $HOSTNAME $(date)" chuck.rekiere@candelatech.com'
 | 
				
			||||||
        hostname = socket.gethostname()
 | 
					        hostname = socket.getfqdn()
 | 
				
			||||||
        ip = socket.gethostbyname(hostname)
 | 
					        ip = socket.gethostbyname(hostname)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # a hostname lacking dots by definition lacks a domain name
 | 
				
			||||||
 | 
					        # this is not useful for hyperlinks outside the known domain, so an IP address should be preferred
 | 
				
			||||||
 | 
					        if hostname.find('.') < 1:
 | 
				
			||||||
 | 
					            hostname = ip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        message_txt =""
 | 
					        message_txt =""
 | 
				
			||||||
        if (self.email_txt != ""):
 | 
					        if (self.email_txt != ""):
 | 
				
			||||||
            message_txt = """{email_txt} lanforge target {lf_mgr_ip}
 | 
					            message_txt = """{email_txt} lanforge target {lf_mgr_ip}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user