Skip to content

Commit ca59ec5

Browse files
committed
Merge pull request #40 from tejaycar/master
fix gitlab 39. Use config.host rather than config.name in the config LW...
2 parents d65ecee + 66d4bfe commit ca59ec5

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# CHANGELOG for ssh
2+
## 0.10.4
3+
* fix github #39 where we use the resource name rather than host (The name attribute) in the config LWRP
4+
25
## 0.10.2
36
* Update the README
47
* Fix some spec tests

metadata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
license 'Apache 2.0'
55
description 'LWRPs for managing SSH known_hosts and config files'
66
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7-
version '0.10.2'
7+
version '0.10.4'

providers/config.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def whyrun_supported?
77
end
88

99
action :add do
10-
unless @new_resource.options.eql? @existing_entries[new_resource.name]
11-
@existing_entries[@new_resource.name] = @new_resource.options
10+
unless @new_resource.options.eql? @existing_entries[new_resource.host]
11+
@existing_entries[@new_resource.host] = @new_resource.options
1212

13-
converge_by "Adding {@new_resource.name} to #{@path} with #{new_resource.options.inspect}" do
13+
converge_by "Adding {@new_resource.host} to #{@path} with #{new_resource.options.inspect}" do
1414
create_directory
1515
create_file
1616
end
@@ -23,9 +23,9 @@ def whyrun_supported?
2323

2424
action :remove do
2525
if @current_resource.exists?
26-
@existing_entries.delete @new_resource.name
26+
@existing_entries.delete @new_resource.host
2727

28-
converge_by "Remove #{@new_resource.name} from #{@path}" do
28+
converge_by "Remove #{@new_resource.host} from #{@path}" do
2929
create_file
3030
end
3131
end
@@ -54,6 +54,6 @@ def load_current_resource
5454
@path = new_resource.path || default_or_user_path(new_resource.user)
5555
@existing_entries = parse_file @path
5656

57-
@current_resource = Chef::Resource::SshConfig.new(@new_resource.name)
58-
@current_resource.exists = @existing_entries.key? @new_resource.name
57+
@current_resource = Chef::Resource::SshConfig.new(@new_resource.host)
58+
@current_resource.exists = @existing_entries.key? @new_resource.host
5959
end

test/cookbooks/ssh_test/recipes/config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
group 'other_group'
1515
user 'someone'
1616

17-
ssh_config 'test.io' do
17+
ssh_config 'something else' do
18+
host 'test.io'
1819
options 'User' => 'testuser', 'DummyKey' => 'I was allowed'
1920
user 'someone'
2021
group 'other_group'

0 commit comments

Comments
 (0)