Method: CloudFlock::App::Common#cleanup_destination
- Defined in:
- lib/cloudflock/app/common/servers.rb
#cleanup_destination(shell, profile) ⇒ Object
Public: Perform post-migration cleanup tasks.
shell - SSH object logged in to the target host. profile - CPE describing the platform in question.
Returns nothing.
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/cloudflock/app/common/servers.rb', line 513 def cleanup_destination(shell, profile) UI.spinner('Performing post-migration cleanup') do cleanup = Cleanup.new(profile) chroot_command = "chroot #{MOUNT_POINT} /bin/sh -C " \ "#{DATA_DIR}/chroot.sh" restore_rackspace_users(cleanup) shell.as_root("mkdir #{DATA_DIR}") shell.as_root("cat <<EOF> #{DATA_DIR}/pre.sh\n#{cleanup.pre_s}\nEOF") shell.as_root("cat <<EOF> #{DATA_DIR}/post.sh\n#{cleanup.post_s}\nEOF") chroot = "cat <<EOF> #{MOUNT_POINT}#{DATA_DIR}/chroot.sh\n" \ "#{cleanup.chroot_s}\nEOF" shell.as_root("mkdir -p #{MOUNT_POINT}#{DATA_DIR}") shell.as_root(chroot) shell.as_root("/bin/sh #{DATA_DIR}/pre.sh", 0) shell.as_root(chroot_command, 0) shell.as_root("/bin/sh #{DATA_DIR}/post.sh", 0) cleanup_rackspace_server(shell) end end |