lib/fog/azurerm/requests/network/check_subnet_exists.rb in fog-azure-rm-0.2.7 vs lib/fog/azurerm/requests/network/check_subnet_exists.rb in fog-azure-rm-0.3.0
- 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']['code'] == 'ResourceNotFound'
+ if !e.body['error'].nil? && (e.body['error']['code'] == ERROR_CODE_RESOURCE_NOT_FOUND || e.body['error']['code'] == ERROR_CODE_NOT_FOUND)
Fog::Logger.debug "Subnet #{subnet_name} doesn't exist."
false
else
raise_azure_exception(e, msg)
end