chore: unify naming for node related types
This commit is contained in:
parent
b8cde30581
commit
6b170e4c5a
12 changed files with 72 additions and 53 deletions
|
|
@ -48,10 +48,10 @@ func parseState(state types.HostState) (string, []byte) {
|
|||
var builder strings.Builder
|
||||
|
||||
for _, d := range state.Domains {
|
||||
builder.WriteString(fmt.Sprintf("%s %s\n", state.Endpoint, d))
|
||||
builder.WriteString(fmt.Sprintf("%s %s\n", state.Address, d))
|
||||
}
|
||||
|
||||
return hostsDir + state.Name, []byte(builder.String())
|
||||
return hostsDir + state.Hostname, []byte(builder.String())
|
||||
}
|
||||
|
||||
func (r *Role) OnStartup(ctx context.Context) error {
|
||||
|
|
@ -76,15 +76,15 @@ func (r *Role) OnStartup(ctx context.Context) error {
|
|||
|
||||
func (r *Role) syncFromRegistry() {
|
||||
for _, n := range r.state.Registry.ByRole(types.HostRole) {
|
||||
state, err := client.Get[types.HostState](n.Address, types.PathHostDns)
|
||||
state, err := client.Get[types.HostState](n.Endpoint, types.PathHostDns)
|
||||
if err != nil {
|
||||
log.Warn().Str("name", n.Name).Err(err).Msg("unable to get host config")
|
||||
log.Warn().Str("name", n.Hostname).Err(err).Msg("unable to get host config")
|
||||
continue
|
||||
}
|
||||
|
||||
filename, data := parseState(*state)
|
||||
if err := r.updateDnsmasq(filename, data); err != nil {
|
||||
log.Warn().Str("name", n.Name).Err(err).Msg("unable to update dnsmasq")
|
||||
log.Warn().Str("name", n.Hostname).Err(err).Msg("unable to update dnsmasq")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue