lib/chef/knife/ec2_server_create.rb in knife-ec2-0.6.0 vs lib/chef/knife/ec2_server_create.rb in knife-ec2-0.6.2
- old
+ new
@@ -178,15 +178,15 @@
:short => "-u USER_DATA_FILE",
:description => "The EC2 User Data file to provision the instance with",
:proc => Proc.new { |m| Chef::Config[:knife][:aws_user_data] = m },
:default => nil
- Chef::Config[:knife][:hints] ||= {"ec2" => {}}
option :hint,
:long => "--hint HINT_NAME[=HINT_FILE]",
:description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
:proc => Proc.new { |h|
+ Chef::Config[:knife][:hints] ||= {}
name, path = h.split("=")
Chef::Config[:knife][:hints][name] = path ? JSON.parse(::File.read(path)) : Hash.new
}
option :ephemeral,
@@ -341,9 +341,13 @@
bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'
bootstrap.config[:template_file] = locate_config_value(:template_file)
bootstrap.config[:environment] = config[:environment]
# may be needed for vpc_mode
bootstrap.config[:host_key_verify] = config[:host_key_verify]
+ # Modify global configuration state to ensure hint gets set by
+ # knife-bootstrap
+ Chef::Config[:knife][:hints] ||= {}
+ Chef::Config[:knife][:hints]["ec2"] ||= {}
bootstrap
end
def vpc_mode?
# Amazon Virtual Private Cloud requires a subnet_id. If