Class: BundleMachineParameters

Inherits:
BundleParameters show all
Defined in:
lib/ec2/amitools/bundlemachineparameters.rb

Overview

The Bundle command line parameters.

Direct Known Subclasses

BundleImageParameters, BundleVolParameters

Constant Summary collapse

KERNEL_DESCRIPTION =
"Id of the default kernel to launch the AMI with."
RAMDISK_DESCRIPTION =
"Id of the default ramdisk to launch the AMI with."
ANCESTOR_AMI_IDS_DESCRIPTION =
"Lineage of this image. Comma separated list of AMI ids."
BDM_DESCRIPTION =
['Default block-device-mapping scheme to launch the AMI with. This scheme',
 'defines how block devices may be exposed to an EC2 instance of this AMI',
 'if the instance-type of the instance is entitled to the specified device.',
 'The scheme is a comma-separated list of key=value pairs, where each key',
 'is a "virtual-name" and each value, the corresponding native device name',
 'desired. Possible virtual-names are:',
 ' - "ami": denotes the root file system device, as seen by the instance.',
 ' - "root": denotes the root file system device, as seen by the kernel.',
 ' - "swap": denotes the swap device, if present.',
 ' - "ephemeralN": denotes Nth ephemeral store; N is a non-negative integer.',
 'Note that the contents of the AMI form the root file system. Samples of',
 'block-device-mappings are:',
 ' - "ami=sda1,root=/dev/sda1,ephemeral0=sda2,swap=sda3"',
 ' - "ami=0,root=/dev/dsk/c0d0s0,ephemeral0=1"'
]

Constants inherited from BundleParameters

BundleParameters::ARCHITECTURE_DESCRIPTION, BundleParameters::BATCH_DESCRIPTION, BundleParameters::DEBUG_DESCRIPTION, BundleParameters::DESTINATION_DESCRIPTION, BundleParameters::EC2_CERT_PATH_DESCRIPTION, BundleParameters::HELP_DESCRIPTION, BundleParameters::MANUAL_DESCRIPTION, BundleParameters::PRODUCT_CODES_DESCRIPTION, BundleParameters::PROMPT_TIMEOUT, BundleParameters::SIZE_CHECKS_DESCRIPTION, BundleParameters::SUPPORTED_ARCHITECTURES, BundleParameters::USER_DESCRIPTION, BundleParameters::VERSION_DESCRIPTION

Constants inherited from ParametersBase

ParametersBase::BATCH_DESCRIPTION, ParametersBase::DEBUG_DESCRIPTION, ParametersBase::HELP_DESCRIPTION, ParametersBase::MANUAL_DESCRIPTION, ParametersBase::PASS_DESCRIPTION, ParametersBase::USER_ACCOUNT_DESCRIPTION, ParametersBase::USER_CERT_PATH_DESCRIPTION, ParametersBase::USER_DESCRIPTION, ParametersBase::USER_PK_PATH_DESCRIPTION, ParametersBase::VERSION_DESCRIPTION

Instance Attribute Summary collapse

Attributes inherited from BundleParameters

#arch, #batch_mode, #debug, #destination, #ec2_cert_path, #manual, #product_codes, #show_help, #size_checks, #user, #user_cert_path, #user_pk_path

Attributes inherited from ParametersBase

#batch_mode, #debug, #manual, #show_help, #version

Instance Method Summary collapse

Methods inherited from BundleParameters

#mandatory_params, #set_defaults, #validate_params

Methods inherited from ParametersBase

#assert_directory_exists, #assert_exists, #assert_file_executable, #assert_file_exists, #assert_glob_expands, #assert_good_key, #assert_option_in, #common_params, #early_exit?, #initialize, #interactive?, #mandatory_params, #set_defaults, #validate_params, #version_copyright_string

Constructor Details

This class inherits a constructor from ParametersBase

Instance Attribute Details

#ancestor_ami_idsObject

Returns the value of attribute ancestor_ami_ids.



35
36
37
# File 'lib/ec2/amitools/bundlemachineparameters.rb', line 35

def ancestor_ami_ids
  @ancestor_ami_ids
end

#block_device_mappingObject

Returns the value of attribute block_device_mapping.



35
36
37
# File 'lib/ec2/amitools/bundlemachineparameters.rb', line 35

def block_device_mapping
  @block_device_mapping
end

#kernel_idObject

Returns the value of attribute kernel_id.



35
36
37
# File 'lib/ec2/amitools/bundlemachineparameters.rb', line 35

def kernel_id
  @kernel_id
end

#ramdisk_idObject

Returns the value of attribute ramdisk_id.



35
36
37
# File 'lib/ec2/amitools/bundlemachineparameters.rb', line 35

def ramdisk_id
  @ramdisk_id
end

Instance Method Details

#optional_paramsObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ec2/amitools/bundlemachineparameters.rb', line 40

def optional_params()
  super()
  on( '--kernel ID', KERNEL_DESCRIPTION ) do |id|
    @kernel_id = id
  end
  
  on( '--ramdisk ID', RAMDISK_DESCRIPTION ) do |id|
    @ramdisk_id = id
  end

  on( '-B', '--block-device-mapping MAPS', String, *BDM_DESCRIPTION ) do |bdm|
    @block_device_mapping ||= {}
    raise InvalidValue.new('--block-device-mapping', bdm) if bdm.to_s.empty?
    bdm.split(',').each do |mapping|
      raise InvalidValue.new('--block-device-mapping', bdm) unless mapping =~ /^\s*(\S)+\s*=\s*(\S)+\s*$/
      virtual, device = mapping.split(/=/)
      @block_device_mapping[virtual.strip] = device.strip
    end
  end
end