You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by "uttam12331 (via GitHub)" <gi...@apache.org> on 2026/07/28 06:41:12 UTC
[PR] [Cloudflare] Fix list_record_types advertising URL instead of LOC [libcloud]
uttam12331 opened a new pull request, #2175:
URL: https://github.com/apache/libcloud/pull/2175
### Summary
The CloudFlare DNS driver's `RECORD_TYPE_MAP` has one entry that doesn't match the pattern of the rest:
```python
RECORD_TYPE_MAP = {
RecordType.A: "A",
...
RecordType.SRV: "SRV",
RecordType.URL: "LOC", # <-- key/value mismatch
}
```
Every other entry is an identity mapping, and the value `"LOC"` shows that LOC support was intended — the key is a copy-paste slip. `RecordType.URL` and `RecordType.LOC` both exist in `libcloud/dns/types.py`.
Because `list_record_types()` returns `RECORD_TYPE_MAP.keys()`, the driver:
- **advertises `RecordType.URL`**, which is not a Cloudflare DNS record type (Cloudflare does URL forwarding via Page/Redirect Rules, not DNS records), and
- **omits `RecordType.LOC`**, which Cloudflare *does* support.
### Reproduce
```python
from libcloud.dns.types import RecordType, Provider
from libcloud.dns.providers import get_driver
drv = get_driver(Provider.CLOUDFLARE)("key", "secret")
types = drv.list_record_types()
RecordType.URL in types # True -> should be False
RecordType.LOC in types # False -> should be True
```
### Fix
Correct the key to `RecordType.LOC`, making it an identity mapping like the others:
```python
RecordType.LOC: "LOC",
```
The map value isn't consumed by `create_record` (which passes the record type through directly), so the only observable effect is `list_record_types()`, which now correctly reports `LOC` and no longer reports `URL`. The entry count is unchanged (9).
### Tests
Extended `test_list_record_types` to assert `RecordType.LOC` is present and `RecordType.URL` is absent. It fails on the current code and passes with the fix. Full `test_cloudflare.py` suite: `29 passed`. flake8 clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Cloudflare] Fix list_record_types advertising URL instead of LOC [libcloud]
Posted by "micafer (via GitHub)" <gi...@apache.org>.
micafer merged PR #2175:
URL: https://github.com/apache/libcloud/pull/2175
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Cloudflare] Fix list_record_types advertising URL instead of LOC [libcloud]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2175:
URL: https://github.com/apache/libcloud/pull/2175#issuecomment-5141943006
## [Codecov](https://app.codecov.io/gh/apache/libcloud/pull/2175?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 83.39%. Comparing base ([`87c8cb0`](https://app.codecov.io/gh/apache/libcloud/commit/87c8cb06ed3d81ab041d1f0bae0e180caa53e2f6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`deba4cf`](https://app.codecov.io/gh/apache/libcloud/commit/deba4cf1989901743cc4d2fc76c79ea997bc2a71?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## trunk #2175 +/- ##
=======================================
Coverage 83.39% 83.39%
=======================================
Files 351 351
Lines 81519 81521 +2
Branches 8747 8747
=======================================
+ Hits 67982 67984 +2
Misses 10744 10744
Partials 2793 2793
```
| [Files with missing lines](https://app.codecov.io/gh/apache/libcloud/pull/2175?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [libcloud/dns/drivers/cloudflare.py](https://app.codecov.io/gh/apache/libcloud/pull/2175?src=pr&el=tree&filepath=libcloud%2Fdns%2Fdrivers%2Fcloudflare.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliY2xvdWQvZG5zL2RyaXZlcnMvY2xvdWRmbGFyZS5weQ==) | `91.07% <ø> (ø)` | |
| [libcloud/test/dns/test\_cloudflare.py](https://app.codecov.io/gh/apache/libcloud/pull/2175?src=pr&el=tree&filepath=libcloud%2Ftest%2Fdns%2Ftest_cloudflare.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliY2xvdWQvdGVzdC9kbnMvdGVzdF9jbG91ZGZsYXJlLnB5) | `100.00% <100.00%> (ø)` | |
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org