func peerChangePreRun(cmd *cobra.Command, args []string) { if allPeers && len(args) > 0 { die("can't have both --all-peers and a list of peers") } mds = mustConnectToMDS() peers, err := mds.GetPeers() if err != nil { die("couldn't get peer list: %v", err) } var out torus.PeerInfoList for _, arg := range args { found := false for _, p := range peers { if p.Address != "" { if p.Address == arg { out = out.Union(torus.PeerInfoList{p}) found = true } else if p.UUID == arg { out = out.Union(torus.PeerInfoList{p}) found = true } } } if !found { if !force { die("peer %s not currently healthy. To remove, use `--force`", arg) } out = out.Union(torus.PeerInfoList{&models.PeerInfo{ UUID: arg, }}) } } if allPeers { for _, p := range peers { if p.Address != "" { out = out.Union(torus.PeerInfoList{p}) } } } newPeers = out }