Commit 598588a3 authored by Joanne Hugé's avatar Joanne Hugé Committed by Kirill Smelkov

amari/*: fix password connection

Hello @kirr , in a recent commit of simpleran software release I added a
password to the lteenb websocket: nexedi/slapos@77c00979

Since then the xlog service has stopped working correctly with the following error:

    {"meta": {"event": "service detach", "time": 1734710968.4153636, "srv_name": "ENB", "srv_type": "ENB", "srv_version": "2024-11-21", "reason": "handshake: service requires authentication, but no password provided"}}

After a bit of debugging I found out that there are several calls to
amari.connect but the password is given in parameter in only one of those call,
which explains the error above.

I included the password in all "amari.connect" calls and it looks like xlog is
working correctly with this commit.

I am not sure if this commit breaks anything or if this is the right way to do
it as I didn't spend too much time checking the code, when you have time could
you please review ?

Thank you,
Joanne

--------
kirr:

Fixes c5e92b6a (amari.xlog: Add support for password-based authentication)

/reviewed-by @kirr
/reviewed-on !10
parent 3a35162b
......@@ -108,6 +108,7 @@ class Conn:
raise ConnError("handshake") from ex
conn.wsuri = wsuri
conn.password = password
conn._ws = ws
conn.srv_ready_msg = msg0
conn.t_srv_ready_msg = t_msg0
......
......@@ -971,7 +971,7 @@ def _x_stats_srv(ctx, reqch: chan, conn: amari.Conn):
# both ue_get and stats queries, due to overall 100Hz rate-limiting, ue_get
# would be retrieved at only 50Hz rate. With separate connection for stats
# we can retrieve both ue_get and stats each at 100Hz simultaneously.
conn_stats = amari.connect(ctx, conn.wsuri)
conn_stats = amari.connect(ctx, conn.wsuri, password=conn.password)
defer(conn_stats.close)
rtt_stats = _IncStats() # like rtt_ue_stats but for stats instead of ue_get
δt_stats = _IncStats() # δ(stats.timestamp)
......
......@@ -418,7 +418,7 @@ class _XMsgServer:
# main logger queries stats, and x.drb_stats server also queries stats
# internally, then data received by main logger will cover only small
# random period of time instead of full wanted period.
conn2 = amari.connect(ctx, conn.wsuri)
conn2 = amari.connect(ctx, conn.wsuri, password=conn.password)
defer(conn2.close)
xsrv._func(ctx, xsrv._reqch, conn2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment