Class: Engineyard::Local::Virtualbox
- Inherits:
-
Object
- Object
- Engineyard::Local::Virtualbox
- Defined in:
- lib/engineyard-local/virtualbox.rb
Constant Summary collapse
- VALUE_PREFIX =
"Value: "- INFO_REGEX =
TODO this is exceptionally difficult to read
/"(.*)".*\{(.*)\}/
Class Method Summary collapse
Class Method Details
.extra_data(uuid, key = "enumerate") ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/engineyard-local/virtualbox.rb', line 22 def self.extra_data(uuid, key = "enumerate" ) value = vbox.execute("getextradata", uuid, key).strip if value.include?(VALUE_PREFIX) value.gsub!(/#{VALUE_PREFIX}/, '') end end |
.uuid_map ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/engineyard-local/virtualbox.rb', line 8 def self.uuid_map # TODO ~~~ is fragile # extract the uuids from `VBoxMange list vms`, sample output: # "Bar VM" {c21b5de6-5867-4471-ab53-7af23badc5eb} # "Foo VM" {aaba8c3a-3521-46e2-bd2c-fe7e65b77524} info_list = vbox.execute("list", "vms").gsub(INFO_REGEX, '\1~~~\2').split("\n") info_list.inject({}) do |acc, info| name, uuid = info.split("~~~") acc[name] = uuid acc end end |
.vbox ⇒ Object
30 31 32 |
# File 'lib/engineyard-local/virtualbox.rb', line 30 def self.vbox @@vbox ||= Vagrant::Driver::VirtualBox.new end |