class VCenterDriver::VcImporter::Raction

Object used for stack action and perform rollback

Constructor: @param object [Ruby Object] Any object related to the action. @param method [Symbol] Symbol representing the method

(must belong to object)

@param args [Array] Array with list of arguments,

will be passed to method

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

Public Class Methods

delete_ars(ar_ids, opts) click to toggle source
# 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
new(object, method, args = []) click to toggle source
# File lib/vcenter_importer.rb, line 422
def initialize(object, method, args = [])
    @object = object
    @action = method
    @args = args
end

Public Instance Methods

apply() click to toggle source
# File lib/vcenter_importer.rb, line 428
def apply
    @object.method(@action).call(*@args)
end