lib/fog/azurerm/requests/network/check_subnet_exists.rb in fog-azure-rm-0.4.0 vs lib/fog/azurerm/requests/network/check_subnet_exists.rb in fog-azure-rm-0.4.1
- old
+ new
@@ -9,10 +9,10 @@
begin
@network_client.subnets.get(resource_group, virtual_network_name, subnet_name)
Fog::Logger.debug "Subnet #{subnet_name} exists."
true
rescue MsRestAzure::AzureOperationError => e
- if !e.body['error'].nil? && (e.body['error']['code'] == ERROR_CODE_RESOURCE_NOT_FOUND || e.body['error']['code'] == ERROR_CODE_NOT_FOUND)
+ if resource_not_found?(e)
Fog::Logger.debug "Subnet #{subnet_name} doesn't exist."
false
else
raise_azure_exception(e, msg)
end