Class: BundleImageParameters

Inherits:
BundleMachineParameters show all
Defined in:
lib/ec2/amitools/bundleimageparameters.rb

Overview

The Bundle Image command line parameters.

Constant Summary collapse

IMAGE_PATH_DESCRIPTION =
"The path to the file system image to bundle."
PREFIX_DESCRIPTION =
"The filename prefix for bundled AMI files. Defaults to image name."

Constants inherited from BundleMachineParameters

BundleMachineParameters::ANCESTOR_AMI_IDS_DESCRIPTION, BundleMachineParameters::BDM_DESCRIPTION, BundleMachineParameters::KERNEL_DESCRIPTION, BundleMachineParameters::RAMDISK_DESCRIPTION

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 BundleMachineParameters

#ancestor_ami_ids, #block_device_mapping, #kernel_id, #ramdisk_id

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

#set_defaults

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?, #set_defaults, #version_copyright_string

Constructor Details

This class inherits a constructor from ParametersBase

Instance Attribute Details

#image_pathObject (readonly)

Returns the value of attribute image_path.



19
20
21
# File 'lib/ec2/amitools/bundleimageparameters.rb', line 19

def image_path
  @image_path
end

#prefixObject (readonly)

Returns the value of attribute prefix.



19
20
21
# File 'lib/ec2/amitools/bundleimageparameters.rb', line 19

def prefix
  @prefix
end

Instance Method Details

#mandatory_paramsObject



22
23
24
25
26
27
28
# File 'lib/ec2/amitools/bundleimageparameters.rb', line 22

def mandatory_params()
  super()
  on('-i', '--image PATH', String, IMAGE_PATH_DESCRIPTION) do |path|
    assert_file_exists(path, '--image')
    @image_path = path
  end
end

#optional_paramsObject



30
31
32
33
34
35
36
# File 'lib/ec2/amitools/bundleimageparameters.rb', line 30

def optional_params()
  super()
  on('-p', '--prefix PREFIX', String, PREFIX_DESCRIPTION) do |prefix|
    assert_good_key(prefix, '--prefix')
    @prefix = prefix
  end
end

#validate_paramsObject

Raises:



38
39
40
41
# File 'lib/ec2/amitools/bundleimageparameters.rb', line 38

def validate_params()
  raise MissingMandatory.new('--image') unless @image_path
  super()
end