Sha256: 979e223e4290d39cbe14fa9f5277db42203e530a8648c2f141b76480e74dcda3

Contents?: true

Size: 909 Bytes

Versions: 22

Compression:

Stored size: 909 Bytes

Contents

module Fog
  module Compute
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def delete_image(resource_group, vm_name)
          msg = "Deleting Image: #{vm_name}-osImage"
          Fog::Logger.debug msg
          image_name = "#{vm_name}-osImage"
          begin
            @compute_mgmt_client.images.delete(resource_group, image_name)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "Image #{image_name} deleted successfully."
          true
        end
      end

      # This class provides the mock implementation for unit tests.
      class Mock
        def delete_image(*)
          Fog::Logger.debug 'Image fog-test-server-osImage from Resource group fog-test-rg deleted successfully.'
          true
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.1 lib/fog/azurerm/requests/compute/delete_image.rb
fog-azure-rm-0.4.0 lib/fog/azurerm/requests/compute/delete_image.rb