Sha256: 93b999c937dddbaaf2a6745a2ca47e3a28d59ddff579af9ac562087980802ee2

Contents?: true

Size: 877 Bytes

Versions: 42

Compression:

Stored size: 877 Bytes

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def folder_destroy(path, datacenter_name)
          folder = get_raw_vmfolder(path, datacenter_name)
          raise Fog::Vsphere::Errors::NotFound, "No such folder #{path}" unless folder
          raise Fog::Vsphere::Errors::ServiceError, "Folder #{path} is not empty" if folder.childEntity.size > 0
          
          task = folder.Destroy_Task
          task.wait_for_completion
          { 'task_state' => task.info.state }
        end
      end
      class Mock
        def folder_destroy(path, datacenter_name)
          vms = list_virtual_machines(folder: path, datacenter: datacenter_name)
          if vms.length > 0
            raise Fog::Vsphere::Errors::ServiceError, "Folder #{path} is not empty"
          end
          { 'task_state' => 'success' }
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fog-vsphere-1.5.2 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.5.1 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.5.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.4.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.3.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.2.2 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.2.1 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.2.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.1.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.0.1 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-1.0.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.8.1 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.8.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.7.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.6.4 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.6.3 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.6.2 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.6.1 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.6.0 lib/fog/vsphere/requests/compute/folder_destroy.rb
fog-vsphere-0.5.0 lib/fog/vsphere/requests/compute/folder_destroy.rb