Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoincrement when creating a flavor if private flavors exist. #1894

Merged
merged 1 commit into from Jun 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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