[ 
https://issues.apache.org/jira/browse/LIBCLOUD-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14272480#comment-14272480
 ] 

ASF GitHub Bot commented on LIBCLOUD-651:
-----------------------------------------

GitHub user Itxaka opened a pull request:

    https://github.com/apache/libcloud/pull/432

    Fixes LIBCLOUD-651, Route53 cant delete a multiple value record

    Takes into consideration that when trying to delete multiple values you 
need to sent all the resources.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Itxaka/libcloud 
LIBCLOUD-651_route_53_cant_delete_multiple_value_record

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/432.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #432
    
----
commit 13c10efdb41cfe261b0ad999baa5fa9aa17313fd
Author: Itxaka Serrano <[email protected]>
Date:   2015-01-10T12:48:58Z

    Fixes LIBCLOUD-651, Route53 cant delete a multiple value record

----


> Route53 cant delete a multiple value record
> -------------------------------------------
>
>                 Key: LIBCLOUD-651
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-651
>             Project: Libcloud
>          Issue Type: Bug
>          Components: DNS
>            Reporter: Itxaka Serrano
>              Labels: dns, route53
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> example below:
> {code}
> from libcloud.dns.types import Provider
> from libcloud.dns.providers import get_driver
> from libcloud.dns.types import RecordType
> driver = get_driver(Provider.ROUTE53)
> dns = driver('REDACTED', 'REDACTED')
> zone = [zone for zone in dns.list_zones() if zone.domain == 
> 'REDACTED.com.'][0]
> dns.ex_create_multi_value_record(
>         name='testrecord', zone=zone,
>         type=RecordType.A, data='127.0.0.1\n127.0.0.2\n127.0.0.3\n127.0.0.4',
>         extra={'ttl': 0}
>         )
> record = dns.get_record(zone.id,'A:testrecord')
> record.extra
> {'_multi_value': True,
>  '_other_records': [{'data': '127.0.0.2',
>    'extra': {'ttl': 0},
>    'name': 'testrecord',
>    'type': 'A'},
>   {'data': '127.0.0.3',
>    'extra': {'ttl': 0},
>    'name': 'testrecord',
>    'type': 'A'},
>   {'data': '127.0.0.4',
>    'extra': {'ttl': 0},
>    'name': 'testrecord',
>    'type': 'A'}],
>  'ttl': 0}
> record.id
> 'A:testrecord'
> dns.delete_record(record)
> Traceback (most recent call last):
>   File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 
> 2883, in run_code
>     exec(code_obj, self.user_global_ns, self.user_ns)
>   File "<ipython-input-29-38c197043e24>", line 1, in <module>
>     dns.delete_record(record)
>   File "C:\Python27\lib\site-packages\libcloud\dns\drivers\route53.py", line 
> 228, in delete_record
>     record_id=r.id)
> RecordDoesNotExistError: <RecordDoesNotExistError in 
> <libcloud.dns.drivers.route53.Route53DNSDriver object at 0x03140E90>, 
> record_id=A:testrecord, value=>
> record.delete()
> Traceback (most recent call last):
>   File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 
> 2883, in run_code
>     exec(code_obj, self.user_global_ns, self.user_ns)
>   File "<ipython-input-30-ff7f7979af38>", line 1, in <module>
>     record.delete()
>   File "C:\Python27\lib\site-packages\libcloud\dns\base.py", line 130, in 
> delete
>     return self.driver.delete_record(record=self)
>   File "C:\Python27\lib\site-packages\libcloud\dns\drivers\route53.py", line 
> 228, in delete_record
>     record_id=r.id)
> RecordDoesNotExistError: <RecordDoesNotExistError in 
> <libcloud.dns.drivers.route53.Route53DNSDriver object at 0x03140E90>, 
> record_id=A:testrecord, value=>
> {code}
> This is the XML that its being generated:
> {code}
> <ChangeResourceRecordSetsRequest 
> xmlns="https://route53.amazonaws.com/doc/2012-02-29/";>
>     <ChangeBatch>
>         <Changes>
>             <Change>
>                 <Action>DELETE</Action>
>                 <ResourceRecordSet>
>                     <Name>testrecord.REDACTED.com.</Name>
>                     <Type>A</Type>
>                     <TTL>0</TTL>
>                     <ResourceRecords>
>                         <ResourceRecord>
>                             <Value>127.0.0.1</Value>
>                         </ResourceRecord>
>                     </ResourceRecords>
>                 </ResourceRecordSet>
>             </Change>
>         </Changes>
>     </ChangeBatch>
> </ChangeResourceRecordSetsRequest>
> {code}
> So the issue here is that because there is no code to check for multiple 
> value records on delete, it will always fail because the ResourceRecordSet is 
> not properly filled with all the ResourceRecord's for that ResourceRecordSet .
> Patch incoming.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to