markolson / chef-ssh

Chef cookbook for managing some mildly-difficult-to-automate SSH configuration
39 stars 54 forks source link

Fix/Adapt regex for HostName option when parsing file #37

Closed Sliim closed 9 years ago

Sliim commented 9 years ago

Old regex match "HostName ..." as a Host entry that generate an invalid ssh configuration file.

Sliim commented 9 years ago

Example of generated file (in specs):

12) ssh_config resource when non-default attributes are used can handle a custom path
Failure/Error: expect(chef_run).to render_file(test_config).with_content(
expected Chef run to render "/some/random/path/config" matching:

# Created by Chef for chefspec.local

Host somewhere
not indented
and_also_with =equal sign

Host second with extra patterns
Extra_spaces did_not_matter
HostName option is correctly matched
Multiple_words not a problem
We "can handle quotes"

Host test.io
User testuser
DummyKey I was allowed

but got:

# Created by Chef for chefspec.local

Host somewhere
not indented
and_also_with =equal sign

Host second with extra patterns
Extra_spaces did_not_matter

Host Name option is correctly matched
Multiple_words not a problem
We "can handle quotes"

Host test.io
User testuser
DummyKey I was allowed

     # ./spec/provider_tests/config_spec.rb:207:in `block (3 levels) in <top (required)>')
tejaycar commented 9 years ago

Thanks @Sliim this is now in the v0.10.2 which was released to the supermarket today.

Sliim commented 9 years ago

:+1: Thanks for your work! :)