diff --git a/lib/puppet/provider/ssh_config/augeas.rb b/lib/puppet/provider/ssh_config/augeas.rb index 88300f7..d42041e 100644 --- a/lib/puppet/provider/ssh_config/augeas.rb +++ b/lib/puppet/provider/ssh_config/augeas.rb @@ -68,7 +68,7 @@ def self.get_value(aug, pathx) end def self.set_value(aug, base, path, label, value) - if label =~ /Ciphers|SendEnv|MACs/i + if label =~ /Ciphers|SendEnv|MACs|GlobalKnownHostsFile/i aug.rm("#{path}/*") # In case there is more than one entry, keep only the first one aug.rm("#{path}[position() != 1]") diff --git a/spec/unit/puppet/provider/ssh_config/augeas_spec.rb b/spec/unit/puppet/provider/ssh_config/augeas_spec.rb index c592af8..de21e5d 100755 --- a/spec/unit/puppet/provider/ssh_config/augeas_spec.rb +++ b/spec/unit/puppet/provider/ssh_config/augeas_spec.rb @@ -27,6 +27,20 @@ end end + it "should create an array entry" do + apply!(Puppet::Type.type(:ssh_config).new( + :name => "GlobalKnownHostsFile", + :value => ["/etc/ssh/ssh_known_hosts", "/etc/ssh/ssh_known_hosts2"], + :target => target, + :provider => "augeas" + )) + + aug_open(target, "Ssh.lns") do |aug| + expect(aug.get("Host/GlobalKnownHostsFile/1")).to eq("/etc/ssh/ssh_known_hosts") + expect(aug.get("Host/GlobalKnownHostsFile/2")).to eq("/etc/ssh/ssh_known_hosts2") + end + end + it "should create an array entry" do apply!(Puppet::Type.type(:ssh_config).new( :name => "SendEnv",