From 391a46ec39c34861bb41e525843235ff675eeee1 Mon Sep 17 00:00:00 2001 From: Ashleigh Crosby Date: Wed, 24 Apr 2024 15:10:00 +0100 Subject: [PATCH] Fix should_content not correctly matching pdnsutil output This fixes two bugs when comparing zone contents to pdnsutil output, which triggers the continual re-import of managed zones: - an extraneous `\n` after `$ORIGIN .` which causes `\n\n` to be added to the resultant zone; - `rname` values being included in a case-sensitive manner, when records are always returned as downcase. --- lib/puppet/type/powerdns_zone.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type/powerdns_zone.rb b/lib/puppet/type/powerdns_zone.rb index 31de8f6..27bf1d2 100644 --- a/lib/puppet/type/powerdns_zone.rb +++ b/lib/puppet/type/powerdns_zone.rb @@ -136,11 +136,11 @@ def should_content if r[:rname] == '.' content.push([r[:target_zone], r[:rttl], r[:rclass], r[:rtype], r[:rcontent]].join("\t")) else - content.push([r[:rname] + '.' + r[:target_zone], r[:rttl], r[:rclass], r[:rtype], r[:rcontent]].join("\t")) + content.push([(r[:rname] + '.' + r[:target_zone]).downcase, r[:rttl], r[:rclass], r[:rtype], r[:rcontent]].join("\t")) end # rubocop:enable Style/StringConcatenation end - content.push("$ORIGIN .\n") # add this, since it's always in the output.. + content.push("$ORIGIN .") # add this, since it's always in the output.. content.sort.join("\n") end # rubocop:enable Metrics/AbcSize