Class: CheckCloudyScripts

Inherits:
Ec2Script show all
Defined in:
lib/scripts/ec2/check_cloudyscripts.rb

Overview

Goal: check internal piece of CloudyScripts without launching the full scripts

Defined Under Namespace

Classes: CSTestingState, CheckCloudyScriptsState, InitialState

Instance Method Summary collapse

Methods inherited from Ec2Script

#get_execution_result, #post_message, #register_progress_message_listener, #register_state_change_listener, #start_script

Constructor Details

#initialize(input_params) ⇒ CheckCloudyScripts

Returns a new instance of CheckCloudyScripts.



13
14
15
# File 'lib/scripts/ec2/check_cloudyscripts.rb', line 13

def initialize(input_params)
  super(input_params)
end

Instance Method Details

#check_input_parametersObject



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
# File 'lib/scripts/ec2/check_cloudyscripts.rb', line 17

def check_input_parameters()
  if @input_params[:ami_id] == nil && !(@input_params[:ami_id] =~ /^ami-.*$/)
    raise Exception.new("Invalid AMI ID specified: #{@input_params[:ami_id]}")
  end
  ec2_helper = Ec2Helper.new(@input_params[:ec2_api_handler])
  if ec2_helper.ami_prop(@input_params[:ami_id], 'rootDeviceType') != "ebs"
    raise Exception.new("must be an EBS type image")
  end
  local_ec2_helper = ec2_helper
  if !local_ec2_helper.check_open_port('default', 22)
    raise Exception.new("Port 22 must be opened for security group 'default' to connect via SSH in source-region")
  end
  remote_ec2_helper = Ec2Helper.new(@input_params[:target_ec2_handler])
  if !remote_ec2_helper.check_open_port('default', 22)
    raise Exception.new("Port 22 must be opened for security group 'default' to connect via SSH in target-region")
  end
  if @input_params[:root_device_name] == nil
    @input_params[:root_device_name] = "/dev/sda1"
  end
  if @input_params[:temp_device_name] == nil
    @input_params[:temp_device_name] = "/dev/sdj"
  end
  if @input_params[:source_ssh_username] == nil
    @input_params[:source_ssh_username] = "root"
  end
  if @input_params[:target_ssh_username] == nil
    @input_params[:target_ssh_username] = "root"
  end
end

#load_initial_stateObject

Load the initial state for the script. Abstract method to be implemented by extending classes.



49
50
51
# File 'lib/scripts/ec2/check_cloudyscripts.rb', line 49

def load_initial_state()
  CheckCloudyScriptsState.load_state(@input_params)
end