Skip to content

Commit

Permalink
Merge pull request #260 from Shopify/tra0x/fix-cloudflare-normalization
Browse files Browse the repository at this point in the history
Fix Changeset normalization
  • Loading branch information
tra0x authored Nov 4, 2024
2 parents f3b1d55 + c6fad20 commit a0d1389
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 97 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 8.0.2
- Fix Changesets to be case-insensitive

## 8.0.1
- Fix Cloudflare provider to handle paginated returns from API

Expand Down
17 changes: 15 additions & 2 deletions lib/record_store/changeset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def build_from(provider:, zone:, all: false)
end

def initialize(current_records: [], desired_records: [], provider:, zone:)
@current_records = Set.new(current_records)
@desired_records = Set.new(desired_records)
@current_records = Set.new(normalize_records(current_records))
@desired_records = Set.new(normalize_records(desired_records))
@provider = provider
@zone = zone

Expand Down Expand Up @@ -114,5 +114,18 @@ def build_changeset
end
end
end

def normalize_records(records)
records.map do |record|
record.dup.tap do |r|
r.fqdn = r.fqdn.downcase
r.rdata.each do |key, value|
next if key == :txtdata

r.send("#{key}=", value.downcase) if value.is_a?(String)
end
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/record_store/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RecordStore
VERSION = '8.0.1'.freeze
VERSION = '8.0.2'.freeze
end
Loading

0 comments on commit a0d1389

Please sign in to comment.