Class: BundleTool

Inherits:
AMITool show all
Defined in:
lib/ec2/amitools/bundle_base.rb

Direct Known Subclasses

ImageBundler, VolBundler

Constant Summary

Constants inherited from AMITool

AMITool::BACKOFF_PERIOD, AMITool::MAX_TRIES, AMITool::PROMPT_TIMEOUT

Instance Method Summary collapse

Methods inherited from AMITool

#get_manual, #get_name, #handle_early_exit_parameters, #interactive?, #interactive_prompt, #main, #retry_s3, #run, #warn_confirm

Instance Method Details

#get_parameters(params_class) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ec2/amitools/bundle_base.rb', line 32

def get_parameters(params_class)
  params = super(params_class)
  
  if params.arch.nil?
    params.arch = SysChecks::get_system_arch()
    raise "missing or bad uname" if params.arch.nil?
    params.arch = user_override("arch", params.arch)
  end
  
  unless BundleParameters::SUPPORTED_ARCHITECTURES.include?(params.arch)
    unless warn_confirm("Unsupported architecture [#{params.arch}].")
      raise EC2StopExecution.new()
    end
  end
  
  tarcheck = SysChecks::good_tar_version?
  raise "missing or bad tar" if tarcheck.nil?
  unless tarcheck
    unless warn_confirm("Possibly broken tar version found. Please use tar version 1.15 or later.")
      raise EC2StopExecution.new()
    end
  end
  
  params
end

#notify(msg) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/ec2/amitools/bundle_base.rb', line 24

def notify(msg)
  $stdout.puts msg
  if interactive?
    print "Hit enter to continue anyway or Control-C to quit."
    gets
  end
end

#user_override(name, value) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/ec2/amitools/bundle_base.rb', line 16

def user_override(name, value)
  if interactive?
    instr = interactive_prompt("Please specify a value for #{name} [#{value}]: ", name)
    return instr.strip unless instr.nil? or instr.strip.empty?
  end
  value
end