Copilot commented on code in PR #2177:
URL: https://github.com/apache/libcloud/pull/2177#discussion_r3689584752


##########
libcloud/dns/drivers/route53.py:
##########
@@ -237,13 +237,71 @@ def update_record(self, record, name=None, type=None, 
data=None, extra=None):
     def delete_record(self, record):
         try:
             r = record
-            batch = [("DELETE", r.name, r.type, r.data, r.extra)]
-            self._post_changeset(record.zone, batch)
+
+            # Multiple value records need to be handled specially - Route53
+            # only accepts a DELETE for a record set which lists every value
+            # in that set, so values for the other records need to be sent
+            # as well.
+
+            if r.extra.get("_multi_value", False) and 
r.extra.get("_other_records", []):
+                self._delete_multi_value_record(record=r)
+            else:
+                batch = [("DELETE", r.name, r.type, r.data, r.extra)]
+                self._post_changeset(record.zone, batch)

Review Comment:
   The multi-value delete path only triggers when the Record instance already 
has `_multi_value` / `_other_records` metadata (added by `_to_records`). 
Records returned from `create_record()` / `ex_create_multi_value_record()` (or 
user-constructed Records) won’t have that metadata, so `delete_record()` will 
still build a DELETE changeset with only one value and Route53 will reject it. 
Consider re-fetching the record set (via `get_record`) when the metadata is 
missing so multi-value deletes work regardless of how the Record was obtained.
   
   This issue also appears on line 300 of the same file.



-- 
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