Method: BigBang::KillCmd#kill_dns_entry

Defined in:
lib/bigbang/kill.rb

#kill_dns_entry(instance) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bigbang/kill.rb', line 11

def kill_dns_entry(instance)
	records = provider.configured_zone.records

	records = records.find_all do |r|
		r.value == instance.ipAddress
	end
	if records.empty?
		puts "no DNS records found for ip #{instance.ipAddress}"
		return
	end

	domains = records.collect { |r| r.domain }
	confirm("Would you like to remove the following dns records?\n" +
		domains.join("\n") + "\n") do
		records.each do |r|
			puts "removing DNS #{r.domain}"
			r.destroy
		end
	end
end