Skip to content

Commit a58b9b6

Browse files
rclevengsfc-gh-mkubik
authored andcommitted
fix error message when SF_AUTH_SOCKET_ADDR was set (#2332)
Co-authored-by: Mikołaj Kubik <[email protected]> (cherry picked from commit 07230cf)
1 parent e73fb8a commit a58b9b6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/snowflake/connector/auth/webbrowser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,19 @@ def prepare(
123123
socket_connection.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
124124

125125
try:
126+
hostname = os.getenv("SF_AUTH_SOCKET_ADDR", "localhost")
126127
try:
127128
socket_connection.bind(
128129
(
129-
os.getenv("SF_AUTH_SOCKET_ADDR", "localhost"),
130+
hostname,
130131
int(os.getenv("SF_AUTH_SOCKET_PORT", 0)),
131132
)
132133
)
133134
except socket.gaierror as ex:
134135
if ex.args[0] == socket.EAI_NONAME:
135136
raise OperationalError(
136-
msg="localhost is not found. Ensure /etc/hosts has "
137-
"localhost entry.",
137+
msg=f"{hostname} is not found. Ensure /etc/hosts has "
138+
f"{hostname} entry.",
138139
errno=ER_NO_HOSTNAME_FOUND,
139140
)
140141
else:

0 commit comments

Comments
 (0)