Skip to content

Commit

Permalink
Fix should_content not correctly matching pdnsutil output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Longsight authored Apr 24, 2024
1 parent adbd9f7 commit 391a46e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/type/powerdns_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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..

Check failure on line 143 in lib/puppet/type/powerdns_zone.rb

View workflow job for this annotation

GitHub Actions / Static & Spec Tests (Ruby 3.1, Puppet 7.0)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)

Check failure on line 143 in lib/puppet/type/powerdns_zone.rb

View workflow job for this annotation

GitHub Actions / Static & Spec Tests (Ruby 3.2, Puppet 7.0)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)

Check failure on line 143 in lib/puppet/type/powerdns_zone.rb

View workflow job for this annotation

GitHub Actions / Static & Spec Tests (Ruby 3.1, Puppet 8.0)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)

Check failure on line 143 in lib/puppet/type/powerdns_zone.rb

View workflow job for this annotation

GitHub Actions / Static & Spec Tests (Ruby 3.2, Puppet 8.0)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)
content.sort.join("\n")
end
# rubocop:enable Metrics/AbcSize
Expand Down

0 comments on commit 391a46e

Please sign in to comment.