vagrant-zz-multiprovider-snap 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/LICENSE +21 -0
- data/README.md +6 -2
- data/lib/vagrant-multiprovider-snap/providers/virtualbox/action/has_snapshot.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/virtualbox/action/message_snapshot_not_created.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/virtualbox/action.rb +12 -4
- data/lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb +5 -2
- data/lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/has_snapshot.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/message_snapshot_not_created.rb +27 -0
- data/lib/vagrant-multiprovider-snap/providers/vmware_fusion/action.rb +11 -4
- data/lib/vagrant-multiprovider-snap/providers/vmware_fusion/driver/base.rb +4 -0
- data/lib/vagrant-multiprovider-snap/version.rb +1 -1
- data/locales/en.yml +2 -0
- metadata +8 -2
data/CHANGELOG.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
## 0.0.2 (June 27, 2013)
|
2
|
+
|
3
|
+
- Adds has_snapshot? method to drivers
|
4
|
+
- Uses proper error messages when attempting to rollback on VMs with no snapshots
|
5
|
+
- Makes sure VirtualBox driver only deals with its own snapshots.
|
6
|
+
|
7
|
+
## 0.0.1 (June 12, 2013)
|
8
|
+
|
9
|
+
Initial release - supports Virtualbox and VMWare Fusion
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010-2013 The Scale Factory Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Vagrant Multi-
|
1
|
+
Vagrant Multi-Provider Snap
|
2
2
|
==========================
|
3
3
|
|
4
4
|
Description
|
@@ -61,7 +61,7 @@ running - although it's a bundler environment, you'll also need a packaged
|
|
61
61
|
Vagrant install in order to get access to the rgloader libraries.
|
62
62
|
|
63
63
|
```
|
64
|
-
git@github.com:scalefactory/vagrant-multiprovider-snap.git
|
64
|
+
git clone git@github.com:scalefactory/vagrant-multiprovider-snap.git
|
65
65
|
cd vagrant-multiprovider-snap
|
66
66
|
cp ~/.vagrant.d/license-vagrant-vmware-fusion.lic .
|
67
67
|
bundle install
|
@@ -76,3 +76,7 @@ Once you've made changes that you're happy with, I'd recommend using
|
|
76
76
|
Vagrant install since some things which work in the bundler environment might
|
77
77
|
not work as expected in the packaged copy due to differences in how the plugins
|
78
78
|
are handled.
|
79
|
+
|
80
|
+
License
|
81
|
+
-------
|
82
|
+
vagrant-multiprovider-snap is licensed under the MIT license.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
|
3
|
+
module ProviderVirtualBox
|
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
|
data/lib/vagrant-multiprovider-snap/providers/virtualbox/action/message_snapshot_not_created.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
|
3
|
+
module ProviderVirtualBox
|
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
|
@@ -6,8 +6,10 @@ module VagrantPlugins
|
|
6
6
|
|
7
7
|
module Action
|
8
8
|
|
9
|
-
autoload :SnapshotTake,
|
10
|
-
autoload :SnapshotRollback,
|
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__)
|
11
13
|
|
12
14
|
def self.action_snapshot_take
|
13
15
|
Vagrant::Action::Builder.new.tap do |b|
|
@@ -28,8 +30,14 @@ module VagrantPlugins
|
|
28
30
|
b.use CheckVirtualbox
|
29
31
|
b.use Call, Created do |env, b2|
|
30
32
|
if env[:result]
|
31
|
-
b2.use
|
32
|
-
|
33
|
+
b2.use Call, HasSnapshot do |env2, b3|
|
34
|
+
if env2[:result]
|
35
|
+
b3.use CheckAccessible
|
36
|
+
b3.use SnapshotRollback
|
37
|
+
else
|
38
|
+
b3.use MessageSnapshotNotCreated
|
39
|
+
end
|
40
|
+
end
|
33
41
|
else
|
34
42
|
b2.use MessageNotCreated
|
35
43
|
end
|
@@ -18,17 +18,20 @@ module VagrantPlugins
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def snapshot_list
|
21
|
-
# XXX blows up if no snapshots on the VM - how to prevent this?
|
22
21
|
info = execute("showvminfo", @uuid, "--machinereadable")
|
23
22
|
snapshots = []
|
24
23
|
info.split("\n").each do |line|
|
25
|
-
if line =~ /^SnapshotName="(
|
24
|
+
if line =~ /^SnapshotName="(vagrant-snap-.+?)"$/
|
26
25
|
snapshots << $1.to_s
|
27
26
|
end
|
28
27
|
end
|
29
28
|
snapshots
|
30
29
|
end
|
31
30
|
|
31
|
+
def has_snapshot?
|
32
|
+
snapshot_list.length > 0
|
33
|
+
end
|
34
|
+
|
32
35
|
end
|
33
36
|
|
34
37
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwarefusion
|
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
|
data/lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/message_snapshot_not_created.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module HashiCorp
|
2
|
+
|
3
|
+
module VagrantVMwarefusion
|
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
|
@@ -6,8 +6,10 @@ module HashiCorp
|
|
6
6
|
|
7
7
|
module Action
|
8
8
|
|
9
|
-
autoload :SnapshotTake,
|
10
|
-
autoload :SnapshotRollback,
|
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__)
|
11
13
|
|
12
14
|
def self.action_snapshot_take
|
13
15
|
Vagrant::Action::Builder.new.tap do |b|
|
@@ -27,14 +29,19 @@ module HashiCorp
|
|
27
29
|
b.use CheckVMware
|
28
30
|
b.use Call, Created do |env, b2|
|
29
31
|
if env[:result]
|
30
|
-
b2.use
|
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
|
31
39
|
else
|
32
40
|
b2.use MessageNotCreated
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
37
|
-
|
38
45
|
end
|
39
46
|
|
40
47
|
end
|
data/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-zz-multiprovider-snap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Multi-provider snapshots for Vagrant
|
15
15
|
email:
|
@@ -18,6 +18,8 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- CHANGELOG.md
|
22
|
+
- LICENSE
|
21
23
|
- README.md
|
22
24
|
- lib/vagrant-multiprovider-snap.rb
|
23
25
|
- lib/vagrant-multiprovider-snap/command/list.rb
|
@@ -26,10 +28,14 @@ files:
|
|
26
28
|
- lib/vagrant-multiprovider-snap/command/take.rb
|
27
29
|
- lib/vagrant-multiprovider-snap/plugin.rb
|
28
30
|
- lib/vagrant-multiprovider-snap/providers/virtualbox/action.rb
|
31
|
+
- lib/vagrant-multiprovider-snap/providers/virtualbox/action/has_snapshot.rb
|
32
|
+
- lib/vagrant-multiprovider-snap/providers/virtualbox/action/message_snapshot_not_created.rb
|
29
33
|
- lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_rollback.rb
|
30
34
|
- lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_take.rb
|
31
35
|
- lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
|
32
36
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action.rb
|
37
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/has_snapshot.rb
|
38
|
+
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/message_snapshot_not_created.rb
|
33
39
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/snapshot_rollback.rb
|
34
40
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/action/snapshot_take.rb
|
35
41
|
- lib/vagrant-multiprovider-snap/providers/vmware_fusion/driver/base.rb
|