Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[collect] Fix exception when using collect with batch and password #3840

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcastill
Copy link
Member

@jcastill jcastill commented Nov 15, 2024

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 PR removes the check for the batch option, enabling
the prompt for password as specified in the man page:

--batch
Run in non-interactive mode.
This will skip prompts for user input, with the
exception of a prompt for the SSH password.

Related: #3839


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

@jcastill jcastill force-pushed the jcastillo-fix-collect-batch-password branch from c227a5f to 10b5519 Compare November 15, 2024 22:26
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3840
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@jcastill
Copy link
Member Author

The call trace we get when this error occurs is the following:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/sos/collector/sosnode.py", line 89, in __init__
    self._transport.connect(self._password)
  File "/usr/lib/python3.9/site-packages/sos/collector/transports/__init__.py", line 146, in connect
    if self._connect(password):
  File "/usr/lib/python3.9/site-packages/sos/collector/transports/control_persist.py", line 134, in _connect
    res.sendline(password)
  File "/usr/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 578, in sendline
    return self.send(s + self.linesep)
TypeError: unsupported operand type(s) for +: 'bool' and 'str'

But I thought it may be better to catch the combination of options earlier, in execute() in SoSCollector, and exit there.
I'm not really sure about the actual message I wrote, so if anybody has any other suggestions please let me know.

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 PR removes the check for the batch option, enabling
the prompt for password as specified in the man page:

  --batch
      Run in non-interactive mode.
     This will skip prompts for user input,  with  the
     exception  of  a prompt for the SSH password.

Related: sosreport#3839

Signed-off-by: Jose Castillo <[email protected]>
@jcastill jcastill force-pushed the jcastillo-fix-collect-batch-password branch from 10b5519 to 105c250 Compare November 15, 2024 23:20
@jcastill
Copy link
Member Author

New fix, that takes into account the fact that we can use --password with --batch in sos-collect

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