[plugin/unpackaged] Improve output filename to reflect data source#4218
[plugin/unpackaged] Improve output filename to reflect data source#4218pranlawate wants to merge 1 commit intososreport:mainfrom
Conversation
The unpackaged plugin output file was named simply 'unpackaged', which didn't indicate the collection methodology, making it difficult for users to reproduce outside of sos. Changed to dynamically generate filename from the package manager's files_command (e.g., 'path_grep_v_rpm_qal' on RPM systems), clearly indicating that it lists files in $PATH not tracked by the package manager (rpm -qal output). Also fixed MultiPackageManager compatibility by accessing the primary package manager's files_command attribute. Resolves: sosreport#4216 Signed-off-by: Pranav Lawate <pran.lawate@gmail.com>
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
| if pkg_mgr_cmd: | ||
| # Sanitize command to filename: 'rpm -qal' -> 'rpm_qal' | ||
| sanitized_cmd = pkg_mgr_cmd.replace(' ', '_').replace('-', '') | ||
| # Filename represents grep -v metaphor, not exact command | ||
| filename = f'path_grep_v_{sanitized_cmd}' | ||
| else: | ||
| # Fallback for package managers without a command | ||
| filename = 'path_grep_v_pkg_files' |
There was a problem hiding this comment.
As I mentioned in #4216, since the package manager is what implements the all_files() logic and we cannot say that this will always be a single command execution, I don't think building the command into this filename is the right choice here. We'd introduce further churn if we onboard a package manager in the future where this is the case, as we then have to refactor this once again which could cause downstream tooling issues.
Further, I really don't think we should include grep, much less with options, in the filename since we aren't doing grep at all.
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines
via a Closes (Issue) or Resolved (PR) line?
Summary
The unpackaged plugin output file was named simply 'unpackaged', which didn't indicate the collection methodology, making it difficult for users to reproduce outside of sos.
This PR changes the output filename to dynamically reflect the package manager's files_command (e.g., 'path_grep_v_rpm_qal' on RPM systems), making it clear that the file lists binaries in $PATH not tracked by the package manager.
Changes
sos/report/plugins/unpackaged.pyto generate dynamic filenames based on package manager'sfiles_commandfiles_commandattributetests/report_tests/plugin_tests/collect_manual_tests.pyto expect new filename formatTesting
path_grep_v_rpm_qalResolves: #4216