Class: VagrantPlugins::ProviderKvm::Action::PackageVagrantfile
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderKvm::Action::PackageVagrantfile
- Includes:
- Util
- Defined in:
- lib/vagrant-kvm/action/package_vagrantfile.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#create_vagrantfile ⇒ Object
This method creates the auto-generated Vagrantfile at the root of the box.
-
#initialize(app, env) ⇒ PackageVagrantfile
constructor
A new instance of PackageVagrantfile.
Constructor Details
#initialize(app, env) ⇒ PackageVagrantfile
Returns a new instance of PackageVagrantfile.
8 9 10 |
# File 'lib/vagrant-kvm/action/package_vagrantfile.rb', line 8 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 |
# File 'lib/vagrant-kvm/action/package_vagrantfile.rb', line 12 def call(env) @env = env create_vagrantfile @app.call(env) end |
#create_vagrantfile ⇒ Object
This method creates the auto-generated Vagrantfile at the root of the box. This Vagrantfile contains the MAC address so that the user doesn’t have to worry about it.
21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-kvm/action/package_vagrantfile.rb', line 21 def create_vagrantfile tmp_dir = @env["export.temp_dir"] tmp_dir = "/tmp" if !tmp_dir File.open(File.join(tmp_dir, "Vagrantfile"), "w") do |f| f.write(KvmTemplateRenderer.render("package_Vagrantfile", { :base_mac => @env[:machine].provider.driver.read_mac_address })) end end |