Skip to content

NodeSet: add brace expansion to node set strings - #739

Open
thiell wants to merge 1 commit into
clustershell:masterfrom
thiell:feature/nodeset-braces
Open

thiell wants to merge 1 commit into
clustershell:masterfrom
thiell:feature/nodeset-braces

Conversation

@thiell

@thiell thiell commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Braces list alternatives for a part of a node name: server[5-9]-{mds,oss} is server[5-9]-mds,server[5-9]-oss, and node[1-3]{,-ib} adds the -ib names of node[1-3]. Shell brace expansion is the usual workaround today, but it breaks clush -w (the shell splits the argument and clush runs the wrong command) and does not help in group sources, host files or the Python API.

  • {a,b} expands a term once per alternative; the union is one operand of the extended pattern operators, so node[1-9]&node{2,4} is node[2,4] (a textual rewrite would be wrong for & and ^)
  • several braces in a term form a cartesian product; alternatives may be empty and surrounding whitespace is ignored
  • alternatives are literal strings: ranges, groups, wildcards, operators and nested braces are rejected inside braces (and braces inside ranges), but keep working elsewhere in the same term (@rack{1,2}, server-{mds,oss}[0-3], n{1,2}*)
  • output never contains braces, so results stay usable as -w arguments everywhere
  • { and } become reserved characters and join ILLEGAL_GROUP_CHARS
  • strings without braces follow the same code path as before; parse time is unchanged within measurement noise
  • docs: new section in the cluset (or nodeset) tool pages and man pages, a mention for clush -w, the guide, the reserved characters in groups.conf, and a warning about quoting braces on the command line

@thiell thiell added this to the 1.11 milestone Oct 30, 2026
Braces list alternatives for a part of a node name:
server[5-9]-{mds,oss} is server[5-9]-mds,server[5-9]-oss, and
node[1-3]{,-ib} adds the -ib names of node[1-3]. Several braces in a
term form a cartesian product.

A term with braces is evaluated as a whole operand of the extended
pattern operators, so node[1-9]&node{2,4} is node[2,4]. Alternatives are
literal strings: ranges, groups, wildcards and operators are rejected
inside braces (and braces inside ranges) but still work elsewhere in the
same term, as each expansion is fed back through the parser.

{ and } become reserved characters and are added to ILLEGAL_GROUP_CHARS.
Strings without braces take the same code path as before.

Signed-off-by: Stephane Thiell <stephane@thiell.com>
@thiell
thiell force-pushed the feature/nodeset-braces branch from 9fe60d2 to 51b9736 Compare November 5, 2026 17:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant