hashicorp / hashicorp/serf

serf tags -get $TAGNAME [$NODENAME]

Open
#533 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.1k
Forks
609
Avg merge
15h 1m
Merged PRs (30d)
3

Description

Having finally found the need for tags and trying to produce a proof-of-concept, I find that there is a large-ish implementation gap in the 'tags' feature set.

A script can **easily set** a tag, but in order to **get** a tag, it seems that it must dissect the 'serf members' output (the intent of which seems to be more... human-readable) which is **doable**, but quite clumsy and inconvenient... particularly since the 'members' command will only filter by tag/value tuple, and not merely the **presence** of a tag.

I would recommend introducing a 'get' option to the 'tags' command that provides **only** the value of the requested tag, for the requested node (or the local node if no node name is provided).

To parallel the multiple-flag-support of the set command, it could even print tab-delimited values for easy shell scripting.

e.g.
```
#!/bin/bash
read LOAD USERS PANIC < <(serf tags -get load -get users -get panic gateway)

if [ "$LOAD" -gt "100" ]; then ...

echo "caution: $USERS active users!" > /etc/motd
...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.