agent: guard against empty keyring files

pull/336/head
Ryan Uber 10 years ago
parent 7b4b87ccf1
commit 59a7938d1f

@ -50,6 +50,11 @@ func loadKeyringFile(c *serf.Config) error {
keysDecoded[i] = keyBytes
}
// Guard against empty keyring
if len(keysDecoded) == 0 {
return fmt.Errorf("no keys present in keyring file: %s", c.KeyringFile)
}
// Create the keyring
keyring, err := memberlist.NewKeyring(keysDecoded, keysDecoded[0])
if err != nil {

Loading…
Cancel
Save