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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to