Class: CloudFlock::App::ServerMigrate
- Inherits:
-
Object
- Object
- CloudFlock::App::ServerMigrate
- Defined in:
- lib/cloudflock/app/server-migrate.rb
Overview
Public: The ServerMigrate class provides the interface to perform one-shot migrations as a CLI application.
Constant Summary
Constants included from Common
Common::DATA_DIR, Common::EXCLUSIONS, Common::MOUNT_POINT, Common::PRIVATE_KEY, Common::PUBLIC_KEY, Common::SSH_ARGUMENTS
Instance Method Summary collapse
-
#initialize ⇒ ServerMigrate
constructor
Public: Obtain information needed to migrate one or more Unix hosts, and perform the migrations.
Methods included from Common
#check_hostkey, #cleanup_destination, #cleanup_rackspace_server, #configure_ips, #connect_destination, #connect_host, #connect_source, #create_watchdogs, #define_compute_flavor, #define_compute_image, #define_compute_name, #define_destination, #define_host, #define_source, #dest_watchdogs, #destroy_host, #determine_rsync, #determine_target_address, #ensure_no_watchdog_alerts, #filter_compute_flavors, #filter_compute_images, #generate_keypair, #generate_selection_table, #get_host_details, #managed_wait, #migrate_server, #prepare_destination_filesystem, #prepare_destination_pubkey, #prepare_destination_rsync, #prepare_source_exclusions, #prepare_source_rsync, #prepare_source_servicenet, #prepare_source_ssh_keygen, #provision_compute, #provision_wait, #remediate_ip, #rescue_compute, #restore_rackspace_users, #restore_user, #retry_exit, #retry_prompt, #rsync_migrate, #rsync_migrate_commands, #rsync_migrate_thread, #set_watchdog_alerts, #setup_destination, #source_watchdogs, #ssh_connect, #start_watchdog, #stop_watchdog, #stop_watchdogs, #transfer_rsync
Methods included from CloudFlock::App
#check_option, #check_option_fs, #check_option_pw, #check_option_yn, #load_config_if_present
Methods included from Rackspace
#define_rackspace_api, #define_rackspace_cloudservers_region, #define_rackspace_files_region, #define_rackspace_region, #define_rackspace_service_region
Constructor Details
#initialize ⇒ ServerMigrate
Public: Obtain information needed to migrate one or more Unix hosts, and perform the migrations.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cloudflock/app/server-migrate.rb', line 16 def initialize = servers = [:servers] servers ||= [] sources = servers.map(&method(:define_source)) profiles = sources.map do |host| source_host = ssh_connect(host) fetch_profile(source_host) end api,managed = get_api_and_service_level unless [:resume] destinations = profiles.zip(sources).map do |profile, host| destination_info(host, profile, [:resume], managed, api) end exclusions = profiles. zip(destinations). zip(sources). map(&:flatten).map do |profile, dest, host| puts UI.green { "#{host[:hostname]} -> #{dest[:hostname]}" } build_exclusions(profile.cpe) end results = sources. zip(destinations). zip(exclusions). zip(profiles). map(&:flatten). map { |params| do_migration(*params) } puts results.join("\n") end |