mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
b00761705a
Before, only public flavors were considered when finding the next free ID. That could lead to the case where the calculated ID was already taken which lead to a conflict. This happened whenever the user tried to create a private flavor via fog and then another (private OR public) flavor afterwards. Now, we also take private flavors into account, so the conflict cannot happen anymore. As a side effect, it is now also possible to just return all private flavors, using the :is_public => false filter on the list_flavors_detail API call or the flavors collection.
28 lines
568 B
Ruby
28 lines
568 B
Ruby
require 'fog/core/collection'
|
|
require 'fog/openstack/models/compute/flavor'
|
|
|
|
module Fog
|
|
module Compute
|
|
class OpenStack
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
model Fog::Compute::OpenStack::Flavor
|
|
|
|
def all(options = {})
|
|
data = service.list_flavors_detail(options).body['flavors']
|
|
load(data)
|
|
end
|
|
|
|
def get(flavor_id)
|
|
data = service.get_flavor_details(flavor_id).body['flavor']
|
|
new(data)
|
|
rescue Fog::Compute::OpenStack::NotFound
|
|
nil
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|