Class: Vagrant::Action::Builtin::Disk

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/action/builtin/disk.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Disk

Returns a new instance of Disk.



5
6
7
8
# File 'lib/vagrant/action/builtin/disk.rb', line 5

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant::action::builtin::disk")
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant/action/builtin/disk.rb', line 10

def call(env)
  machine = env[:machine]
  defined_disks = get_disks(machine, env)

  # Call into providers machine implementation for disk management

  if !defined_disks.empty?
    if machine.provider.capability?(:configure_disks)
     machine.provider.capability(:configure_disks, defined_disks)
    else
      env[:ui].warn(I18n.t("vagrant.actions.disk.provider_unsupported",
                         provider: machine.provider_name))
    end
  end

  # Continue On

  @app.call(env)
end

#get_disks(machine, env) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/vagrant/action/builtin/disk.rb', line 28

def get_disks(machine, env)
  return @_disks if @_disks

  @_disks = []
  @_disks = machine.config.vm.disks

  @_disks
end