Great, thanks Fred.

soaRecord.modify({value:[soaRecord[0].value.gsub(/ [0-9]+$/, " #{newttl}")]
})


[image:
https://s3.amazonaws.com/static.us/webapp/email_signature/jemstep.jpg]
<https://www.jemstep.com>
Brett Cave | System Architect

T: +27 11 523 3083 | M: +27 82 498 4827 | [email protected]

[image:
https://s3.amazonaws.com/static.us/webapp/email_signature/Facebook.png]
<https://www.facebook.com/jemstep>[image:
https://s3.amazonaws.com/static.us/webapp/email_signature/LinkedIn.png]
<http://www.linkedin.com/company/732170>[image:
https://s3.amazonaws.com/static.us/webapp/email_signature/Tweeter.png]
<https://twitter.com/jemstep>[image:
https://s3.amazonaws.com/static.us/webapp/email_signature/GooglePlus.png]
<https://plus.google.com/u/0/113419608106316977980/posts>

© 2015 Jemstep Inc. All rights reserved. | A: 75 Grayston Drive,
Morningside Ext 05, Sandton, Johannesburg, South Africa


On Fri, Aug 28, 2015 at 4:00 PM, Frederick Cheung <
[email protected]> wrote:

> Route53 is a little particular - updates are represented as a transaction
> consisting of destroy + create.
>
> it looks like the modify method on Fog::AWS::DNS::Record handles that for
> you
>
> Fred
>
>
> On 28 August 2015 at 14:48:25, Brett Cave ([email protected]) wrote:
>
> Hi, I am trying to use Fog to manage Route53 zones / records. I came
> across this post, which covered some of it:
> https://groups.google.com/forum/#!topic/ruby-fog/uObTJlynbUI
>
> I wanted to confirm whether this was me using it incorrectly vs limited
> functionality of the library.
>
> Use Case: Modify the SOA record of a domain by name (in-place edit, not a
> "destroy" and "create" - haven't tried this approach, and not going to as I
> don't think SOA can be removed or should be)
>
>     require 'fog'
>     newttl=3600
>     dns = Fog::DNS::AWS.new({ ... <connection params>})
>     zone = dns.zones.all.select { |zone| zone.domain == "mydomain.net." }
> [0]
>     soaRecord = zone.records.get("mydomain.net.", record_type = "SOA") #
> soaRecord.value[0] = "ns-1234.awsdns.com. awsdns-hostmaster.amazon.com 1
> 7200 900 1209600 86400"
>     soaRecord.value = [soaRecord[0].value.gsub(/ [0-9]+$/, " #{newttl}") #
> the ttl has now been changed on the soaRecord from 86400 to 3600.
>     soaRecord.save
>
>    Fog::DNS::AWS::Error: InvalidChangeBatch => Tried to create resource
> record set [name='mydomain.net.', type='SOA'] but it already exists
>
> I'm looking through the change_resource_record_sets.rb now...
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ruby-fog" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to