Skip to content

Commit

Permalink
fix up go vet warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Nov 6, 2017
1 parent 5bb620f commit ed07520
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
6 changes: 3 additions & 3 deletions command/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ func (a *Agent) Reload(newConfig *Config) error {

if newConfig.TLSConfig != nil {
if !a.config.TLSConfig.IsEmpty() && !newConfig.TLSConfig.IsEmpty() {
a.logger.Println("[INFO] Updating agent's existing TLS configuration \n\n")
a.logger.Println("[INFO] Updating agent's existing TLS configuration")
// Handle errors in loading the new certificate files.
// This is just a TLS configuration reload, we don't need to refresh
// existing network connections
Expand All @@ -745,9 +745,9 @@ func (a *Agent) Reload(newConfig *Config) error {
a.config.TLSConfig = newConfig.TLSConfig

if a.config.TLSConfig.IsEmpty() && !newConfig.TLSConfig.IsEmpty() {
a.logger.Println("[INFO] Upgrading from plaintext configuration to TLS \n\n")
a.logger.Println("[INFO] Upgrading from plaintext configuration to TLS")
} else if !a.config.TLSConfig.IsEmpty() && newConfig.TLSConfig.IsEmpty() {
a.logger.Println("[WARN] Downgrading agent's existing TLS configuration to plaintext \n\n")
a.logger.Println("[WARN] Downgrading agent's existing TLS configuration to plaintext")
}

// Reload the TLS configuration for the client or server, depending on how
Expand Down
2 changes: 1 addition & 1 deletion nomad/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func TestServer_Reload_Vault(t *testing.T) {
}

// Tests that the server will successfully reload its network connections,
// upgrading from plaintext to TLS if the server's TLS configuratoin changes.
// upgrading from plaintext to TLS if the server's TLS configuration changes.
func TestServer_Reload_TLSConnections(t *testing.T) {
t.Parallel()
assert := assert.New(t)
Expand Down
9 changes: 0 additions & 9 deletions nomad/structs/config/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ func (t *TLSConfig) GetKeyLoader() *KeyLoader {

// If the keyloader has not yet been initialized, do it here
if t.KeyLoader == nil {
t.configLock.Lock()
t.KeyLoader = &KeyLoader{}
t.configLock.Unlock()
}
return t.KeyLoader
}
Expand Down Expand Up @@ -141,10 +139,3 @@ func (t *TLSConfig) IsEmpty() bool {
t.CertFile == "" &&
t.KeyFile == ""
}

// IsEmpty checks to see if every (non-boolean) field in the struct is nil
func (t *TLSConfig) IsEmpty() bool {
return t.CAFile == "" &&
t.CertFile == "" &&
t.KeyFile == ""
}

0 comments on commit ed07520

Please sign in to comment.