Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

allow definition name to contain plus #441

Merged
merged 3 commits into from

2 participants

@mpapis
Collaborator

here is the log with only the first part of the fix:

$ VEEWEE_LOG=STDOUT veewee vbox build openSUSE-12.2-DVD+NET-x86_64
2012-12-09 20:34:00 +0100 -  - [veewee] Command: "VBoxManage list runningvms"
2012-12-09 20:34:00 +0100 -  - [veewee] Output:
2012-12-09 20:34:00 +0100 -  - [veewee] -------
2012-12-09 20:34:00 +0100 -  - [veewee] "openSUSE-12.2-DVD+NET-x86_64" {1dc38e51-1959-4a52-9e63-f40979db6e7e}
2012-12-09 20:34:00 +0100 -  - [veewee] Vm running? false
2012-12-09 20:34:00 +0100 - ui - [veewee] Box is not running
Box is not running
@jedi4ever
Owner

@mpapis thanks. Wondering what the correct way is here. It currently does a regexp, maybe it makes more sense to use the Regexp.escape function instead of the gsub?

What do you think? Be great if you can submit a new patch for this approach.

@mpapis
Collaborator

it looks a lot better now! thanks for the suggestion.

@jedi4ever jedi4ever merged commit dcb4e7a into from
@jedi4ever
Owner

thx @mpapis

@petecheslock petecheslock referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/veewee/provider/virtualbox/box/helper/status.rb
View
22 lib/veewee/provider/virtualbox/box/helper/status.rb
@@ -4,23 +4,25 @@ module Virtualbox
module BoxCommand
def exists?
- command="#{@vboxcmd} list vms"
- shell_results=shell_exec("#{command}",{:mute => true})
- exists=shell_results.stdout.split(/\n/).grep(/\"#{name}\"/).size!=0
-
- env.logger.info("Vm exists? #{exists}")
- return exists
+ return check?(:exists)
end
def running?
- command="#{@vboxcmd} list runningvms"
+ return check?(:running)
+ end
+
+ private
+
+ def check? type
+ command = COMMANDS[type] % @vboxcmd
shell_results=shell_exec("#{command}",{:mute => true})
- running=shell_results.stdout.split(/\n/).grep(/\"#{name}\"/).size!=0
+ status=shell_results.stdout.split(/\n/).grep(/\"#{Regexp.escape(name)}\"/).size!=0
- env.logger.info("Vm running? #{running}")
- return running
+ env.logger.info("Vm #{type}? #{status}")
+ return status
end
+ COMMANDS = { :running => "%s list runningvms", :exists => "%s list vms" }
end
end
end
Something went wrong with that request. Please try again.