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

Dinahosting provider #414

Merged
merged 5 commits into from
Jul 16, 2019
Merged

Dinahosting provider #414

merged 5 commits into from
Jul 16, 2019

Conversation

iperurena
Copy link
Contributor

Add a provider for Dinahosting DNS API.

@CapsuleCD
Copy link
Contributor

Hi.

I'm an automated pull request bot named CapsuleCD. I handle testing, versioning and package releases for this project.

  • If you're the owner of this repo, you can click the button below to kick off the CapsuleCD build pipeline and create an automated release.'
  • If not, don't worry, someone will be by shortly to check on your pull request.

CapsuleCD


If you're interested in learning more about CapsuleCD, or adding it to your project, you can check it out here

@adferrand adferrand self-assigned this Jun 25, 2019
payload = self._post('', data)

#content_obj = self._parse_record_content(rtype, content)
#content = content_obj['data']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some commented code to remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. While I was at it I modified the _list_records to correct the lint issue and followed one of your suggestions from another PR about extracting the pseudo-id to its own _identifier method.


def _update_record(self, identifier, rtype=None, name=None, content=None):
if identifier:
records = self._list_records(rtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is not too heavy in term of API call, I think you could just get all records in the zone, not filtering on the rtype, then find the matching identifier. It allows a slightly wider usage of update_record.

if not matching_records:
raise Exception("No matching records found. Cannot update.")
if len(matching_records) > 1:
raise Exception("Multiple matching records found. Cannot update.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is your choice here, since we did not define precisely the spec when multiple records are encountered during an update. My current choice, on recent providers, is to take the first one, and log.warn about the fact that multiple records have been found.

Your choice here :)


def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
if identifier:
records = self._list_records(rtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above in update method, to just get all records in the zone then filter.

Copy link
Collaborator

@adferrand adferrand left a comment

Choose a reason for hiding this comment

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

Some observations, fixing the lint, and we are good to merge ! Thanks a lot !

Also, could you add the provider in the list of supported ones in README.md?

@adferrand
Copy link
Collaborator

NB: Don't mind the failure in AppVeyor if it is about Python 3.4 environment, it is broken for now.

@AnalogJ
Copy link
Owner

AnalogJ commented Jun 28, 2019

Hey @iperurena
I took a look at the PR, and my feedback is pretty similar to @adferrand
One thing I did notice is that there's alot of unsupported standard record types: ['MX', 'SRV', 'NS', 'SOA', 'LOC']
Can you give a little bit of context around what Dinahosting does with those?

Thanks again for the PR! 🎉

@iperurena
Copy link
Contributor Author

iperurena commented Jun 28, 2019

Hey @AnalogJ

Regarding the unsupported type list. To my knowledge, this API or the platform itself does not offer any mechanism to define LOC or SOA type records.

As for the other types, I found out that the API either supports them only partially or the methods are somewhat designed to work as a backend to the platform's UI rather than being used programmatically. Thus, I deemed them unsuitable for the purposes of this library.

To elaborate, MX records only work when using what the API calls "simplified MX". It won't let you define each record's priority and it introduces a weird dependency with A type records when listing/adding/deleting the records.

@iperurena
Copy link
Contributor Author

Looking forward to your feedback @AnalogJ , @adferrand

Copy link
Collaborator

@adferrand adferrand left a comment

Choose a reason for hiding this comment

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

For me, all observations have been answered, and the limitations on the API justify to limit the record types that will be handled by Lexicon. For the typical purpose of Lexicon, the coverage is sufficient.

Is it OK for you also @AnalogJ?

@adferrand
Copy link
Collaborator

OK. I think we can merge!

@adferrand adferrand merged commit 257cede into AnalogJ:master Jul 16, 2019
@iperurena
Copy link
Contributor Author

Just saw the message @adferrand, thank you for all your feedback!

chrisbraucker pushed a commit to chrisbraucker/lexicon that referenced this pull request Jan 1, 2020
* Add dinahosting provider stub

* Added provider logic & test recordings. Integration tests passed.

* Added myself to codeowners file

* Fixed the lint. Removed rtype filter in _update & _delete methods. Added _identifier helper

* Update integration test recordings. Add provider to readme
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 participants