From 824eec1af294882583bbfcf225d08b56909c32fd Mon Sep 17 00:00:00 2001 From: Ray Bellis Date: Thu, 7 Sep 2023 11:39:12 +0700 Subject: [PATCH] escape comments --- lib/puppet/provider/sshd_config_match/augeas.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/sshd_config_match/augeas.rb b/lib/puppet/provider/sshd_config_match/augeas.rb index 0dcdb24..485de8a 100644 --- a/lib/puppet/provider/sshd_config_match/augeas.rb +++ b/lib/puppet/provider/sshd_config_match/augeas.rb @@ -127,8 +127,9 @@ def create def comment augopen do |aug| + name = Regexp.escape(resource[:name]) comment = aug.get('$resource/Settings/#comment[1]') - comment&.sub!(%r{^#{resource[:name]}:\s*}i, '') + comment&.sub!(%r{^#{name}:\s*}i, '') comment || '' end end