weizhouapache commented on code in PR #10571:
URL: https://github.com/apache/cloudstack/pull/10571#discussion_r2070301409


##########
setup/bindir/cloud-setup-databases.in:
##########
@@ -328,7 +328,7 @@ for example:
     def grabSystemInfo(self):
         def getIpAddr():
             try:
-                ip = socket.gethostbyname(socket.gethostname())
+                ip = socket.gethostbyname(socket.gethostname() + ".local")

Review Comment:
   thanks @rohityadavcloud 
   Yes, you are right. it does not always work, depends on records in /etc/hosts
   
   maybe the following works
   
   ```
   import socket
   hostname, aliases, addresses = socket.gethostbyname_ex(socket.gethostname())
   
   addr = "127.0.0.1"
   for address in addresses:
       if address != "127.0.0.1" and address != "127.0.1.1":
           addr = address
           break
   
   print(addr)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to