Browse Source

command: create serf dir if it doesn't exist, document -disable-keyring arg

pull/336/head
Ryan Uber 10 years ago
parent
commit
471ee9ce8f
  1. 11
      command/agent/agent.go
  2. 4
      command/agent/command.go

11
command/agent/agent.go

@ -116,15 +116,22 @@ func Create(config *Config, logOutput io.Writer) (*Agent, error) {
// Setup encryption keyring files // Setup encryption keyring files
if !config.DisableKeyring && config.EncryptKey != "" { if !config.DisableKeyring && config.EncryptKey != "" {
serfDir := filepath.Join(config.DataDir, "serf")
if err := os.MkdirAll(serfDir, 0700); err != nil {
return nil, err
}
keys := []string{config.EncryptKey} keys := []string{config.EncryptKey}
keyringBytes, err := json.MarshalIndent(keys, "", " ") keyringBytes, err := json.MarshalIndent(keys, "", " ")
if err != nil { if err != nil {
return nil, err return nil, err
} }
paths := []string{ paths := []string{
filepath.Join(config.DataDir, "serf", "keyring_lan"), filepath.Join(serfDir, "keyring_lan"),
filepath.Join(config.DataDir, "serf", "keyring_wan"), filepath.Join(serfDir, "keyring_wan"),
} }
for _, path := range paths { for _, path := range paths {
if _, err := os.Stat(path); err == nil { if _, err := os.Stat(path); err == nil {
continue continue

4
command/agent/command.go

@ -792,6 +792,10 @@ Options:
-data-dir=path Path to a data directory to store agent state -data-dir=path Path to a data directory to store agent state
-dc=east-aws Datacenter of the agent -dc=east-aws Datacenter of the agent
-encrypt=key Provides the gossip encryption key -encrypt=key Provides the gossip encryption key
-disable-keyring Disables the use of an encryption keyring. The
Default behavior is to persist encryption keys using
a keyring file, and reload the keys on subsequent
starts. This argument disables keyring persistence.
-join=1.2.3.4 Address of an agent to join at start time. -join=1.2.3.4 Address of an agent to join at start time.
Can be specified multiple times. Can be specified multiple times.
-join-wan=1.2.3.4 Address of an agent to join -wan at start time. -join-wan=1.2.3.4 Address of an agent to join -wan at start time.

Loading…
Cancel
Save