Class: CloudFlock::App::ServerProfile

Inherits:
Object
  • Object
show all
Includes:
Common, Remote
Defined in:
lib/cloudflock/app/server-profile.rb

Overview

Public: The ServerProfile class provides the interface to produce profiles describing hosts running Unix-like operating systems 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

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

#initializeServerProfile

Public: Connect to and profile a remote host, then display the gathered information.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cloudflock/app/server-profile.rb', line 14

def initialize
  options     = parse_options
  servers     = options[:servers]
  save_option = true unless servers
  servers   ||= [options]

  results = servers.map { |server| profile_host(server.dup, save_option) }
  printable = results.map do |hash|
    name = hash.keys.first
    profile = hash[name]
    UI.bold { UI.green { "#{name}\n" } } +
    generate_report(profile) +
    (options[:verbose] ? profile.process_list.to_s : "")
  end

  puts printable.join("\n\n")
end