1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1894 from cloudbau/flavor_id_fix

Fix autoincrement when creating a flavor if private flavors exist.
This commit is contained in:
Dan Prince 2013-06-19 13:04:39 -07:00
commit ac2d666561
3 changed files with 7 additions and 6 deletions

View file

@ -9,8 +9,8 @@ module Fog
model Fog::Compute::OpenStack::Flavor
def all
data = service.list_flavors_detail.body['flavors']
def all(options = {})
data = service.list_flavors_detail(options).body['flavors']
load(data)
end

View file

@ -12,7 +12,7 @@ module Fog
def create_flavor(attributes)
# Get last flavor id
flavor_ids = Array.new
flavors = list_flavors_detail.body['flavors']
flavors = list_flavors_detail.body['flavors'] + list_flavors_detail(:is_public => false).body['flavors']
flavors.each do |flavor|
flavor_ids << flavor['id'].to_i
end

View file

@ -3,11 +3,12 @@ module Fog
class OpenStack
class Real
def list_flavors_detail
def list_flavors_detail(options = {})
request(
:expects => [200, 203],
:method => 'GET',
:path => 'flavors/detail.json'
:path => 'flavors/detail.json',
:query => options
)
end
@ -15,7 +16,7 @@ module Fog
class Mock
def list_flavors_detail
def list_flavors_detail(options = {})
response = Excon::Response.new
response.status = 200
response.body = {