Skip to content

Commit b59794a

Browse files
committed
Treat values as simple/array based on local lens
This code previously used an explicitly defined list of labels that were treated as arrays and not simple values. This broke the sshd_config provider for users with a version of the sshd lens from augeas 1.9.0 or newer. To avoid breaking support for older users, and to be forward-compatible with new versions of augeas that are aware of additional array values, this change determines if a label is an array or simple value by testing what the underlying augeas provider returns
1 parent d818ef6 commit b59794a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/puppet/provider/ssh_config/augeas.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def self.get_value(aug, pathx)
6262
end
6363

6464
def self.set_value(aug, base, path, label, value)
65-
if label =~ %r{Ciphers|SendEnv|MACs|(HostKey|Kex)Algorithms|GlobalKnownHostsFile|PubkeyAcceptedKeyTypes}i
65+
if parsed_as?("#{label} FOO\n", "#{label}/1", lens)
6666
set_array_value(aug, path, value)
6767
else
6868
set_simple_value(aug, base, path, label, value)

lib/puppet/provider/sshd_config/augeas.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def self.get_value(aug, pathx)
4444
end
4545

4646
def self.set_value(aug, base, path, label, value)
47-
if label =~ %r{^(((Allow|Deny)(Groups|Users))|AcceptEnv|MACs|(HostKey|Kex)Algorithms|Ciphers)$}i
47+
if parsed_as?("#{label} FOO\n", "#{label}/1", lens)
4848
set_array_value(aug, base, path, label, value)
4949
else
5050
set_simple_value(aug, base, path, label, value)

0 commit comments

Comments
 (0)