virtualman 1.1.5 → 1.1.6
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/bin/virtualman +1 -1
- data/lib/virtualman/conf.rb +21 -5
- data/lib/virtualman/interractive.rb +23 -1
- metadata +2 -2
data/bin/virtualman
CHANGED
data/lib/virtualman/conf.rb
CHANGED
@@ -24,14 +24,30 @@ def load_conf
|
|
24
24
|
return config_options
|
25
25
|
end
|
26
26
|
|
27
|
-
def record_conf(vm_cloned)
|
27
|
+
def record_conf(vm_cloned, *param)
|
28
28
|
conf = load_conf()
|
29
|
-
|
30
|
-
|
29
|
+
|
30
|
+
if param[0] == "delete"
|
31
|
+
verb = "deleted"
|
32
|
+
p conf["cloned_vms"]
|
33
|
+
p conf["cloned_vms"].class
|
34
|
+
p conf["cloned_vms"].reject{|vm| vm == {"name" => vm_cloned.name} }
|
35
|
+
|
36
|
+
conf["cloned_vms"].reject!{|vm| vm == {"name" => vm_cloned.name} }
|
37
|
+
|
38
|
+
p conf["cloned_vms"]
|
39
|
+
|
31
40
|
else
|
32
|
-
|
41
|
+
verb = "saved"
|
42
|
+
|
43
|
+
if conf["cloned_vms"]
|
44
|
+
conf["cloned_vms"] << {"name" => vm_cloned.name}
|
45
|
+
else
|
46
|
+
conf.merge!({"cloned_vms" => {"name" => vm_cloned.name}})
|
47
|
+
end
|
33
48
|
end
|
34
49
|
|
35
50
|
File.open(CONFIG_FILE, "w") {|f| f.write(conf.to_yaml) }
|
36
|
-
puts "VM #{vm_cloned.name}
|
51
|
+
puts "VM #{vm_cloned.name} #{verb} in your configuration file"
|
52
|
+
|
37
53
|
end
|
@@ -121,4 +121,26 @@ def ssh_cloned
|
|
121
121
|
cmd = "ssh #{user}@#{selected_vm.ip}"
|
122
122
|
exec (cmd)
|
123
123
|
end
|
124
|
-
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def delete_clone
|
127
|
+
puts "----Delete a cloned VM----"
|
128
|
+
puts "Which VM delete?"
|
129
|
+
|
130
|
+
vm_choice = choose "cloned_vms", "name"
|
131
|
+
|
132
|
+
selected_vm = Vm.new(vm_choice["name"])
|
133
|
+
|
134
|
+
puts "!!YOU ARE ABOUT TO DELETE PEMANENTLY DELETE #{vm_choice["name"]}!!"
|
135
|
+
puts "Are you sure? (yes/[no])"
|
136
|
+
|
137
|
+
choice = Menu.ask
|
138
|
+
|
139
|
+
if choice == "yes"
|
140
|
+
selected_vm.stop!
|
141
|
+
|
142
|
+
selected_vm.manage("unregistervm","--delete")
|
143
|
+
|
144
|
+
record_conf(selected_vm, "delete")
|
145
|
+
end
|
146
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtualman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
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: 2012-
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: It is for writing scripts for UNIX-like systems to handle your VirtualBox
|
15
15
|
appliance.
|