From f4628c7388d284cc3721a136037bee4ba15b3155 Mon Sep 17 00:00:00 2001 From: felipemadero Date: Thu, 29 Aug 2024 16:05:19 -0300 Subject: [PATCH] Fuji api removal after sync (#2098) * do not remove fuji api node condition on node sync restart * nit --- cmd/nodecmd/sync.go | 14 ++++++++++++-- cmd/nodecmd/update_subnet.go | 8 +++++++- pkg/ssh/ssh.go | 11 ++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cmd/nodecmd/sync.go b/cmd/nodecmd/sync.go index d1ef13e7b..de1174d0e 100644 --- a/cmd/nodecmd/sync.go +++ b/cmd/nodecmd/sync.go @@ -143,10 +143,20 @@ func trackSubnet( nodeResults.AddResult(host.NodeID, nil, err) } - if err := ssh.RunSSHRenderAvagoAliasConfigFile(host, blockchainID.String(), subnetAliases); err != nil { + if err := ssh.RunSSHRenderAvagoAliasConfigFile( + host, + blockchainID.String(), + subnetAliases, + ); err != nil { nodeResults.AddResult(host.NodeID, nil, err) } - if err := ssh.RunSSHRenderAvalancheNodeConfig(app, host, network, allSubnets); err != nil { + if err := ssh.RunSSHRenderAvalancheNodeConfig( + app, + host, + network, + allSubnets, + clusterConf.IsAPIHost(host.GetCloudID()), + ); err != nil { nodeResults.AddResult(host.NodeID, nil, err) } if err := ssh.RunSSHSyncSubnetData(app, host, network, subnetName); err != nil { diff --git a/cmd/nodecmd/update_subnet.go b/cmd/nodecmd/update_subnet.go index 728d8cf55..810aaf5c0 100644 --- a/cmd/nodecmd/update_subnet.go +++ b/cmd/nodecmd/update_subnet.go @@ -95,7 +95,13 @@ func doUpdateSubnet( if err := ssh.RunSSHStopNode(host); err != nil { nodeResults.AddResult(host.NodeID, nil, err) } - if err := ssh.RunSSHRenderAvalancheNodeConfig(app, host, network, allSubnets); err != nil { + if err := ssh.RunSSHRenderAvalancheNodeConfig( + app, + host, + network, + allSubnets, + clusterConf.IsAPIHost(host.GetCloudID()), + ); err != nil { nodeResults.AddResult(host.NodeID, nil, err) } if err := ssh.RunSSHSyncSubnetData(app, host, network, subnetName); err != nil { diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index 7e5e85e47..f38b4570f 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -529,7 +529,13 @@ func RunSSHRenderAvagoAliasConfigFile( } // RunSSHRenderAvalancheNodeConfig renders avalanche node config to a remote host via SSH. -func RunSSHRenderAvalancheNodeConfig(app *application.Avalanche, host *models.Host, network models.Network, trackSubnets []string) error { +func RunSSHRenderAvalancheNodeConfig( + app *application.Avalanche, + host *models.Host, + network models.Network, + trackSubnets []string, + isAPIHost bool, +) error { // get subnet ids subnetIDs, err := utils.MapWithError(trackSubnets, func(subnetName string) (string, error) { sc, err := app.LoadSidecar(subnetName) @@ -550,8 +556,7 @@ func RunSSHRenderAvalancheNodeConfig(app *application.Avalanche, host *models.Ho if genesisFileExists(host) { avagoConf.GenesisPath = filepath.Join(constants.DockerNodeConfigPath, constants.GenesisFileName) } - // make sure that wiz works. TODO switch to RPC over SSH client to access 127.0.0.1 instead - if network.Kind == models.Local || network.Kind == models.Devnet { + if network.Kind == models.Local || network.Kind == models.Devnet || isAPIHost { avagoConf.HTTPHost = "0.0.0.0" } remoteAvagoConf, err := getAvalancheGoConfigData(host)