Fix no_host_uuid parsing
Need to pointerify it to default to true since we can't tell false from unset if it's not a pointer.
This commit is contained in:
parent
2f7d5d4bf9
commit
b9c9e6e557
|
@ -322,7 +322,12 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
|||
conf.GCDiskUsageThreshold = a.config.Client.GCDiskUsageThreshold
|
||||
conf.GCInodeUsageThreshold = a.config.Client.GCInodeUsageThreshold
|
||||
conf.GCMaxAllocs = a.config.Client.GCMaxAllocs
|
||||
conf.NoHostUUID = a.config.Client.NoHostUUID
|
||||
if a.config.Client.NoHostUUID != nil {
|
||||
conf.NoHostUUID = *a.config.Client.NoHostUUID
|
||||
} else {
|
||||
// Default no_host_uuid to true
|
||||
conf.NoHostUUID = true
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ type ClientConfig struct {
|
|||
|
||||
// NoHostUUID disables using the host's UUID and will force generation of a
|
||||
// random UUID.
|
||||
NoHostUUID bool `mapstructure:"no_host_uuid"`
|
||||
NoHostUUID *bool `mapstructure:"no_host_uuid"`
|
||||
}
|
||||
|
||||
// ServerConfig is configuration specific to the server mode
|
||||
|
@ -543,7 +543,7 @@ func DefaultConfig() *Config {
|
|||
GCDiskUsageThreshold: 80,
|
||||
GCInodeUsageThreshold: 70,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: true,
|
||||
NoHostUUID: helper.BoolToPtr(true),
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: false,
|
||||
|
@ -1005,7 +1005,7 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
|||
result.GCMaxAllocs = b.GCMaxAllocs
|
||||
}
|
||||
// NoHostUUID defaults to true, merge if false
|
||||
if !b.NoHostUUID {
|
||||
if b.NoHostUUID != nil {
|
||||
result.NoHostUUID = b.NoHostUUID
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
||||
"github.com/kr/pretty"
|
||||
)
|
||||
|
@ -78,7 +79,7 @@ func TestConfig_Parse(t *testing.T) {
|
|||
GCDiskUsageThreshold: 82,
|
||||
GCInodeUsageThreshold: 91,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: false,
|
||||
NoHostUUID: helper.BoolToPtr(false),
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
|
|
Loading…
Reference in New Issue