command/members: update for serf changes

This commit is contained in:
Armon Dadgar 2014-01-31 12:24:39 -08:00
parent b9e1b2c362
commit 1eea14c63e
1 changed files with 9 additions and 2 deletions

View File

@ -87,13 +87,20 @@ func (c *MembersCommand) Run(args []string) int {
for _, member := range members { for _, member := range members {
// Skip the non-matching members // Skip the non-matching members
if !roleRe.MatchString(member.Role) || !statusRe.MatchString(member.Status) { if !roleRe.MatchString(member.Tags["role"]) || !statusRe.MatchString(member.Status) {
continue continue
} }
// Format the tags as tag1=v1,tag2=v2,...
var tagPairs []string
for name, value := range member.Tags {
tagPairs = append(tagPairs, fmt.Sprintf("%s=%s", name, value))
}
tags := strings.Join(tagPairs, ",")
addr := net.TCPAddr{IP: member.Addr, Port: int(member.Port)} addr := net.TCPAddr{IP: member.Addr, Port: int(member.Port)}
c.Ui.Output(fmt.Sprintf("%s %s %s %s", c.Ui.Output(fmt.Sprintf("%s %s %s %s",
member.Name, addr.String(), member.Status, member.Role)) member.Name, addr.String(), member.Status, tags))
if detailed { if detailed {
c.Ui.Output(fmt.Sprintf(" Protocol Version: %d", c.Ui.Output(fmt.Sprintf(" Protocol Version: %d",