feat: Implement pdsh compatibility layer core infrastructure#105
Merged
feat: Implement pdsh compatibility layer core infrastructure#105
Conversation
Add pdsh compatibility mode allowing bssh to act as a drop-in replacement for pdsh. This implements Phase 2 of the pdsh compatibility roadmap. Changes: - Create CLI module structure: cli/mod.rs, cli/bssh.rs, cli/pdsh.rs - Add is_pdsh_compat_mode() for binary name and env var detection - Add PdshCli struct with pdsh-compatible argument parsing - Implement to_bssh_cli() conversion method for option mapping - Add --pdsh-compat flag to bssh CLI - Add --any-failure flag for pdsh -S compatibility - Wire up mode detection in main.rs entry point - Add query mode (-q) support to show hosts and exit Option mapping: - -w hosts -> -H hosts - -x hosts -> --exclude hosts - -f N -> --parallel N - -l user -> -l user - -t N -> --connect-timeout N - -u N -> --timeout N - -N -> --no-prefix - -b -> --batch - -k -> --fail-fast - -q -> query mode - -S -> --any-failure Activation methods: 1. Symlink bssh as "pdsh" 2. Set BSSH_PDSH_COMPAT=1 environment variable 3. Use --pdsh-compat flag Includes 24 unit tests for mode detection and option mapping. Updates ARCHITECTURE.md with pdsh compatibility documentation.
- Use glob pattern matching in pdsh query mode (-q) for consistent behavior with bssh --exclude option - Add security validation for exclusion patterns in query mode (pattern length, wildcard count limits) - Replace unwrap() with if-let pattern in get_command() for more idiomatic Rust code Addresses code review feedback on PR #105.
Member
Author
Code Review Fixes AppliedFixed issues identified during code review: MEDIUM Severity (Fixed)
LOW Severity (Fixed)
All tests pass and clippy is clean. |
- Add pdsh compatibility section to README.md with activation methods, option mapping table, and usage examples - Add pdsh compatibility section to manpage (docs/man/bssh.1) - Add comprehensive integration tests for pdsh compatibility (tests/pdsh_compat_test.rs - 30 new tests) - Fix race condition in mode_detection_tests by testing logic directly instead of relying on concurrent env var state - Fix flaky rank_detector test by adding #[serial] and clearing env vars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
New Files
src/cli/mod.rs- CLI module exports and pdsh re-exportssrc/cli/pdsh.rs- pdsh-compatible CLI parser and conversion logicsrc/cli/mode_detection_tests.rs- Tests for mode detectionModified Files
src/cli/bssh.rs(renamed fromsrc/cli.rs) - Added--pdsh-compatand--any-failureflagssrc/main.rs- Wire up pdsh mode detection and routingARCHITECTURE.md- Document pdsh compatibility architectureOption Mapping
-w hosts-H hosts-x hosts--exclude hosts-f N--parallel N-l user-l user-t N--connect-timeout N-u N--timeout N-N--no-prefix-b--batch-k--fail-fast-q-S--any-failureTest plan
BSSH_PDSH_COMPAT=1 bssh -w hosts -qshows hostsbssh --pdsh-compat -w hosts -qshows hostsCloses #97