fission 0.4.0 → 0.5.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +12 -3
- data/README.md +45 -19
- data/bin/fission +1 -1
- data/fission.gemspec +3 -2
- data/lib/fission.rb +15 -0
- data/lib/fission/action/shell_executor.rb +37 -0
- data/lib/fission/action/snapshot/creator.rb +81 -0
- data/lib/fission/action/snapshot/deleter.rb +85 -0
- data/lib/fission/action/snapshot/lister.rb +90 -0
- data/lib/fission/action/snapshot/reverter.rb +81 -0
- data/lib/fission/action/vm/cloner.rb +191 -0
- data/lib/fission/action/vm/deleter.rb +73 -0
- data/lib/fission/action/vm/lister.rb +138 -0
- data/lib/fission/action/vm/starter.rb +88 -0
- data/lib/fission/action/vm/stopper.rb +79 -0
- data/lib/fission/action/vm/suspender.rb +68 -0
- data/lib/fission/cli.rb +21 -117
- data/lib/fission/command.rb +39 -0
- data/lib/fission/command/clone.rb +11 -6
- data/lib/fission/command/delete.rb +11 -6
- data/lib/fission/command/info.rb +62 -0
- data/lib/fission/command/snapshot_create.rb +9 -3
- data/lib/fission/command/snapshot_delete.rb +38 -0
- data/lib/fission/command/snapshot_list.rb +9 -3
- data/lib/fission/command/snapshot_revert.rb +9 -3
- data/lib/fission/command/start.rb +11 -6
- data/lib/fission/command/status.rb +9 -1
- data/lib/fission/command/stop.rb +9 -3
- data/lib/fission/command/suspend.rb +11 -6
- data/lib/fission/command_helpers.rb +18 -4
- data/lib/fission/command_line_parser.rb +189 -0
- data/lib/fission/config.rb +1 -1
- data/lib/fission/fusion.rb +3 -4
- data/lib/fission/lease.rb +2 -1
- data/lib/fission/metadata.rb +6 -1
- data/lib/fission/response.rb +17 -9
- data/lib/fission/version.rb +1 -1
- data/lib/fission/vm.rb +142 -382
- data/lib/fission/vm_configuration.rb +79 -0
- data/spec/fission/action/execute_shell_command_spec.rb +25 -0
- data/spec/fission/action/snapshot/creator_spec.rb +77 -0
- data/spec/fission/action/snapshot/deleter_spec.rb +84 -0
- data/spec/fission/action/snapshot/lister_spec.rb +67 -0
- data/spec/fission/action/snapshot/reverter_spec.rb +76 -0
- data/spec/fission/action/vm/cloner_spec.rb +198 -0
- data/spec/fission/action/vm/deleter_spec.rb +79 -0
- data/spec/fission/action/vm/lister_spec.rb +164 -0
- data/spec/fission/action/vm/starter_spec.rb +88 -0
- data/spec/fission/action/vm/stopper_spec.rb +71 -0
- data/spec/fission/action/vm/suspender_spec.rb +59 -0
- data/spec/fission/cli_spec.rb +32 -157
- data/spec/fission/command/clone_spec.rb +9 -3
- data/spec/fission/command/delete_spec.rb +11 -3
- data/spec/fission/command/info_spec.rb +130 -0
- data/spec/fission/command/snapshot_create_spec.rb +11 -3
- data/spec/fission/command/snapshot_delete_spec.rb +74 -0
- data/spec/fission/command/snapshot_list_spec.rb +11 -3
- data/spec/fission/command/snapshot_revert_spec.rb +11 -3
- data/spec/fission/command/start_spec.rb +11 -3
- data/spec/fission/command/status_spec.rb +16 -5
- data/spec/fission/command/stop_spec.rb +11 -3
- data/spec/fission/command/suspend_spec.rb +11 -3
- data/spec/fission/command_helpers_spec.rb +27 -5
- data/spec/fission/command_line_parser_spec.rb +267 -0
- data/spec/fission/command_spec.rb +16 -1
- data/spec/fission/config_spec.rb +3 -3
- data/spec/fission/fusion_spec.rb +11 -6
- data/spec/fission/lease_spec.rb +81 -45
- data/spec/fission/metadata_spec.rb +29 -6
- data/spec/fission/response_spec.rb +20 -9
- data/spec/fission/ui_spec.rb +1 -1
- data/spec/fission/vm_configuration_spec.rb +132 -0
- data/spec/fission/vm_spec.rb +393 -750
- data/spec/helpers/command_helpers.rb +1 -1
- metadata +93 -15
- data/.rvmrc +0 -1
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fission
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p429
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
-
# changes
|
2
|
-
|
3
1
|
## head
|
4
2
|
|
3
|
+
## 0.5.0.beta.1 (06/22/2013)
|
4
|
+
* add 'info' command
|
5
|
+
* add 'snapshot delete' command
|
6
|
+
* add ability to get all VM config values (related to #14)
|
7
|
+
* fix issue #16 (returning incorrect mac address)
|
8
|
+
* fix issue #18 (1.8.7 compatibility)
|
9
|
+
* fix issue #19 (duplicate config entires when cloning)
|
10
|
+
* internal cleanup of how command strings are handled (props to @patdowney)
|
11
|
+
* bump dependency on CFproperList to avoid libxml-ruby dependency (#24)
|
12
|
+
|
5
13
|
## 0.4.0 (01/17/2012)
|
6
14
|
* major internal refactoring for usage as a lib
|
7
|
-
* add fix for loading a custom vmrun_bin in ~/.fissionrc (issue #8
|
15
|
+
* add fix for loading a custom vmrun_bin in ~/.fissionrc (issue #8)
|
16
|
+
* add guestos and uuid methods to VM (@ody)
|
8
17
|
|
9
18
|
## 0.3.0 (09/16/2011)
|
10
19
|
* add ability to suspend all running VMs ('--all')
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Fission
|
2
2
|
|
3
|
+
[](http://travis-ci.org/thbishop/fission)
|
4
|
+
|
3
5
|
## Intro
|
4
|
-
Fission is a simple command line tool for managing VMware Fusion VMs. Only Fusion 3.x is currently
|
6
|
+
Fission is a simple command line tool for managing VMware Fusion VMs. Only Fusion 3.x is currently
|
7
|
+
supported. See [Fusion Version Support](#fusion-version-support) for more info.
|
5
8
|
|
6
9
|
|
7
10
|
## Install
|
@@ -15,6 +18,28 @@ Fission is a simple command line tool for managing VMware Fusion VMs. Only Fusi
|
|
15
18
|
If you provide '--start', then the new VM will be powered on after cloning
|
16
19
|
|
17
20
|
|
21
|
+
### Delete
|
22
|
+
fission delete my_vm [--force]
|
23
|
+
|
24
|
+
Deletes the VM. This will delete the files from disk and remove the related metadata in Fusion.
|
25
|
+
|
26
|
+
By default, the VM will not be deleted if:
|
27
|
+
|
28
|
+
* The VM is running
|
29
|
+
* The Fusion GUI is running (as the metadata cannot be cleanly removed)
|
30
|
+
|
31
|
+
Providing '--force' will:
|
32
|
+
|
33
|
+
* Stop the VM if it's running
|
34
|
+
* Delete the VM even if the Fusion GUI is running
|
35
|
+
|
36
|
+
|
37
|
+
### Info
|
38
|
+
fission info my_vm
|
39
|
+
|
40
|
+
Outputs information about the VM
|
41
|
+
|
42
|
+
|
18
43
|
### Snapshot Create
|
19
44
|
fission snapshot create my_vm snapshot_name
|
20
45
|
|
@@ -26,6 +51,14 @@ In order to create the snapshot:
|
|
26
51
|
* The snapshot name must be unique
|
27
52
|
|
28
53
|
|
54
|
+
### Snapshot Delete
|
55
|
+
fission snapshot delete my_vm snapshot_name
|
56
|
+
|
57
|
+
Deletes a snapshot for the VM
|
58
|
+
|
59
|
+
If you have the Fusion GUI running, the VM must be running in order to delete the snapshot.
|
60
|
+
|
61
|
+
|
29
62
|
### Snapshot List
|
30
63
|
fission snapshot list my_vm
|
31
64
|
|
@@ -70,22 +103,6 @@ Stops the VM
|
|
70
103
|
Suspends the VM or all running VMs
|
71
104
|
|
72
105
|
|
73
|
-
### Delete
|
74
|
-
fission delete my_vm [--force]
|
75
|
-
|
76
|
-
Deletes the VM. This will delete the files from disk and remove the related metadata in Fusion.
|
77
|
-
|
78
|
-
By default, the VM will not be deleted if:
|
79
|
-
|
80
|
-
* The VM is running
|
81
|
-
* The Fusion GUI is running (as the metadata cannot be cleanly removed)
|
82
|
-
|
83
|
-
Providing '--force' will:
|
84
|
-
|
85
|
-
* Stop the VM if it's running
|
86
|
-
* Delete the VM even if the Fusion GUI is running
|
87
|
-
|
88
|
-
|
89
106
|
### Help
|
90
107
|
fission -h
|
91
108
|
|
@@ -94,17 +111,26 @@ or just
|
|
94
111
|
fission
|
95
112
|
|
96
113
|
|
97
|
-
##
|
114
|
+
## Configuration
|
98
115
|
By default, fission will use the default VMware Fusion VM directory
|
99
116
|
(~/Documents/Virtual Machines.localized/) when cloning. If you want to use a
|
100
117
|
different directory, you can set this in a config file.
|
101
118
|
|
102
|
-
The config file needs to be in
|
119
|
+
The config file needs to be in YAML format and live at '~/.fissionrc'
|
103
120
|
|
104
121
|
$cat ~/.fissionrc
|
105
122
|
---
|
106
123
|
vm_dir: "/vm"
|
107
124
|
|
125
|
+
## Fusion Version Support
|
126
|
+
As of now, only Fusion 3.x is supported (that's what I have available to test).
|
127
|
+
It's my understanding that some folks are currently using fission with Fusion
|
128
|
+
4.x as well. In order to have fission work with Fusion 4.x, you will need to
|
129
|
+
tell fission where the Fusion 4.x vmrun file is. You can do so with the
|
130
|
+
following item placed in your ~/.fissionrc (remember, YAML format):
|
131
|
+
|
132
|
+
vmrun_bin: /Applications/VMware Fusion.app/Contents/Library/vmrun
|
133
|
+
|
108
134
|
|
109
135
|
## Other Notable Info
|
110
136
|
The name of the VM used in the previous examples should be the directory name
|
data/bin/fission
CHANGED
data/fission.gemspec
CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
-
s.add_dependency 'CFPropertyList', '~> 2.
|
22
|
-
s.add_development_dependency '
|
21
|
+
s.add_dependency 'CFPropertyList', '~> 2.1.1'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'rspec', '~> 2.8.0'
|
23
24
|
s.add_development_dependency 'fakefs', '~> 0.3.2'
|
24
25
|
end
|
data/lib/fission.rb
CHANGED
@@ -5,12 +5,26 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
7
7
|
|
8
|
+
require 'fission/action/shell_executor'
|
9
|
+
require 'fission/action/snapshot/creator'
|
10
|
+
require 'fission/action/snapshot/deleter'
|
11
|
+
require 'fission/action/snapshot/lister'
|
12
|
+
require 'fission/action/snapshot/reverter'
|
13
|
+
require 'fission/action/vm/cloner'
|
14
|
+
require 'fission/action/vm/deleter'
|
15
|
+
require 'fission/action/vm/lister'
|
16
|
+
require 'fission/action/vm/starter'
|
17
|
+
require 'fission/action/vm/stopper'
|
18
|
+
require 'fission/action/vm/suspender'
|
8
19
|
require 'fission/cli'
|
9
20
|
require 'fission/command'
|
10
21
|
require 'fission/command_helpers'
|
22
|
+
require 'fission/command_line_parser'
|
11
23
|
require 'fission/command/clone'
|
12
24
|
require 'fission/command/delete'
|
25
|
+
require 'fission/command/info'
|
13
26
|
require 'fission/command/snapshot_create'
|
27
|
+
require 'fission/command/snapshot_delete'
|
14
28
|
require 'fission/command/snapshot_list'
|
15
29
|
require 'fission/command/snapshot_revert'
|
16
30
|
require 'fission/command/start'
|
@@ -27,6 +41,7 @@ require 'fission/metadata'
|
|
27
41
|
require 'fission/response'
|
28
42
|
require 'fission/ui'
|
29
43
|
require 'fission/vm'
|
44
|
+
require 'fission/vm_configuration'
|
30
45
|
require 'fission/version'
|
31
46
|
|
32
47
|
module Fission
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fission
|
2
|
+
module Action
|
3
|
+
|
4
|
+
class ShellExecutor
|
5
|
+
|
6
|
+
# Internal: Create a new ShellExecutor object.
|
7
|
+
#
|
8
|
+
# cmd - Command to execute as a String
|
9
|
+
#
|
10
|
+
# Examples:
|
11
|
+
#
|
12
|
+
# Fission::Action::ShellExecutor.new 'ls /var/log'
|
13
|
+
#
|
14
|
+
# Returns a new Fission::Action::ShellExecutor object.
|
15
|
+
def initialize(cmd)
|
16
|
+
@cmd = cmd
|
17
|
+
end
|
18
|
+
|
19
|
+
# Internal: Executes the command in the shell. The command will be
|
20
|
+
# executed using the ruby '`' method.
|
21
|
+
#
|
22
|
+
# Examples:
|
23
|
+
#
|
24
|
+
# @executor.execute
|
25
|
+
#
|
26
|
+
# Returns a Hash with two keys.
|
27
|
+
# The key 'output' will contain the output from the command.
|
28
|
+
# The key 'process_status' will conatian a standard ruby Process::Status
|
29
|
+
# object.
|
30
|
+
def execute
|
31
|
+
{ 'output' => `#{@cmd}`, 'process_status' => $? }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Fission
|
2
|
+
module Action
|
3
|
+
module Snapshot
|
4
|
+
|
5
|
+
class Creator
|
6
|
+
|
7
|
+
# Internal: Creates a new SnapshotCreator object. This accepts a VM
|
8
|
+
# object.
|
9
|
+
#
|
10
|
+
# vm - An instance of VM
|
11
|
+
#
|
12
|
+
# Examples:
|
13
|
+
#
|
14
|
+
# Fission::Action::SnapshotCreator.new @my_vm
|
15
|
+
#
|
16
|
+
# Returns a new SnapshotCreator object
|
17
|
+
def initialize(vm)
|
18
|
+
@vm = vm
|
19
|
+
end
|
20
|
+
|
21
|
+
# Public: Creates a snapshot for a VM. The VM must be running in order
|
22
|
+
# to create a snapshot. Snapshot names must be unique.
|
23
|
+
#
|
24
|
+
# name - The desired name of the snapshot. The name must be unique.
|
25
|
+
#
|
26
|
+
# Examples
|
27
|
+
#
|
28
|
+
# @creator.create_snapshot('foo_snap_1')
|
29
|
+
#
|
30
|
+
# Returns a Response with the result.
|
31
|
+
# If successful, the Response's data attribute will be nil.
|
32
|
+
# If there is an error, an unsuccessful Response will be returned.
|
33
|
+
def create_snapshot(name)
|
34
|
+
unless @vm.exists?
|
35
|
+
return Response.new :code => 1, :message => 'VM does not exist'
|
36
|
+
end
|
37
|
+
|
38
|
+
running_response = @vm.running?
|
39
|
+
return running_response unless running_response.successful?
|
40
|
+
|
41
|
+
unless running_response.data
|
42
|
+
message = 'The VM must be running in order to take a snapshot.'
|
43
|
+
return Response.new :code => 1, :message => message
|
44
|
+
end
|
45
|
+
|
46
|
+
conf_file_response = @vm.conf_file
|
47
|
+
return conf_file_response unless conf_file_response.successful?
|
48
|
+
|
49
|
+
snapshots_response = @vm.snapshots
|
50
|
+
return snapshots_response unless snapshots_response.successful?
|
51
|
+
|
52
|
+
if snapshots_response.data.include? name
|
53
|
+
message = "There is already a snapshot named '#{name}'."
|
54
|
+
return Response.new :code => 1, :message => message
|
55
|
+
end
|
56
|
+
|
57
|
+
command = "#{vmrun_cmd} snapshot "
|
58
|
+
command << "'#{conf_file_response.data}' \"#{name}\" 2>&1"
|
59
|
+
|
60
|
+
command_exec = Fission::Action::ShellExecutor.new command
|
61
|
+
Response.from_shell_executor command_exec.execute
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
# Internal: Helper for getting the configured vmrun_cmd value.
|
66
|
+
#
|
67
|
+
# Examples
|
68
|
+
#
|
69
|
+
# @creator.vmrun_cmd
|
70
|
+
# # => "/foo/bar/vmrun -T fusion"
|
71
|
+
#
|
72
|
+
# Returns a String for the configured value of Fission.config['vmrun_cmd'].
|
73
|
+
def vmrun_cmd
|
74
|
+
Fission.config['vmrun_cmd']
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Fission
|
2
|
+
module Action
|
3
|
+
module Snapshot
|
4
|
+
|
5
|
+
class Deleter
|
6
|
+
|
7
|
+
# Internal: Creates a new SnapshotDeleter object. This accepts a VM
|
8
|
+
# object.
|
9
|
+
#
|
10
|
+
# vm - An instance of VM
|
11
|
+
#
|
12
|
+
# Examples:
|
13
|
+
#
|
14
|
+
# Fission::Action::SnapshotDeleter.new @my_vm
|
15
|
+
#
|
16
|
+
# Returns a new SnapshotDeleter object
|
17
|
+
def initialize(vm)
|
18
|
+
@vm = vm
|
19
|
+
end
|
20
|
+
|
21
|
+
# Public: Deletes a snapshot for a VM. The snapshot to delete must
|
22
|
+
# exist. If the Fusion GUI is running, then the VM must also be running.
|
23
|
+
#
|
24
|
+
# name - The name of the snapshot to delete.
|
25
|
+
#
|
26
|
+
# Examples
|
27
|
+
#
|
28
|
+
# @deleter.delete_snapshot('foo_snap_1')
|
29
|
+
#
|
30
|
+
# Returns a Response with the result.
|
31
|
+
# If successful, the Response's data attribute will be nil.
|
32
|
+
# If there is an error, an unsuccessful Response will be returned.
|
33
|
+
def delete_snapshot(name)
|
34
|
+
unless @vm.exists?
|
35
|
+
return Response.new :code => 1, :message => 'VM does not exist'
|
36
|
+
end
|
37
|
+
|
38
|
+
if Fusion.running?
|
39
|
+
running_response = @vm.running?
|
40
|
+
return running_response unless running_response.successful?
|
41
|
+
|
42
|
+
unless running_response.data
|
43
|
+
message = 'A snapshot cannot be deleted when the GUI is running '
|
44
|
+
message << 'and the VM is not running.'
|
45
|
+
return Response.new :code => 1, :message => message
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
conf_file_response = @vm.conf_file
|
50
|
+
return conf_file_response unless conf_file_response.successful?
|
51
|
+
|
52
|
+
snapshots_response = @vm.snapshots
|
53
|
+
return snapshots_response unless snapshots_response.successful?
|
54
|
+
|
55
|
+
unless snapshots_response.data.include? name
|
56
|
+
message = "Unable to find a snapshot named '#{name}'."
|
57
|
+
return Response.new :code => 1, :message => message
|
58
|
+
end
|
59
|
+
|
60
|
+
command = "#{vmrun_cmd} deleteSnapshot "
|
61
|
+
command << "'#{conf_file_response.data}' \"#{name}\" 2>&1"
|
62
|
+
|
63
|
+
command_exec = Fission::Action::ShellExecutor.new command
|
64
|
+
Response.from_shell_executor command_exec.execute
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
# Internal: Helper for getting the configured vmrun_cmd value.
|
69
|
+
#
|
70
|
+
# Examples
|
71
|
+
#
|
72
|
+
# @deleter.vmrun_cmd
|
73
|
+
# # => "/foo/bar/vmrun -T fusion"
|
74
|
+
#
|
75
|
+
# Returns a String for the configured value of
|
76
|
+
# Fission.config['vmrun_cmd'].
|
77
|
+
def vmrun_cmd
|
78
|
+
Fission.config['vmrun_cmd']
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Fission
|
2
|
+
module Action
|
3
|
+
module Snapshot
|
4
|
+
|
5
|
+
class Lister
|
6
|
+
|
7
|
+
# Internal: Creates a new SnapshotLister object. This accepts a VM
|
8
|
+
# object.
|
9
|
+
#
|
10
|
+
# vm - An instance of VM
|
11
|
+
#
|
12
|
+
# Examples:
|
13
|
+
#
|
14
|
+
# Fission::Action::SnapshotLister.new @my_vm
|
15
|
+
#
|
16
|
+
# Returns a new SnapshotLister object
|
17
|
+
def initialize(vm)
|
18
|
+
@vm = vm
|
19
|
+
end
|
20
|
+
|
21
|
+
# Internal: List the snapshots for a VM.
|
22
|
+
#
|
23
|
+
# Examples
|
24
|
+
#
|
25
|
+
# @lister.snapshots.data
|
26
|
+
# # => ['snap 1', 'snap 2']
|
27
|
+
#
|
28
|
+
# Returns a Response with the result.
|
29
|
+
# If successful, the Repsonse's data attribute will be an Array of the
|
30
|
+
# snapshot names (String).
|
31
|
+
# If there is an error, an unsuccessful Response will be returned.
|
32
|
+
def snapshots
|
33
|
+
unless @vm.exists?
|
34
|
+
return Response.new :code => 1, :message => 'VM does not exist'
|
35
|
+
end
|
36
|
+
|
37
|
+
conf_file_response = @vm.conf_file
|
38
|
+
return conf_file_response unless conf_file_response.successful?
|
39
|
+
|
40
|
+
command = "#{vmrun_cmd} listSnapshots "
|
41
|
+
command << "'#{conf_file_response.data}' 2>&1"
|
42
|
+
|
43
|
+
command_exec = Fission::Action::ShellExecutor.new command
|
44
|
+
result = command_exec.execute
|
45
|
+
|
46
|
+
response = Response.new :code => result['process_status'].exitstatus
|
47
|
+
|
48
|
+
if response.successful?
|
49
|
+
response.data = parse_snapshot_names_from_output result['output']
|
50
|
+
else
|
51
|
+
response.message = result['output']
|
52
|
+
end
|
53
|
+
|
54
|
+
response
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
# Internal: Helper for getting the configured vmrun_cmd value.
|
59
|
+
#
|
60
|
+
# Examples
|
61
|
+
#
|
62
|
+
# @lister.vmrun_cmd
|
63
|
+
# # => "/foo/bar/vmrun -T fusion"
|
64
|
+
#
|
65
|
+
# Returns a String for the configured value of
|
66
|
+
# Fission.config['vmrun_cmd'].
|
67
|
+
def vmrun_cmd
|
68
|
+
Fission.config['vmrun_cmd']
|
69
|
+
end
|
70
|
+
|
71
|
+
# Internal: Parses the output of the listSnapshot command.
|
72
|
+
#
|
73
|
+
# output - The output of the vmrun listSnapshot command.
|
74
|
+
#
|
75
|
+
# Examples:
|
76
|
+
# @lister.parse_snapshot_names_from_output cmd_output
|
77
|
+
# # => ['snap_1', 'snap_2']
|
78
|
+
#
|
79
|
+
# Returns an Array with the list of snapshot names.
|
80
|
+
def parse_snapshot_names_from_output(cmd_output)
|
81
|
+
header_text = 'Total snapshots:'
|
82
|
+
snaps = cmd_output.split("\n").select { |s| !s.include? header_text }
|
83
|
+
snaps.map { |s| s.strip }
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|