lib/chef/knife/ec2_server_create.rb in knife-ec2-0.5.4 vs lib/chef/knife/ec2_server_create.rb in knife-ec2-0.5.5

- old
+ new

@@ -104,10 +104,15 @@ option :prerelease, :long => "--prerelease", :description => "Install the pre-release chef gems" + option :bootstrap_version, + :long => "--bootstrap-version VERSION", + :description => "The version of Chef to install", + :proc => Proc.new { |v| Chef::Config[:knife][:bootstrap_version] = v } + option :region, :long => "--region REGION", :description => "Your AWS region", :default => "us-east-1", :proc => Proc.new { |key| Chef::Config[:knife][:region] = key } @@ -182,10 +187,15 @@ :region => locate_config_value(:region) ) ami = connection.images.get(locate_config_value(:image)) + if ami.nil? + ui.error("You have not provided a valid image (AMI) value. Please note the short option for this value recently changed from '-i' to '-I'.") + exit 1 + end + server_def = { :image_id => locate_config_value(:image), :groups => config[:security_groups], :flavor_id => locate_config_value(:flavor), :key_name => Chef::Config[:knife][:aws_ssh_key_id], @@ -286,10 +296,11 @@ "#{ami.block_device_mapping.first['volumeSize']}GB.\n" + "Use file system tools to make use of the increased volume size.") end end end + puts "#{ui.color("Environment", :cyan)}: #{config[:environment] || '_default'}" puts "#{ui.color("Run List", :cyan)}: #{config[:run_list].join(', ')}" end def bootstrap_for_node(server) bootstrap = Chef::Knife::Bootstrap.new @@ -297,9 +308,10 @@ bootstrap.config[:run_list] = config[:run_list] bootstrap.config[:ssh_user] = config[:ssh_user] bootstrap.config[:identity_file] = config[:identity_file] bootstrap.config[:chef_node_name] = config[:chef_node_name] || server.id bootstrap.config[:prerelease] = config[:prerelease] + bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version) bootstrap.config[:distro] = locate_config_value(:distro) bootstrap.config[:use_sudo] = true bootstrap.config[:template_file] = locate_config_value(:template_file) bootstrap.config[:environment] = config[:environment] # may be needed for vpc_mode