Proposal: Fix inconsistent DNS driver API implementations
- Ngôn ngữ chính
- Python
- Star
- 2.1k
- Fork
- 931
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
## 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách đọc lớp DNS Record và phương thức update() của nó, sau đó so sánh các bài kiểm thử đơn vị của các driver DNS hiện có được đề cập trong đề xuất. Theo dõi cách các driver định dạng Record.name cho các request và response của provider. Để hoàn tất, cần có một API đặt tên chung đã được thống nhất, hành vi tương thích và các bài kiểm thử bao quát dữ liệu được gửi đến các provider, nhưng đề xuất không xác định các tệp cụ thể và cũng chưa chốt thiết kế.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend-api-design, networking
- Loại issue
- Tái cấu trúc
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100