Class: VagrantPlugins::Orchestrate::Action::FilterManaged

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-orchestrate/action/filtermanaged.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ FilterManaged

Returns a new instance of FilterManaged.



5
6
7
# File 'lib/vagrant-orchestrate/action/filtermanaged.rb', line 5

def initialize(app, _env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-orchestrate/action/filtermanaged.rb', line 9

def call(env)
  machine = env[:machine]
  if machine.provider_name == :managed
    if (machine.config.orchestrate.filter_managed_commands) && (ENV["VAGRANT_ORCHESTRATE_COMMAND"] != "PUSH")
      env[:ui].info("Ignoring action #{env[:machine_action]} for managed server #{machine.name}.")
      env[:ui].info("Set `config.orchestrate.filter_managed_commands = false` in your vagrantfile to disable.")
    else
      @app.call(env)
    end
  else
    @app.call(env)
  end
end