From db08b7b13b1b03b35f8fcc6e63b21b5331bbee89 Mon Sep 17 00:00:00 2001 From: Bohdan Shulha Date: Sun, 8 Sep 2024 20:52:11 +0200 Subject: [PATCH] fix: always provide addr --- internal/app/ptah-agent/ptah_client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/app/ptah-agent/ptah_client.go b/internal/app/ptah-agent/ptah_client.go index 1fd3548..33ea4b0 100644 --- a/internal/app/ptah-agent/ptah_client.go +++ b/internal/app/ptah-agent/ptah_client.go @@ -66,7 +66,11 @@ func (a *Agent) sendStartedEvent(ctx context.Context) (*ptahClient.StartedRes, e nodeData.Role = "worker" } - nodeData.Addr = info.Swarm.NodeAddr + if info.Swarm.NodeAddr != "" { + nodeData.Addr = info.Swarm.NodeAddr + } else { + nodeData.Addr = nets[0].IPs[0].IP + } startedReq := ptahClient.StartedReq{ NodeData: nodeData,