From 2e988b31ebc09025692420e7c694224cc60ee784 Mon Sep 17 00:00:00 2001 From: Greg Brockman Date: Sun, 11 Sep 2011 10:47:05 -0700 Subject: [PATCH 1/2] Add support for changing hosted_zone status --- lib/route53.rb | 2 ++ lib/route53/cli.rb | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/route53.rb b/lib/route53.rb index 63bc02f..6102c10 100644 --- a/lib/route53.rb +++ b/lib/route53.rb @@ -372,6 +372,8 @@ def update(name,type,ttl,values,comment=nil, zone_apex = nil) @ttl = ttl unless ttl.nil? @values = values unless values.nil? @zone_apex = zone_apex unless zone_apex.nil? + @zone_apex = nil unless @zone_apex + @zone.perform_actions([ {:action => "DELETE", :record => prev}, {:action => "CREATE", :record => self}, diff --git a/lib/route53/cli.rb b/lib/route53/cli.rb index 0668cb5..db4ef19 100644 --- a/lib/route53/cli.rb +++ b/lib/route53/cli.rb @@ -68,7 +68,7 @@ def parsed_options? opts.on('--weight [WEIGHT]', String, "Specify a Weight for a record") { |weight| @options.weight = weight } opts.on('--ident [IDENTIFIER]', String, "Specify a unique identifier for a record") { |ident| @options.ident = ident } opts.on('--values [VALUE1],[VALUE2],[VALUE3]', Array, "Specify one or multiple values for a record") { |value| @options.values = value } - opts.on('--zone-apex-id [ZONE_APEX_ID]', String, "Specify a zone apex if for the record") { |zone_apex| @options.zone_apex = zone_apex } + opts.on('--zone-apex-id [ZONE_APEX_ID]', String, "Specify a zone apex if for the record") { |zone_apex| @options.zone_apex = zone_apex || false } opts.on('-m', '--comment [COMMENT]', String, "Provide a comment for this operation") { |comment| @options.comment = comment } @@ -277,7 +277,11 @@ def change_record end records.each do |r| puts "Modifying Record #{r.name}" - resp = r.update(@options.name,@options.dnstype,@options.ttl,@options.values,comment=nil) + if !@options.zone_apex.nil? && !@options.zone_apex && @options.ttl.nil? + $stderr.puts "ERROR: must provide --ttl if --zone_apex is set to empty string" + exit 1 + end + resp = r.update(@options.name,@options.dnstype,@options.ttl,@options.values,comment=nil,@options.zone_apex) pending_wait(resp) puts "Record Modified." unless resp.error? end From 317fe6607550ae07c48b44181528d95e8c4679d9 Mon Sep 17 00:00:00 2001 From: Greg Brockman Date: Sun, 11 Sep 2011 10:47:19 -0700 Subject: [PATCH 2/2] Add support for a change comment --- lib/route53/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/route53/cli.rb b/lib/route53/cli.rb index db4ef19..727d472 100644 --- a/lib/route53/cli.rb +++ b/lib/route53/cli.rb @@ -281,7 +281,7 @@ def change_record $stderr.puts "ERROR: must provide --ttl if --zone_apex is set to empty string" exit 1 end - resp = r.update(@options.name,@options.dnstype,@options.ttl,@options.values,comment=nil,@options.zone_apex) + resp = r.update(@options.name,@options.dnstype,@options.ttl,@options.values,@options.comment,@options.zone_apex) pending_wait(resp) puts "Record Modified." unless resp.error? end