Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b9e811b

Browse files
committedOct 28, 2021
clush: add --maxrc as long option for -S
- test maxrc from command line and clush.conf - doc minor changes
1 parent 25dad92 commit b9e811b

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed
 

‎conf/clush.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ command_timeout: 0
1010
color: auto
1111
fd_max: 8192
1212
history_size: 100
13-
node_count: yes
1413
maxrc: no
14+
node_count: yes
1515
verbosity: 1
1616

1717
# Add always all remote hosts to known_hosts without confirmation

‎doc/man/man1/clush.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Man page generated from reStructuredText.
22
.
3-
.TH CLUSH 1 "2019-12-01" "1.8.3" "ClusterShell User Manual"
3+
.TH CLUSH 1 "2021-10-27" "1.8.3" "ClusterShell User Manual"
44
.SH NAME
55
clush \- execute shell commands on a cluster
66
.
@@ -234,7 +234,7 @@ like \-b but including standard error
234234
.B \-r\fP,\fB \-\-regroup
235235
fold nodeset using node groups
236236
.TP
237-
.B \-S
237+
.B \-S\fP,\fB \-\-maxrc
238238
return the largest of command return codes
239239
.TP
240240
.BI \-\-color\fB= WHENCOLOR

‎doc/sphinx/config.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ The following table describes available *clush* config file settings.
6666
+-----------------+----------------------------------------------------+
6767
| maxrc | Should *clush* return the largest of command |
6868
| | return codes? (yes/no) |
69+
| | If set to no (the default), *clush* exit status |
70+
| | gives no information about command return codes, |
71+
| | but rather reports on *clush* execution itself |
72+
| | (zero indicating a successful run). |
6973
+-----------------+----------------------------------------------------+
7074
| verbosity | Set the verbosity level: 0 (quiet), 1 (default), |
7175
| | 2 (verbose) or more (debug). |

‎doc/txt/clush.conf.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ Simple configuration file.
110110
| history_size: 100
111111
| color: auto
112112
| fd_max: 10240
113-
| node_count: yes
114113
| maxrc: no
114+
| node_count: yes
115115
|
116116

117117

‎doc/txt/clush.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ execute shell commands on a cluster
77
-----------------------------------
88

99
:Author: Stephane Thiell <sthiell@stanford.edu>
10-
:Date: 2019-12-01
10+
:Date: 2021-10-27
1111
:Copyright: GNU Lesser General Public License version 2.1 or later (LGPLv2.1+)
1212
:Version: 1.8.3
1313
:Manual section: 1
@@ -159,7 +159,7 @@ Output behaviour:
159159
-b, --dshbak display gathered results in a dshbak-like way (note: it will only try to aggregate the output of commands with same return codes)
160160
-B like -b but including standard error
161161
-r, --regroup fold nodeset using node groups
162-
-S return the largest of command return codes
162+
-S, --maxrc return the largest of command return codes
163163
--color=WHENCOLOR whether to use ANSI colors to surround node or nodeset prefix/header with escape sequences to display them in color on the terminal. *WHENCOLOR* is ``never``, ``always`` or ``auto`` (which use color if standard output/error refer to a terminal). Colors are set to [34m (blue foreground text) for stdout and [31m (red foreground text) for stderr, and cannot be modified.
164164
--diff show diff between common outputs (find the best reference output by focusing on largest nodeset and also smaller command return code)
165165

@@ -183,7 +183,7 @@ Connection options:
183183
-u COMMAND_TIMEOUT, --command_timeout=COMMAND_TIMEOUT
184184
limit time for command to run on the node
185185
-R WORKER, --worker=WORKER
186-
worker name to use for connection (``exec``, ``ssh``, ``rsh``, ``pdsh``), default is ``ssh``
186+
worker name to use for connection (``exec``, ``ssh``, ``rsh``, ``pdsh``, or the name of a Python worker module), default is ``ssh``
187187
--remote=REMOTE whether to enable remote execution: in tree mode, 'yes' forces connections to the leaf nodes for execution, 'no' establishes connections up to the leaf parent nodes for execution (default is 'yes')
188188

189189
For a short explanation of these options, see ``-h, --help``.

‎lib/ClusterShell/CLI/OptionParser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def install_display_options(self,
172172
help="node / line content separator string "
173173
"(default: ':')")
174174
else:
175-
optgrp.add_option("-S", action="store_true", dest="maxrc",
175+
optgrp.add_option("-S", "--maxrc", action="store_true", dest="maxrc",
176176
help="return the largest of command return codes")
177177

178178
if msgtree_mode:

‎tests/CLIClushTest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def test_017_retcodes(self):
275275
self._clush_t(["-w", HOSTNAME, "/bin/false"], None, b"", 0, exp_err)
276276
self._clush_t(["-w", HOSTNAME, "-b", "/bin/false"], None, b"", 0, exp_err)
277277
self._clush_t(["-S", "-w", HOSTNAME, "/bin/false"], None, b"", 1, exp_err)
278+
self._clush_t(["--maxrc", "-w", HOSTNAME, "/bin/false"], None, b"", 1, exp_err)
278279
for i in (1, 2, 127, 128, 255):
279280
s = "clush: %s: exited with exit code %d\n" % (HOSTNAME, i)
280281
self._clush_t(["-S", "-w", HOSTNAME, "exit %d" % i], None, b"", i,

‎tests/CLIConfigTest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def testClushConfigEmpty(self):
3838
self.assertEqual(config.color, WHENCOLOR_CHOICES[-1])
3939
self.assertEqual(config.verbosity, VERB_STD)
4040
self.assertEqual(config.fanout, 64)
41+
self.assertEqual(config.maxrc, False)
4142
self.assertEqual(config.node_count, True)
4243
self.assertEqual(config.connect_timeout, 10)
4344
self.assertEqual(config.command_timeout, 0)
@@ -60,6 +61,7 @@ def testClushConfigAlmostEmpty(self):
6061
config = ClushConfig(options, filename=f.name)
6162
self.assertEqual(config.color, WHENCOLOR_CHOICES[-1])
6263
self.assertEqual(config.verbosity, VERB_STD)
64+
self.assertEqual(config.maxrc, False)
6365
self.assertEqual(config.node_count, True)
6466
self.assertEqual(config.fanout, 64)
6567
self.assertEqual(config.connect_timeout, 10)
@@ -96,6 +98,7 @@ def testClushConfigDefault(self):
9698
display.vprint(VERB_DEBUG, "shouldn't see this")
9799
self.assertEqual(config.color, WHENCOLOR_CHOICES[2])
98100
self.assertEqual(config.verbosity, VERB_STD)
101+
self.assertEqual(config.maxrc, False)
99102
self.assertEqual(config.node_count, True)
100103
self.assertEqual(config.fanout, 42)
101104
self.assertEqual(config.connect_timeout, 14)
@@ -116,6 +119,7 @@ def testClushConfigFull(self):
116119
command_timeout: 0
117120
history_size: 100
118121
color: auto
122+
maxrc: yes
119123
node_count: yes
120124
verbosity: 1
121125
ssh_user: root
@@ -132,6 +136,7 @@ def testClushConfigFull(self):
132136
config = ClushConfig(options, filename=f.name)
133137
self.assertEqual(config.color, WHENCOLOR_CHOICES[2])
134138
self.assertEqual(config.verbosity, VERB_STD)
139+
self.assertEqual(config.maxrc, True)
135140
self.assertEqual(config.node_count, True)
136141
self.assertEqual(config.fanout, 42)
137142
self.assertEqual(config.connect_timeout, 14)

0 commit comments

Comments
 (0)
Please sign in to comment.