Browse files

rake iso can now also work with ftp redirects to check size

  • Loading branch information...
1 parent 65ec4c0 commit 9a53637980f9254f9f67bbccf485c4d3b32898f9 @jedi4ever jedi4ever committed Sep 4, 2012
View
39 Rakefile
@@ -42,20 +42,39 @@ task :iso, [:template_name] do |t,args|
response = nil
while found==false
uri=URI.parse(url)
- Net::HTTP.start(uri.host,uri.port) {|http|
- response = http.head(uri.path)
- }
- unless response['location'].nil?
- #puts "Redirecting to "+response['location']
- url=response['location']
- else
- found=true
+ if uri.is_a?(URI::HTTP)
+ Net::HTTP.start(uri.host,uri.port) {|http|
+ response = http.head(uri.path)
+ }
+ unless response['location'].nil?
+ #puts "Redirecting to "+response['location']
+ url=response['location']
+ else
+ length=response['content-length']
+ found=true
+ end
+ elsif uri.is_a?(URI::FTP)
+ require 'net/ftp'
+ ftp = Net::FTP.new(uri.host)
+ ftp.login
+ begin
+ length = ftp.size(uri.path)
+ found = true
+ rescue Net::FTPReplyError => e
+ reply = e.message
+ err_code = reply[0,3].to_i
+ unless err_code == 500 || err_code == 502
+ # other problem, raise
+ raise "Got ftp site but doesn't support size subcommand"
+ end
+ # fallback solution
+ end
+
end
end
- length=response['content-length']
if length.to_i < 10000
puts definition.iso_src
- p response['content-type']
+ puts "Incorrect length #{length.to_i}"
puts uri.host,uri.port, uri.path,response.code
end
rescue Exception => ex
View
2 lib/veewee/provider/vmfusion/box/template.vmx.erb
@@ -1,6 +1,6 @@
.encoding = "UTF-8"
config.version = "8"
-virtualHW.version = "7"
+virtualHW.version = "9"
numvcpus = "<%= cpu_count %>"
scsi0.present = "TRUE"
scsi0.virtualDev = "<%= controller_type %>"
View
3 templates/scientificlinux-6.1-i386-netboot/definition.rb
@@ -4,8 +4,7 @@
:disk_size => '10140',
:disk_format => 'VDI',
:hostiocache => 'off',
- :ioapic => 'on',
- :pae => 'on',
+ :virtualbox => { :vm_options => [ 'pae' => 'on', 'ioapic' => 'on'] },
:os_type_id => 'RedHat_64',
:iso_file => "SL-61-i386-2011-07-27-boot.iso",
:iso_src => "http://mirrors.200p-sf.sonic.net/scientific/6.1/i386/iso/SL-61-i386-2011-07-27-boot.iso",

0 comments on commit 9a53637

Please sign in to comment.