Skip to content

Commit

Permalink
CLI/Nodeset: omit @source: prefix for cluset -s source -L (#563) (#570)
Browse files Browse the repository at this point in the history
Let -s source behave as if it replaces the default group source, and
thus omit the source prefix for the groups in that source.

Part of #563.
  • Loading branch information
thiell authored Sep 14, 2024
1 parent 5c6f17f commit 3ab6cbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/ClusterShell/CLI/Nodeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ def command_list(options, xset, group_resolver):
if options.listall:
# useful: sources[0] is always the default or selected source
sources = group_resolver.sources()
# do not print name of default group source unless -s specified
if sources and not options.groupsource:
# do not print the name of the current group source (either the default
# or the one specified by -s)
if sources:
sources[0] = None
else:
sources = [options.groupsource]
Expand Down
2 changes: 1 addition & 1 deletion tests/CLINodesetTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def test_039_list_all(self):
self._nodeset_t(["-GL"], None,
b"@bar\n@foo\n@moo\n@baz\n@norf\n@qux\n")
self._nodeset_t(["--list-all", "-s", "other"], None,
b"@other:baz\n@other:norf\n@other:qux\n@test:bar\n@test:foo\n@test:moo\n")
b"@baz\n@norf\n@qux\n@test:bar\n@test:foo\n@test:moo\n")
self._nodeset_t(["--list-all", "-G", "-s", "other"], None,
b"@baz\n@norf\n@qux\n@bar\n@foo\n@moo\n") # 'other' source first

Expand Down

0 comments on commit 3ab6cbd

Please sign in to comment.