Method: CloudFlock::App::Common#migrate_server

Defined in:
lib/cloudflock/app/common/servers.rb

#migrate_server(source_shell, dest_shell, exclusions) ⇒ Object

Public: Perform the final preperatory steps necessary as well as the migration.

source_shell - SSH object logged in to the source host. dest_shell - SSH object logged in to the destination host. exclusions - String containing the exclusions list for the migration.

Returns a String containing the host’s new ssh public key.



434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/cloudflock/app/common/servers.rb', line 434

def migrate_server(source_shell, dest_shell, exclusions)
  pubkey = prepare_source_ssh_keygen(source_shell)
  prepare_source_exclusions(source_shell, exclusions)
  setup_destination(dest_shell, pubkey)
  rsync = prepare_source_rsync(source_shell, dest_shell)
  dest_address = prepare_source_servicenet(source_shell, dest_shell)

  watchdogs = create_watchdogs(source_shell, dest_shell)
  rsync = "#{rsync} -azP -e 'ssh #{SSH_ARGUMENTS} -i #{PRIVATE_KEY}' " +
          "--exclude-from='#{EXCLUSIONS}' / #{dest_address}:#{MOUNT_POINT}"
  rsync_migrate(watchdogs, source_shell, rsync)
  stop_watchdogs(watchdogs)
end