Class: Clouddns::Actions::Migrate

Inherits:
GenericAction show all
Defined in:
lib/clouddns/actions/migrate.rb

Instance Method Summary collapse

Methods inherited from GenericAction

#initialize, run

Constructor Details

This class inherits a constructor from Clouddns::Actions::GenericAction

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/clouddns/actions/migrate.rb', line 5

def run
  require 'fog'

  @fog = Fog::DNS.new(@options[:fog])
  @fog_zone = @fog.zones.find { |z| z.domain == @zone.name }

  puts
  puts "Migrating '#{@zone.name}'"

  create_zone! unless @fog_zone

  # required to pick up nameservers and records
  @fog_zone = @fog_zone.reload

  print_nameservers

  @migration = ZoneMigration.new(@zone, @fog_zone)

  print_changes

  # no changes required
  return if @migration.completed?

  require_confirmation!

  @migration.perform!

  puts "Done"
end