Sha256: 29e3593ffa735ee0e894d943e2add663e0b381659d9252514081740d5135b42b

Contents?: true

Size: 1.77 KB

Versions: 4

Compression:

Stored size: 1.77 KB

Contents

# Copyright 2008-2014 Amazon.com, Inc. or its affiliates.  All Rights
# Reserved.  Licensed under the Amazon Software License (the
# "License").  You may not use this file except in compliance with the
# License. A copy of the License is located at
# http://aws.amazon.com/asl or in the "license" file accompanying this
# file.  This file is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
# the License for the specific language governing permissions and
# limitations under the License.

require 'ec2/amitools/tool_base'
require 'ec2/amitools/bundleparameters'

class BundleTool < AMITool

  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

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

  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ec2_amitools-1.0.8 lib/ec2/amitools/bundle_base.rb
ec2_amitools-1.0.7 lib/ec2/amitools/bundle_base.rb
ec2_amitools-1.0.6 lib/ec2/amitools/bundle_base.rb
ec2_amitools-1.0.2 lib/ec2/amitools/bundle_base.rb