Class: VagrantPlugins::Utm::Action::SnapshotSave

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_utm/action/snapshot_save.rb

Overview

This action saves a snapshot of the VM.

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ SnapshotSave

Returns a new instance of SnapshotSave.



11
12
13
# File 'lib/vagrant_utm/action/snapshot_save.rb', line 11

def initialize(app, _env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant_utm/action/snapshot_save.rb', line 15

def call(env)
  env[:ui].info(I18n.t(
                  "vagrant.actions.vm.snapshot.saving",
                  name: env[:snapshot_name]
                ))
  env[:machine].provider.driver.create_snapshot(
    env[:machine].id, env[:snapshot_name]
  )

  env[:ui].success(I18n.t(
                     "vagrant.actions.vm.snapshot.saved",
                     name: env[:snapshot_name]
                   ))

  @app.call(env)
end