lib/fog/openstack/requests/compute/create_flavor.rb in fog-1.19.0 vs lib/fog/openstack/requests/compute/create_flavor.rb in fog-1.20.0
- old
+ new
@@ -16,10 +16,10 @@
flavors.each do |flavor|
flavor_ids << flavor['id'].to_i
end
# Set flavor id
- attributes[:flavor_id] = attributes[:flavor_id] || flavor_ids.sort.last + 1
+ attributes[:flavor_id] = attributes[:flavor_id] || ((flavor_ids.length > 0) ? (flavor_ids.sort.last) + 1 : 1)
data = {
'flavor' => {
'name' => attributes[:name],
'ram' => attributes[:ram],