vagrant-multiprovider-snap 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/vagrant-multiprovider-snap/plugin.rb +22 -6
- data/lib/vagrant-multiprovider-snap/providers/virtualbox/action.rb +1 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/action.rb +51 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/has_snapshot.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/message_snapshot_not_created.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_rollback.rb +33 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_take.rb +28 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_workstation/driver/base.rb +38 -0
- data/lib/vagrant-multiprovider-snap/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d5a319df594314a1caed509fb42dbf244bf88b1
|
4
|
+
data.tar.gz: 930c0e291f896503bf3c8bb1dadfdb05f5332b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3355d1f4e185d0181c3090594fa92e66d7e8d37b1174da0e223376b4919370f2cacf5c7356bbdf8954528fc0e9e53aedb6bead8ccc7c290b1f35a357fa2fbc0
|
7
|
+
data.tar.gz: 4634830d07fde3105cf4db55387836a95ef3bba9526478feb85ddc3406f897f1e260d36115bde62601fcd772ac11645a437383e1fb56975fad9b166821b135f7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.0.10 (April 6, 2014)
|
2
|
+
|
3
|
+
- Force autoloading of VMWare module before overriding its methods
|
4
|
+
- Ensure our override class has same superclass as the one we're adding methods to
|
5
|
+
- Ensure Virtualbox boxes are ready after snapshot rollback
|
6
|
+
|
1
7
|
## 0.0.9 (March 11, 2014)
|
2
8
|
|
3
9
|
- Made plugin compatable with Vagrant 1.5 bundler approach
|
data/README.md
CHANGED
@@ -11,21 +11,37 @@ module VagrantSnap
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
|
14
|
-
# Make sure the fusion plugin is installed
|
15
|
-
#
|
14
|
+
# Make sure the fusion plugin is installed (explicitly
|
15
|
+
# requiring the classes we're going to extend otherwise
|
16
|
+
# they don't get autloaded in time for us to do so)
|
17
|
+
|
18
|
+
require "vagrant-vmware-fusion/action"
|
19
|
+
require "vagrant-vmware-fusion/driver"
|
20
|
+
|
21
|
+
# ...then include our overrides
|
16
22
|
|
17
|
-
require "vagrant-vmware-fusion"
|
18
23
|
require_relative "providers/vmware_fusion/action"
|
19
24
|
require_relative "providers/vmware_fusion/driver/base"
|
20
25
|
|
21
26
|
rescue LoadError => e
|
22
|
-
|
23
27
|
# If we can't load the fusion plugin, quietly ignore it
|
24
|
-
|
25
|
-
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
26
31
|
|
32
|
+
# Same again but for the workstation plugin
|
33
|
+
|
34
|
+
require "vagrant-vmware-workstation/action"
|
35
|
+
require "vagrant-vmware-workstation/driver"
|
36
|
+
|
37
|
+
require_relative "providers/vmware_workstation/action"
|
38
|
+
require_relative "providers/vmware_workstation/driver/base"
|
39
|
+
|
40
|
+
rescue LoadError => e
|
41
|
+
# If we can't load the workstation plugin, quietly ignore it
|
27
42
|
end
|
28
43
|
|
44
|
+
|
29
45
|
name "snap command"
|
30
46
|
|
31
47
|
description <<-DESC
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "vagrant/action/builder"
|
2
|
+
|
3
|
+
module HashiCorp
|
4
|
+
|
5
|
+
module VagrantVMwareworkstation
|
6
|
+
|
7
|
+
module Action
|
8
|
+
|
9
|
+
autoload :SnapshotTake, File.expand_path("../action/snapshot_take.rb", __FILE__)
|
10
|
+
autoload :SnapshotRollback, File.expand_path("../action/snapshot_rollback.rb", __FILE__)
|
11
|
+
autoload :HasSnapshot, File.expand_path("../action/has_snapshot.rb", __FILE__)
|
12
|
+
autoload :MessageSnapshotNotCreated, File.expand_path("../action/message_snapshot_not_created.rb", __FILE__)
|
13
|
+
|
14
|
+
def self.action_snapshot_take
|
15
|
+
Vagrant::Action::Builder.new.tap do |b|
|
16
|
+
b.use CheckVMware
|
17
|
+
b.use Call, Created do |env, b2|
|
18
|
+
if env[:result]
|
19
|
+
b2.use SnapshotTake
|
20
|
+
else
|
21
|
+
b2.use MessageNotCreated
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.action_snapshot_rollback
|
28
|
+
Vagrant::Action::Builder.new.tap do |b|
|
29
|
+
b.use CheckVMware
|
30
|
+
b.use Call, Created do |env, b2|
|
31
|
+
if env[:result]
|
32
|
+
b2.use Call, HasSnapshot do |env2, b3|
|
33
|
+
if env2[:result]
|
34
|
+
b3.use SnapshotRollback
|
35
|
+
else
|
36
|
+
b3.use MessageSnapshotNotCreated
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
b2.use MessageNotCreated
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwareworkstation
|
4
|
+
|
5
|
+
module Action
|
6
|
+
|
7
|
+
class HasSnapshot
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
|
15
|
+
env[:result] = env[:machine].provider.driver.has_snapshot?
|
16
|
+
|
17
|
+
@app.call(env)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwareworkstation
|
4
|
+
|
5
|
+
module Action
|
6
|
+
|
7
|
+
class MessageSnapshotNotCreated
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
|
15
|
+
env[:ui].info I18n.t("vagrant_snap.actions.vm.snapshot_not_created")
|
16
|
+
|
17
|
+
@app.call(env)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwareworkstation
|
4
|
+
|
5
|
+
module Action
|
6
|
+
|
7
|
+
class SnapshotRollback
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
|
15
|
+
env[:ui].info I18n.t("vagrant_snap.actions.vm.snapshot_rollback.rolling_back")
|
16
|
+
|
17
|
+
# Snapshot rollback involves powering off and on the VM
|
18
|
+
# so we need to find the gui state
|
19
|
+
boot_mode = env[:machine].provider_config.gui ? "gui" : "headless"
|
20
|
+
|
21
|
+
env[:machine].provider.driver.snapshot_rollback(boot_mode)
|
22
|
+
|
23
|
+
@app.call(env)
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwareworkstation
|
4
|
+
|
5
|
+
module Action
|
6
|
+
|
7
|
+
class SnapshotTake
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
|
15
|
+
env[:ui].info I18n.t("vagrant_snap.actions.vm.snapshot_take.taking")
|
16
|
+
env[:machine].provider.driver.snapshot_take
|
17
|
+
|
18
|
+
@app.call(env)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwareworkstation
|
4
|
+
|
5
|
+
module Driver
|
6
|
+
|
7
|
+
class Base
|
8
|
+
|
9
|
+
def snapshot_take
|
10
|
+
vmrun("snapshot", "#{vmx_path}", "vagrant-snap-#{Time.now.to_i}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def snapshot_rollback(bootmode)
|
14
|
+
vmrun("revertToSnapshot", "#{vmx_path}", snapshot_list.last)
|
15
|
+
start
|
16
|
+
end
|
17
|
+
|
18
|
+
def snapshot_list
|
19
|
+
snapshots = []
|
20
|
+
vmrun("listSnapshots", "#{vmx_path}").stdout.split("\n").each do |line|
|
21
|
+
if line =~ /^vagrant-snap-/
|
22
|
+
snapshots << line
|
23
|
+
end
|
24
|
+
end
|
25
|
+
snapshots.sort
|
26
|
+
end
|
27
|
+
|
28
|
+
def has_snapshot?
|
29
|
+
snapshot_list.length > 0
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-multiprovider-snap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Topper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Multi-provider snapshots for Vagrant
|
14
14
|
email:
|
@@ -39,6 +39,12 @@ files:
|
|
39
39
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/snapshot_rollback.rb
|
40
40
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/snapshot_take.rb
|
41
41
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/driver/base.rb
|
42
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/action.rb
|
43
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/has_snapshot.rb
|
44
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/message_snapshot_not_created.rb
|
45
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_rollback.rb
|
46
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_take.rb
|
47
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_workstation/driver/base.rb
|
42
48
|
- lib/vagrant-multiprovider-snap/version.rb
|
43
49
|
- locales/en.yml
|
44
50
|
- vagrant-multiprovider-snap.gemspec
|