apache / apache/libcloud

Proposal: Fix inconsistent DNS driver API implementations

Ouverte
#2,065 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
2.1k
Forks
931
Merge moyen
1 j 2 h
PR mergées (30 j)
4

Description

## Summary

While comparing the LuaDNS driver to other DNS drivers, I noticed that there are a number of subtly incompatible implementations sharing an otherwise common API which limit portability between providers.

For example, some drivers use empty strings to represent apex/naked records (e.g. example.com.), while others use `None`. Both categories of drivers employ explicit unit testing to confirm their preferred `Record.name` value.

Similarly, some drivers want `Record.name` as a rooted FQDN (e.g. `"host.example.com."`), others as an unrooted FQDN (e.g. `"host.example.com"`), and still others as a bare host name (e.g. `"host"`).

## Proposal

Assuming that the **libcloud** DNS class/driver APIs are intended to provide a consistent interface for users and drivers should provide logic within themselves to adapt the common objects and interfaces for their respective services, I propose the following:

1. Add common logic to the `Record` class to standardize apex/naked record names on the empty string (or `None`).
2. Add common logic to the `Record` class to enforce that `.name` represents the host name, without the domain suffix. This would likely involve adding new `.fqdn` and `.hostname` properties to expose rooted and unrooted FQDN strings, respectively.
- For the sake of compatibility with existing uses, `__init__()` would accept a rooted/unrooted FQDN, a bare host name, or `None`.
3. ~~Refactor `Record.update()` to leverage common code to enforce the items above, while being kind to existing users.~~
4. Expand DNS driver unit tests to validate data sent *to* the provider. Presently, it appears that testing primarily validates the formatting of (canned) responses received *from* a provider.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par lire la classe DNS Record et sa méthode update(), puis comparez les tests unitaires des drivers DNS existants mentionnés dans la proposition. Suivez la façon dont les drivers formatent Record.name pour les requêtes et les réponses des fournisseurs. Pour considérer le travail comme terminé, il faut une API commune de nommage convenue, un comportement de compatibilité et des tests couvrant les données envoyées aux fournisseurs, mais la proposition n’identifie pas de fichiers précis et ne tranche pas le design.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
backend-api-design, networking
Type d'issue
Refactorisation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.