Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update our provider to match dnsimple-ruby 4.5.0 #60

Merged
merged 9 commits into from Oct 19, 2018

Conversation

martinisoft
Copy link
Contributor

This changeset resolves the breakage that occured in the 4.5.0 release which should resolve dnsimple/dnsimple-ruby#169

@martinisoft martinisoft self-assigned this Oct 18, 2018
Copy link
Member

@onlyhavecans onlyhavecans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one! Glad the tests help here. I have style suggestions though.
I'm going to mark approved as these are suggestions not requirement for merge

libraries/provider_dnsimple_record.rb Outdated Show resolved Hide resolved
libraries/provider_dnsimple_record.rb Outdated Show resolved Hide resolved
libraries/provider_dnsimple_record.rb Outdated Show resolved Hide resolved
@@ -31,7 +31,7 @@ def load_current_resource
@current_resource.domain(@new_resource.domain)
@current_resource.type(@new_resource.type)

records = dnsimple_client.zones.all_records(dnsimple_client_account_id,
records = dnsimple_client.zones.list_zone_records(dnsimple_client_account_id,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at this. I tried the patch and it does fix that error, but list_zone_records is paginated with 30 records per page so the logic below to detect if this in existing record often fails once someone has more than 30 records.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be all_zone_records instead

@@ -31,7 +31,7 @@ def load_current_resource
@current_resource.domain(@new_resource.domain)
@current_resource.type(@new_resource.type)

records = dnsimple_client.zones.all_records(dnsimple_client_account_id,
records = dnsimple_client.zones.list_zone_records(dnsimple_client_account_id,
Copy link
Member

@weppos weppos Oct 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
records = dnsimple_client.zones.list_zone_records(dnsimple_client_account_id,
records = dnsimple_client.zones.all_zone_records(dnsimple_client_account_id,

The method was renamed from all_records to all_zone_records.

@@ -29,7 +29,7 @@
let(:response) { instance_double(Dnsimple::Response, data: data) }
let(:data) { instance_double(Dnsimple::Struct::Whoami, account: account) }
let(:account) { instance_double(Dnsimple::Struct::Account, id: 1) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_records: zone_records, create_record: zone_record) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records, create_zone_record: zone_record) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records, create_zone_record: zone_record) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_zone_records: zone_records, create_zone_record: zone_record) }

@@ -40,7 +40,7 @@ def response

filter = {}
filter = { type: @type } if @type
client.zones.records(account_id, @zone, filter: filter).data.detect do |record|
client.zones.list_zone_records(account_id, @zone, filter: filter).data.detect do |record|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
client.zones.list_zone_records(account_id, @zone, filter: filter).data.detect do |record|
client.zones.all_zone_records(account_id, @zone, filter: filter).data.detect do |record|

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinisoft there is this one missing

@@ -40,7 +40,7 @@ def response

filter = {}
filter = { type: @type } if @type
client.zones.records(account_id, @zone, filter: filter).data.detect do |record|
client.zones.list_zone_records(account_id, @zone, filter: filter).data.detect do |record|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
client.zones.list_zone_records(account_id, @zone, filter: filter).data.detect do |record|
client.zones.all_zone_records(account_id, @zone, filter: filter).data.detect do |record|

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one

@@ -171,7 +171,7 @@
let(:response) { instance_double(Dnsimple::Response, data: data) }
let(:data) { instance_double(Dnsimple::Struct::Whoami, account: account) }
let(:account) { instance_double(Dnsimple::Struct::Account, id: 1) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_records: zone_records, update_record: zone_record) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records, update_zone_record: zone_record) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records, update_zone_record: zone_record) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_zone_records: zone_records, update_zone_record: zone_record) }

end

let(:client) { instance_double(Dnsimple::Client, identity: identity, zones: zones) }
let(:identity) { instance_double(Dnsimple::Client::Identity, whoami: response) }
let(:response) { instance_double(Dnsimple::Response, data: data) }
let(:data) { instance_double(Dnsimple::Struct::Whoami, account: account) }
let(:account) { instance_double(Dnsimple::Struct::Account, id: 1) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_records: zone_records) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let(:zones) { instance_double(Dnsimple::Client::ZonesService, list_zone_records: zone_records) }
let(:zones) { instance_double(Dnsimple::Client::ZonesService, all_zone_records: zone_records) }

Copy link
Member

@weppos weppos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinisoft the direct replacement of all_records is all_zone_records. I provided inline suggestions for easy approval.

@martinisoft
Copy link
Contributor Author

@weppos I have replaced all the methods, thank you for the assist on this one. Waiting for a green CI build.

@martinisoft
Copy link
Contributor Author

@thekendalmiller Let us know how my latest updates work for you now. Did not know about the difference in methods so that should be corrected now. If all is well, I will cut a new patch release since this is also affecting us in production (yes, we dogfood our own cookbook)

@thekendalmiller
Copy link

@martinisoft Thanks. It works for me now

@martinisoft martinisoft merged commit 257a790 into master Oct 19, 2018
@martinisoft martinisoft deleted the bugfix/gem_updates branch October 19, 2018 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.5.0 breaks chef-dnsimple resource
4 participants