Sha256: 6f562f8d74cd22b97e3c5137878549c1945c754b526786c8ee83ee39a01f70b0

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def destroy_group(attributes = {})
          cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
          group   = cluster.configurationEx.group.find { |g| g.name == attributes[:name] }
          raise Fog::Vsphere::Error::NotFound, "group #{attributes[:name]} not found" unless group
          delete_spec = RbVmomi::VIM.ClusterConfigSpecEx(groupSpec: [
                                                           RbVmomi::VIM.ClusterGroupSpec(
                                                             operation: RbVmomi::VIM.ArrayUpdateOperation('remove'),
                                                             removeKey: group.name
                                                           )
                                                         ])
          cluster.ReconfigureComputeResource_Task(spec: delete_spec, modify: true).wait_for_completion
        end
      end
      class Mock
        def destroy_group(attributes = {})
          group = data[:groups][attributes[:name]]
          raise Fog::Vsphere::Error::NotFound unless group
          data[:groups].delete(attributes[:name])
        end
      end
    end
  end
end

Version data entries

7 entries across 5 versions & 2 rubygems

Version Path
fog-vsphere-2.5.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.4.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.3.0 lib/fog/vsphere/requests/compute/destroy_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/requests/compute/destroy_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/requests/compute/destroy_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.2.0 lib/fog/vsphere/requests/compute/destroy_group.rb