Sha256: 44db034afbfc3142d130df8f95f5fe185c0ea66b8eb953dec8db67bb3f339515

Contents?: true

Size: 1001 Bytes

Versions: 17

Compression:

Stored size: 1001 Bytes

Contents

module Fog
  module Compute
    class AzureRM
      # Real class for Compute Request
      class Real
        def check_managed_disk_exists(resource_group_name, disk_name)
          msg = "Checking if Managed Disk: #{disk_name} exists"
          Fog::Logger.debug msg
          begin
            @compute_mgmt_client.disks.get(resource_group_name, disk_name)
            Fog::Logger.debug "Managed Disk #{disk_name} exist."
            true
          rescue MsRestAzure::AzureOperationError => e
            if e.error_code == 'ResourceNotFound'
              Fog::Logger.debug "Managed Disk #{disk_name} doesn't exist."
              false
            else
              raise_azure_exception(e, msg)
            end
          end
        end
      end

      # Mock class for Compute Request
      class Mock
        def check_managed_disk_exists(*)
          Fog::Logger.debug 'Managed Disk test-disk from Resource group fog-rg is available.'
          true
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.0 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.9 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.8 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.7 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.6 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.5 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.4 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-temp-0.0.4 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-temp-0.0.3 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb