Skip to content

Commit

Permalink
removed some legacy vpc related code carried over from knife-ec2
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Apr 6, 2011
1 parent b8fe43a commit 2e1fc2d
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions lib/chef/knife/openstack_server_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,42 +171,14 @@ def run
:region => locate_config_value(:region)
)

ami = connection.images.get(locate_config_value(:image))

server_def = {
:image_id => locate_config_value(:image),
:groups => config[:security_groups],
:flavor_id => locate_config_value(:flavor),
:key_name => Chef::Config[:knife][:openstack_ssh_key_id],
:availability_zone => Chef::Config[:knife][:availability_zone]
}
server_def[:subnet_id] = config[:subnet_id] if config[:subnet_id]

if ami.root_device_type == "ebs"
ami_map = ami.block_device_mapping.first
ebs_size = begin
if config[:ebs_size]
Integer(config[:ebs_size]).to_s
else
ami_map["volumeSize"].to_s
end
rescue ArgumentError
puts "--ebs-size must be an integer"
msg opt_parser
exit 1
end
delete_term = if config[:ebs_no_delete_on_term]
"false"
else
ami_map["deleteOnTermination"]
end
server_def[:block_device_mapping] =
[{
'DeviceName' => ami_map["deviceName"],
'Ebs.VolumeSize' => ebs_size,
'Ebs.DeleteOnTermination' => delete_term
}]
end

server = connection.servers.create(server_def)

puts "#{ui.color("Instance ID", :cyan)}: #{server.id}"
Expand Down

0 comments on commit 2e1fc2d

Please sign in to comment.