Skip to content

Commit

Permalink
[collect] Fix exception when using collect with batch and password
Browse files Browse the repository at this point in the history
Using --batch --password together in sos-collect leads to an error:

Unable to open remote session:
unsupported operand type(s) for +: 'bool' and 'str'

This commit adds a check for both options running at
the same time and if so, prints a message and exits.
Also, the commit changes the man page to reflect
this restriction.

Related: #3839

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill authored and TurboTurtle committed Nov 21, 2024
1 parent 4f1b3a9 commit b1a5a4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions man/en/sos-collect.1
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ This does NOT enable all sos collect options.
Become the root user on the remote node when connecting as a non-root user.
.TP
\fB\-\-batch\fR
Run in non-interactive mode. This will skip prompts for user input, with the
exception of a prompt for the SSH password.
Run in non-interactive mode. This will skip prompts for user input.
.TP
\fB\-\-all\-logs\fR
Report option. Collects all logs regardless of size.
Expand Down
8 changes: 8 additions & 0 deletions sos/collector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,14 @@ def execute(self):

self.intro()

if self.opts.batch and self.opts.password:
self.exit(
"\nsos-collector was called with incompatible options --batch "
"and --password.\nIf you need to use --password,"
" please omit batch mode.\n",
1
)

self.configure_sos_cmd()
self.prep()
self.display_nodes()
Expand Down

0 comments on commit b1a5a4a

Please sign in to comment.