Skip to content

Commit

Permalink
tools: nodecfg without dns (algorand#4967)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson authored Jan 6, 2023
1 parent 4d45e49 commit acd55ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cmd/nodecfg/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var applyRootDir string
var applyRootNodeDir string
var applyPublicAddress string
var nodeConfigBucket string
var disableDNS bool

func init() {
applyCmd.Flags().StringVarP(&applyChannel, "channel", "c", "", "Channel for the nodes we are configuring")
Expand All @@ -49,6 +50,8 @@ func init() {
applyCmd.Flags().StringVarP(&applyPublicAddress, "publicaddress", "a", "", "The public address to use if registering Relay or for Metrics")

applyCmd.Flags().StringVarP(&nodeConfigBucket, "bucket", "b", "", "S3 bucket to get node configuration from.")

applyCmd.Flags().BoolVarP(&disableDNS, "disable-dns", "N", false, "disable setting DNS entries")
}

var applyCmd = &cobra.Command{
Expand Down Expand Up @@ -122,7 +125,7 @@ func doApply(rootDir string, rootNodeDir, channel string, hostName string, dnsNa
return fmt.Errorf("configuration does not include this host: %s", hostName)
}

if hostNeedsDNSName(hostCfg) && dnsName == "" {
if hostNeedsDNSName(hostCfg) && dnsName == "" && !disableDNS {
return fmt.Errorf("publicaddress is required - Host contains Relays or exposes Metrics")
}

Expand Down
4 changes: 2 additions & 2 deletions netdeploy/remote/nodecfg/nodeConfigurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (nc *nodeConfigurator) apply(rootConfigDir, rootNodeDir string) (err error)

for _, nodeDir := range nodeDirs {
nodeDir.delaySave = true
err = nodeDir.configure(nc.dnsName)
err = nodeDir.configure()
if err != nil {
break
}
Expand All @@ -96,7 +96,7 @@ func (nc *nodeConfigurator) apply(rootConfigDir, rootNodeDir string) (err error)
nodeDir.saveConfig()
}

if err == nil {
if err == nil && nc.dnsName != "" {
fmt.Fprint(os.Stdout, "... registering DNS / SRV records\n")
err = nc.registerDNSRecords()
}
Expand Down
2 changes: 1 addition & 1 deletion netdeploy/remote/nodecfg/nodeDir.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type nodeDir struct {
// * EnableBlockStats
// * DashboardEndpoint
// * DeadlockOverride
func (nd *nodeDir) configure(dnsName string) (err error) {
func (nd *nodeDir) configure() (err error) {
fmt.Fprintf(os.Stdout, "Configuring Node %s\n", nd.Name)
if err = nd.configureRelay(nd.IsRelay()); err != nil {
fmt.Fprintf(os.Stdout, "Error during configureRelay: %s\n", err)
Expand Down

0 comments on commit acd55ce

Please sign in to comment.