Skip to content

Commit

Permalink
Merge pull request fog#1894 from cloudbau/flavor_id_fix
Browse files Browse the repository at this point in the history
Fix autoincrement when creating a flavor if private flavors exist.
  • Loading branch information
dprince committed Jun 19, 2013
2 parents 06deb85 + b007617 commit ac2d666
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/fog/openstack/models/compute/flavors.rb
Expand Up @@ -9,8 +9,8 @@ class Flavors < Fog::Collection

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

Expand Down
2 changes: 1 addition & 1 deletion lib/fog/openstack/requests/compute/create_flavor.rb
Expand Up @@ -12,7 +12,7 @@ class Real
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
Expand Down
7 changes: 4 additions & 3 deletions lib/fog/openstack/requests/compute/list_flavors_detail.rb
Expand Up @@ -3,19 +3,20 @@ module Compute
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

end

class Mock

def list_flavors_detail
def list_flavors_detail(options = {})
response = Excon::Response.new
response.status = 200
response.body = {
Expand Down

0 comments on commit ac2d666

Please sign in to comment.