Skip to content

Commit b1b01a7

Browse files
committed
cloudstack-setup-databases: get local address instead of 127.0.1.1
In some linux setup, the server has the line in /etc/hosts ``` 127.0.1.1 <hostname> ``` If the mgmt serve IP is not specified when run cloudstack-setup-databases, ACS detects the host ip in python, however there is an issue with it. ``` >>> import socket >>> socket.gethostbyname(socket.gethostname()) '127.0.1.1' <<<<=======================this is not good >>> socket.gethostbyname(socket.gethostname() + ".local") '10.0.100.100' <<<========================this is good ```
1 parent 95c2481 commit b1b01a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

setup/bindir/cloud-setup-databases.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ for example:
328328
def grabSystemInfo(self):
329329
def getIpAddr():
330330
try:
331-
ip = socket.gethostbyname(socket.gethostname())
331+
ip = socket.gethostbyname(socket.gethostname() + ".local")
332332
return ip
333333
except Exception as e:
334334
return "127.0.0.1"

0 commit comments

Comments
 (0)