Sha256: ea8781611505210be01761b5dba3a12f5b6d61b28ec25535caf12f42a40f1479

Contents?: true

Size: 907 Bytes

Versions: 6

Compression:

Stored size: 907 Bytes

Contents

module Vagrant
  module Action
    module Builtin
      # This class is intended to be used by the Action::Warden class for executing
      # action triggers before any given action.
      class BeforeTriggerAction
        # @param [Symbol] action_name - The action class name to fire trigger on
        # @param [Vagrant::Plugin::V2::Triger] triggers - trigger object
        def initialize(app, env, action_name, triggers)
          @app         = app
          @env         = env
          @triggers    = triggers
          @action_name = action_name
        end

        def call(env)
          machine = env[:machine]
          machine_name = machine.name if machine

          @triggers.fire_triggers(@action_name, :before, machine_name, :action) if Vagrant::Util::Experimental.feature_enabled?("typed_triggers");

          # Carry on
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-unbundled-2.2.7.0 lib/vagrant/action/builtin/before_trigger.rb
vagrant-unbundled-2.2.6.2 lib/vagrant/action/builtin/before_trigger.rb
vagrant-unbundled-2.2.6.1 lib/vagrant/action/builtin/before_trigger.rb
vagrant-unbundled-2.2.6.0 lib/vagrant/action/builtin/before_trigger.rb
vagrant-unbundled-2.2.5.0 lib/vagrant/action/builtin/before_trigger.rb
vagrant-unbundled-2.2.4.0 lib/vagrant/action/builtin/before_trigger.rb