class HashiCorp::VagrantVMwareDesktop::Action::PackageVagrantfile
Public Class Methods
new(app, env)
click to toggle source
# File lib/vagrant-vmware-desktop/action/package_vagrantfile.rb, line 10 def initialize(app, env) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/vagrant-vmware-desktop/action/package_vagrantfile.rb, line 14 def call(env) @env = env create_metadata @app.call(env) end
create_metadata()
click to toggle source
Creates a metadata.json file which includes provider information
# File lib/vagrant-vmware-desktop/action/package_vagrantfile.rb, line 38 def create_metadata File.open(File.join(@env["export.temp_dir"], "metadata.json"), "w") do |f| f.write({provider: "vmware_desktop"}.to_json) end end
create_vagrantfile()
click to toggle source
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.
@note This is deprecated as the base mac is no longer required to be set.
The method (and template) are preserved to easily allow enabling this functionality in the future for a different purpose if requried.
# File lib/vagrant-vmware-desktop/action/package_vagrantfile.rb, line 27 def create_vagrantfile mac_addresses = @env[:machine].provider.driver.read_mac_addresses base_mac = mac_addresses[mac_addresses.keys.min] File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f| f.write(TemplateRenderer.render("package_Vagrantfile", { base_mac: base_mac })) end end