Class: VagrantPlugins::QEMU::Action::PackageVagrantfile
- Inherits:
-
Object
- Object
- VagrantPlugins::QEMU::Action::PackageVagrantfile
- Defined in:
- lib/vagrant-qemu/action/package_vagrantfile.rb
Overview
Writes a minimal default Vagrantfile into the box declaring only the architecture, so a consumer on a different host arch doesn't default to the wrong one. Networking, MAC and host-specific machine flags are left out on purpose — they are environment-specific and come from the consuming Vagrantfile. The core Package middleware appends the SSH private-key config to this same file afterwards.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #create_vagrantfile ⇒ Object
-
#initialize(app, env) ⇒ PackageVagrantfile
constructor
A new instance of PackageVagrantfile.
Constructor Details
#initialize(app, env) ⇒ PackageVagrantfile
Returns a new instance of PackageVagrantfile.
13 14 15 |
# File 'lib/vagrant-qemu/action/package_vagrantfile.rb', line 13 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 |
# File 'lib/vagrant-qemu/action/package_vagrantfile.rb', line 17 def call(env) @env = env create_vagrantfile @app.call(env) end |
#create_vagrantfile ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-qemu/action/package_vagrantfile.rb', line 23 def create_vagrantfile arch = @env[:machine].provider_config.arch path = Pathname.new(@env["export.temp_dir"]).join("Vagrantfile") File.write(path, <<~VF) Vagrant.configure("2") do |config| config.vm.provider :qemu do |qe| qe.arch = "#{arch}" end end VF end |