Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OS types are now verified and added rake list_ostypes to give a list

  • Loading branch information...
commit 136de454794c19dacbef467890a4854749e10f47 1 parent 5552984
@jedi4ever authored
Showing with 33 additions and 1 deletion.
  1. +5 −0 Rakefile
  2. +28 −1 lib/veewee/session.rb
View
5 Rakefile
@@ -101,6 +101,11 @@ task :remove_box, [:boxname] do |t,args|
Veewee::Session.remove_box(args.boxname)
end
+desc 'List ostypes available'
+task :list_ostypes do |t,args|
+ Veewee::Session.list_ostypes
+end
+
desc 'Clean all unfinished builds'
task :clean do
Veewee::Session.clean
View
29 lib/veewee/session.rb
@@ -120,8 +120,9 @@ def self.verify_iso(filename)
puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
puts "md5 '#{rel_path}' "
puts
+ exit
end
- exit
+
end
def self.export_box(boxname)
@@ -243,8 +244,21 @@ def self.create_vm(boxname)
vm.destroy
end
+ #Verifying the os.id with the :os_type_id specified
+ matchfound=false
+ VirtualBox::Global.global.lib.virtualbox.guest_os_types.collect { |os|
+ if @definition[:os_type_id] == os.id
+ matchfound=true
+ end
+ }
+ unless matchfound
+ puts "The ostype: #{@definition[:os_type_id]} is not available in your Virtualbox version"
+ exit
+ end
+
#TODO One day ruby-virtualbox will be able to handle this creation
#Box does not exist, we can start to create it
+
command="#{@vboxcmd} createvm --name '#{boxname}' --ostype '#{@definition[:os_type_id]}' --register"
#Exec and system stop the execution here
Veewee::Shell.execute("#{command}")
@@ -360,6 +374,19 @@ def self.transaction(boxname,name,checksum_params, &block)
end
end
+ #VirtualBox::Global.global.lib.virtualbox.version
+
+ def self.list_ostypes
+ puts
+ puts "Available os types:"
+ VirtualBox::Global.global.lib.virtualbox.guest_os_types.collect { |os|
+ puts "#{os.id}: #{os.description}"
+ }
+
+ puts
+
+ end
+
def transaction2(boxname,name,checksum_params, &block)
if @provider.snapshot_exists(@vmname,name+"-"+options[:checksum])
Please sign in to comment.
Something went wrong with that request. Please try again.