diff --git a/.kitchen.yml b/kitchen.yml similarity index 91% rename from .kitchen.yml rename to kitchen.yml index da77029..d02c599 100644 --- a/.kitchen.yml +++ b/kitchen.yml @@ -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 diff --git a/libraries/ssh_config_helpers.rb b/libraries/ssh_config_helpers.rb index c546360..d7e03ea 100644 --- a/libraries/ssh_config_helpers.rb +++ b/libraries/ssh_config_helpers.rb @@ -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 diff --git a/providers/known_hosts.rb b/providers/known_hosts.rb index 2c694a1..85bed5f 100644 --- a/providers/known_hosts.rb +++ b/providers/known_hosts.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/provider_tests/config_spec.rb b/spec/provider_tests/config_spec.rb index 1d0fdc4..d77883b 100644 --- a/spec/provider_tests/config_spec.rb +++ b/spec/provider_tests/config_spec.rb @@ -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