fix: Rewrite template for Ansible 2.19 compatibility #190
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.
Cause: Ansible 2.19 changed behaviour: Any value which is "none" gets
rendered as literal "None" string instead of "not rendered"/"empty
string.
Consequence: The generated config file was completely broken with
Ansible 2.19.
Fix: Add explicit
is not noneguards. Also refactor the template withan
ssh_optionslist to be less repetitive.Thanks to Claude-Sonnet 3.7 LLVM which heavily assisted with this
change.
This should fix Ansible 2.19 faliures. My train ride ends now, so I couldn't test this very thoroughly yet. Let's ask CI! Hence draft still.
Summary by Sourcery
Rewrite the SSH configuration template to guard against undefined or none values for Ansible 2.19 compatibility, simplify the rendering logic by consolidating option handling into a list-driven approach, and update tests to reflect new SSH config file paths.
Bug Fixes:
is not nonechecks for Ansible 2.19 compatibility.Enhancements:
ssh_optionslist and streamlinerender_option,body_option,match_block, andhost_blocklogic.Tests:
/etc/ssh/ssh_config.d/00-ansible.confand/etc/ssh/ssh_configfile paths.