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


##########
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:
   On Ubuntu 22.04 I get this:
   ```
   > python3
   Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import socket
   >>> socket.gethostbyname(socket.gethostname())
   '127.0.1.1'
   >>> socket.gethostbyname(socket.gethostname() + ".local")
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   socket.gaierror: [Errno -5] No address associated with hostname
   ```
   
   But on another Ubuntu 24.04 host:
   ```
   $ python3
   Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import socket
   >>> socket.gethostbyname(socket.gethostname())
   '127.0.1.1'
   >>> socket.gethostbyname(socket.gethostname() + ".local")
   '169.254.0.1'
   ```
   
   On Mac:
   ```
   > python
   Python 3.10.15 (main, Nov 26 2024, 17:07:54) [Clang 16.0.0 
(clang-1600.0.26.4)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import socket
   >>> socket.gethostbyname(socket.gethostname())
   '127.0.0.1'
   >>> socket.gethostbyname(socket.gethostname() + ".local")
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   socket.gaierror: [Errno 8] nodename nor servname provided, or not known
   ```



-- 
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