Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .kitchen.yml → kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ provisioner:

driver_plugin: vagrant
driver_config:
require_chef_omnibus: '12.19' #'latest'
customize:
cpus: 2
memory: 2048
cpuexecutioncap: 75

platforms:
- name: ubuntu-12.04
- name: ubuntu-20.04
driver_config:
box: 'ubuntu/precise64'
box: 'ubuntu/focal64'
run_list:
- recipe[apt]
- name: centos-7.2
Expand Down
2 changes: 1 addition & 1 deletion libraries/ssh_config_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def parse_file(path) # rubocop:disable Style/CyclomaticComplexity
next if check_name && (name = check_name) && (entries[name] = {})

key, entry = parse_line(line)
next unless entry
next unless entry && name
entries[name][key] = entry
end
entries
Expand Down
4 changes: 1 addition & 3 deletions providers/known_hosts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def whyrun_supported?
execute "add known_host entry for #{new_resource.host}" do
command "echo '#{new_resource.key}' >> #{new_resource.path}"
user new_resource.user if new_resource.user
umask new_resource.user ? 0o077 : 0o022
end
end
end
Expand All @@ -38,7 +37,6 @@ def whyrun_supported?
execute "remove known_host entry for #{new_resource.host}" do
command "ssh-keygen -R #{Shellwords.escape(new_resource.host)} -f #{new_resource.path}"
user new_resource.user if new_resource.user
umask new_resource.user ? 0o077 : 0o022
end
end

Expand Down Expand Up @@ -80,7 +78,7 @@ def load_current_resource
cmd =
if new_resource.key.nil?
"ssh-keygen #{new_resource.hashed ? '-H ' : ''} -F #{Shellwords.escape(matching_host)} "\
"-f #{new_resource.path} | grep -F 'Host #{matching_host} found'"
"-f #{new_resource.path} | grep ."
else
"grep -F '#{new_resource.key}' '#{new_resource.path}'"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/provider_tests/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# rubocop:disable Metrics/BlockLength
describe 'ssh_config resource' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(:platform => 'ubuntu', :version => '12.04', :step_into => 'ssh_config')
runner = ChefSpec::SoloRunner.new(:platform => 'ubuntu', :version => '20.04', :step_into => 'ssh_config')
runner.converge('ssh_test::config')
end

Expand Down