lib/fog/azurerm/requests/compute/create_availability_set.rb in fog-azure-rm-0.0.1 vs lib/fog/azurerm/requests/compute/create_availability_set.rb in fog-azure-rm-0.0.2
- old
+ new
@@ -10,11 +10,11 @@
Fog::Logger.debug "Creating Availability Set '#{name}' in #{location} region."
avail_set_props = get_avail_set_properties(location)
promise = @compute_mgmt_client.availability_sets.create_or_update(resource_group, name, avail_set_props)
result = promise.value!
Fog::Logger.debug "Availability Set #{name} created successfully."
- result
+ Azure::ARM::Compute::Models::AvailabilitySet.serialize_object(result.body)
rescue MsRestAzure::AzureOperationError => e
msg = "Exception creating Availability Set #{name} in Resource Group: #{resource_group}. #{e.body['error']['message']}"
raise msg
end
end
@@ -35,10 +35,21 @@
avail_set
end
end
# This class provides the mock implementation for unit tests.
class Mock
- def create_availability_set(resource_group, name, params)
+ def create_availability_set(resource_group, name, location)
+ {
+ 'location' => location,
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Compute/availabilitySets/#{name}",
+ 'name' => name,
+ 'type' => 'Microsoft.Compute/availabilitySets',
+ 'properties' =>
+ {
+ 'platformUpdateDomainCount' => 2,
+ 'platformFaultDomainCount' => 2
+ }
+ }
end
end
end
end
end