-
Notifications
You must be signed in to change notification settings - Fork 56
Expand sshdconfig set capability #1307
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR expands the sshdconfig set capability to handle various SSH configuration argument types beyond simple strings. It modifies the get behavior to warn instead of error when input filters are provided (enabling DSC synthetic tests), adds configurable tracing with level and format options, and implements comprehensive formatting functions for different value types including match blocks.
Key changes:
- Changed
getcommand behavior from error to warning when input filters are provided - Added trace level and format configuration options (CLI flags and environment variable support)
- Implemented
format_sshd_value()andformat_match_block()helper functions to properly format booleans, arrays (with comma/space separation), numbers, and match blocks - Split
MULTI_ARG_KEYWORDSinto comma-separated and space-separated lists for proper formatting
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/sshdconfig/tests/sshdconfig.set.tests.ps1 | Expanded set tests to cover boolean, array (comma/space-separated), and match block value types |
| resources/sshdconfig/src/util.rs | Added trace configuration support, format_sshd_value() and format_match_block() formatting functions, changed get to warn on input filters |
| resources/sshdconfig/src/set.rs | Updated set logic to handle repeatable keywords and use new formatting functions |
| resources/sshdconfig/src/parser.rs | Updated to reference split multi-arg keyword constants and removed debug code |
| resources/sshdconfig/src/metadata.rs | Split MULTI_ARG_KEYWORDS into comma-separated and space-separated lists |
| resources/sshdconfig/src/main.rs | Added trace level/format argument handling with DSC_TRACE_LEVEL environment variable support |
| resources/sshdconfig/src/args.rs | Added TraceFormat and TraceLevel enums with CLI argument definitions |
| resources/sshdconfig/locales/en-us.toml | Added error message keys for match block validation and array element validation |
| dsc/tests/dsc_sshdconfig.tests.ps1 | Added DSC integration test for set command with various value types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR Summary
getbehavior towarninstead oferrorif any input is provided for filtering so DSC's synthetic test can be utilizedmatchblockssetPester tests to cover various argument types and invocation from DSC