Class: PoolParty::Provision::DrConfigure

Inherits:
Object
  • Object
show all
Includes:
Remote
Defined in:
lib/poolparty/provision/dr_configure.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Remote

#_nodes, #are_any_nodes_exceeding_minimum_runtime?, #are_too_few_instances_running?, #are_too_many_instances_running?, #commands, #is_master_running?, #list_of_instances, #list_of_nodes_exceeding_minimum_runtime, #master, #netssh, #nodes, #remote_rsync_command, #remote_ssh_array, #remote_ssh_string, #rsync, #rsync_command, #rsync_storage_files_to, #rsync_storage_files_to_command, #rsync_to, #rsync_to_command, #run_command_on, #run_command_on_command, #run_command_on_instance_number, #run_local, #run_remote, #scp_array, #scp_to_command, #simplest_run_remote, #ssh_array, #ssh_command, #ssh_into, #ssh_into_instance_number, #ssh_options, #ssh_string, #target_host

Methods included from PoolParty::Pinger

included

Constructor Details

#initialize(host, opts = {}, &block) ⇒ DrConfigure

Returns a new instance of DrConfigure.



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/poolparty/provision/dr_configure.rb', line 36

def initialize(host, opts={}, &block)
  self.class.defaults.merge(opts).to_instance_variables(self)
  @target_host = host
  @configurator = "::PoolParty::Provision::#{dependency_resolver.capitalize}".constantize
  @cloud = opts[:cloud]
  @keypair = @cloud.keypair
  @run_count = 0
  
  @cloud.call_before_configure_callbacks if @cloud
  prescribe_configuration
  execute!
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &block) ⇒ Object

In case the method is being called on ourself, let’s check the defaults hash to see if it’s available there



24
25
26
27
28
29
30
31
32
# File 'lib/poolparty/provision/dr_configure.rb', line 24

def method_missing(m,*a,&block)
  if self.class.defaults.has_key?(m) 
    self.class.defaults[m]
  elsif @cloud
    @cloud.send m, *a, &block
  else
    super
  end
end

Instance Attribute Details

#cloudObject (readonly)

Returns the value of attribute cloud.



34
35
36
# File 'lib/poolparty/provision/dr_configure.rb', line 34

def cloud
  @cloud
end

#keypairObject (readonly)

Returns the value of attribute keypair.



34
35
36
# File 'lib/poolparty/provision/dr_configure.rb', line 34

def keypair
  @keypair
end

#run_countObject (readonly)

Returns the value of attribute run_count.



34
35
36
# File 'lib/poolparty/provision/dr_configure.rb', line 34

def run_count
  @run_count
end

Class Method Details

.defaultsObject



13
14
15
16
17
18
19
20
# File 'lib/poolparty/provision/dr_configure.rb', line 13

def self.defaults
  ::PoolParty::Default.default_options.merge({
    :full_keypair_path   => "#{ENV["AWS_KEYPAIR_NAME"]}" || "~/.ssh/id_rsa",
    :installer           => 'apt-get install -y',
    :dependency_resolver => 'chef',
    :invalid_run_count => 2
  })
end