Class: VagrantPlugins::DataBags::Action::CleanDataBags

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant-databags/action/clean_databags.rb

Instance Method Summary collapse

Methods inherited from Base

#chef_provisioner_type, #initialize, #machine_chef_provisioners

Constructor Details

This class inherits a constructor from VagrantPlugins::DataBags::Action::Base

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant-databags/action/clean_databags.rb', line 9

def call(env)
  if env[:machine].config.databags.cleanup_on_provision && env[:machine].config.databags.map.size > 0
    env[:ui].detail "[vagrant-databags] Cleaning up temp data bags folder"
    chef_provisioners = machine_chef_provisioners(env[:machine])
    chef_provisioners.each do |chef|
      provisioner_type = chef_provisioner_type(chef)
      DataBagsContainer.instance.clean(env[:machine], provisioner_type)
    end
  end
  @app.call(env)
end