Class: VagrantPlugins::Parallels::Action::SnapshotRestore

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-parallels/action/snapshot_restore.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SnapshotRestore

Returns a new instance of SnapshotRestore.



5
6
7
# File 'lib/vagrant-parallels/action/snapshot_restore.rb', line 5

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

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant-parallels/action/snapshot_restore.rb', line 9

def call(env)
  snapshots = env[:machine].provider.driver.list_snapshots(env[:machine].id)
  snapshot_id = snapshots[env[:snapshot_name]]

  env[:ui].info I18n.t('vagrant.actions.vm.snapshot.restoring',
                       name: env[:snapshot_name])
  env[:machine].provider.driver.restore_snapshot(
    env[:machine].id, snapshot_id)

  @app.call(env)
end