This repository was archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into hyperv_support
- Loading branch information
Showing
28 changed files
with
456 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require 'optparse' | ||
require 'vagrant' | ||
|
||
module VagrantSnap | ||
|
||
module Command | ||
|
||
class Delete < Vagrant.plugin("2", :command) | ||
|
||
def execute | ||
|
||
options = {} | ||
options[:snap_name] = nil | ||
|
||
opts = OptionParser.new do |o| | ||
|
||
o.banner = "Usage: vagrant snap delete [vm-name] --name=<snapname>" | ||
o.separator "" | ||
|
||
o.on("--name SNAPNAME", "Snapshot to delete - mandatory option") do |n| | ||
options[:snap_name] = n | ||
end | ||
|
||
end | ||
|
||
begin | ||
|
||
argv = parse_options(opts) | ||
return if !argv | ||
raise OptionParser::MissingArgument if options[:snap_name].nil? | ||
|
||
rescue OptionParser::InvalidOption, OptionParser::MissingArgument | ||
puts $!.to_s | ||
puts opts | ||
return false | ||
end | ||
|
||
with_target_vms(argv) do |vm| | ||
|
||
vm.action(:snapshot_delete, :snap_name => options[:snap_name]) | ||
|
||
end | ||
|
||
0 | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
lib/vagrant-multiprovider-snap/providers/virtualbox/action/message_snapshot_not_deleted.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module VagrantPlugins | ||
|
||
module ProviderVirtualBox | ||
|
||
module Action | ||
|
||
class MessageSnapshotNotDeleted | ||
|
||
def initialize(app, env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
|
||
env[:ui].info(I18n.t("vagrant_snap.actions.vm.snapshot_not_deleted.not_deleted", | ||
:snapshot => env[:snap_name]), | ||
) | ||
|
||
@app.call(env) | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
31 changes: 31 additions & 0 deletions
31
lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_delete.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module VagrantPlugins | ||
|
||
module ProviderVirtualBox | ||
|
||
module Action | ||
|
||
class SnapshotDelete | ||
|
||
def initialize(app, env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
|
||
env[:ui].info(I18n.t("vagrant_snap.actions.vm.snapshot_delete.deleting", | ||
:snapshot => env[:snap_name]), | ||
) | ||
|
||
env[:result] = env[:machine].provider.driver.snapshot_delete(env[:snap_name]) | ||
|
||
@app.call(env) | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...vagrant-multiprovider-snap/providers/vmware_fusion/action/message_snapshot_not_deleted.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module HashiCorp | ||
|
||
module VagrantVMwarefusion | ||
|
||
module Action | ||
|
||
class MessageSnapshotNotDeleted | ||
|
||
def initialize(app, env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
|
||
env[:ui].info(I18n.t("vagrant_snap.actions.vm.snapshot_not_deleted.not_deleted", | ||
:snapshot => env[:snap_name]), | ||
) | ||
|
||
@app.call(env) | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
Oops, something went wrong.