mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[google] Zone is a required parameter of machine_types request
Fixes ArgumentError: Missing required parameters: zone when calling get_machine_type
This commit is contained in:
parent
ed6886d2da
commit
347dc96761
2 changed files with 9 additions and 4 deletions
|
@ -15,8 +15,8 @@ module Fog
|
|||
load(data)
|
||||
end
|
||||
|
||||
def get(identity)
|
||||
data = connection.get_machine_type(identity).body
|
||||
def get(identity, zone_name = nil)
|
||||
data = connection.get_machine_type(identity, zone_name).body
|
||||
new(data)
|
||||
rescue Excon::Errors::NotFound
|
||||
nil
|
||||
|
|
|
@ -4,7 +4,7 @@ module Fog
|
|||
|
||||
class Mock
|
||||
|
||||
def get_machine_type(machine_type_name)
|
||||
def get_machine_type(machine_type_name, zone_name = nil)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
|
@ -12,9 +12,14 @@ module Fog
|
|||
|
||||
class Real
|
||||
|
||||
def get_machine_type(machine_type_name)
|
||||
def get_machine_type(machine_type_name, zone_name = nil)
|
||||
zone_name = list_zones.body['items'].first['name'] if zone_name.nil?
|
||||
if zone_name.start_with? 'http'
|
||||
zone_name = zone_name.split('/')[-1]
|
||||
end
|
||||
api_method = @compute.machine_types.get
|
||||
parameters = {
|
||||
'zone' => zone_name,
|
||||
'project' => 'google',
|
||||
'machineType' => machine_type_name
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue