Class: VCenterDriver::VcImporter::Raction

Inherits:
Object
  • Object
show all
Defined in:
lib/vcenter_importer.rb

Overview

Object used for stack action and perform rollback

Constructor: apply: The stored @object call ther @method with @args

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, method, args = []) ⇒ Raction

Returns a new instance of Raction.



422
423
424
425
426
# File 'lib/vcenter_importer.rb', line 422

def initialize(object, method, args = [])
    @object = object
    @action = method
    @args = args
end

Class Method Details

.delete_ars(ar_ids, opts) ⇒ Object



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/vcenter_importer.rb', line 432

def self.delete_ars(ar_ids, opts)
    error = opts[:error]

    raise error if ar_ids.nil?

    # key = opts[:key]
    vc_uuid = opts[:uuid]
    npool = opts[:npool]

    ar_ids.each do |key, value|
        network = VCenterDriver::VIHelper
                  .find_by_ref(OpenNebula::VirtualNetworkPool,
                               'TEMPLATE/VCENTER_NET_REF',
                               key,
                               vc_uuid, npool)
        value.each {|ar| network.rm_ar(ar) }
    end

    raise error
end

Instance Method Details

#applyObject



428
429
430
# File 'lib/vcenter_importer.rb', line 428

def apply
    @object.method(@action).call(*@args)
end