veewee 0.3.0.alpha6 → 0.3.0.alpha7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/lib/veewee/command/kvm.rb +1 -1
  2. data/lib/veewee/command/vagrant/basebox.rb +2 -0
  3. data/lib/veewee/command/vagrant/build.rb +1 -1
  4. data/lib/veewee/command/vagrant/define.rb +1 -1
  5. data/lib/veewee/command/vagrant/destroy.rb +1 -1
  6. data/lib/veewee/command/vagrant/export.rb +1 -1
  7. data/lib/veewee/command/vagrant/halt.rb +1 -1
  8. data/lib/veewee/command/vagrant/list.rb +2 -2
  9. data/lib/veewee/command/vagrant/ostypes.rb +2 -2
  10. data/lib/veewee/command/vagrant/ssh.rb +1 -2
  11. data/lib/veewee/command/vagrant/templates.rb +3 -3
  12. data/lib/veewee/command/vagrant/undefine.rb +2 -2
  13. data/lib/veewee/command/vagrant/up.rb +1 -1
  14. data/lib/veewee/command/vagrant/validate.rb +44 -0
  15. data/lib/veewee/command/virtualbox.rb +3 -3
  16. data/lib/veewee/config/definition.rb +4 -4
  17. data/lib/veewee/definition.rb +8 -0
  18. data/lib/veewee/provider/core/box.rb +7 -0
  19. data/lib/veewee/provider/core/box/build.rb +12 -12
  20. data/lib/veewee/provider/core/box/exec.rb +2 -2
  21. data/lib/veewee/provider/core/box/scp.rb +2 -2
  22. data/lib/veewee/provider/core/box/ssh.rb +1 -1
  23. data/lib/veewee/provider/core/box/vnc.rb +3 -3
  24. data/lib/veewee/provider/core/helper/iso.rb +30 -30
  25. data/lib/veewee/provider/core/helper/scancode.rb +1 -1
  26. data/lib/veewee/provider/core/helper/shell.rb +6 -6
  27. data/lib/veewee/provider/core/helper/ssh.rb +15 -17
  28. data/lib/veewee/provider/core/helper/tcp.rb +4 -4
  29. data/lib/veewee/provider/core/helper/web.rb +6 -6
  30. data/lib/veewee/provider/core/provider.rb +20 -13
  31. data/lib/veewee/provider/core/provider/tunnel.rb +8 -8
  32. data/lib/veewee/provider/kvm/box/helper/console_type.rb +1 -1
  33. data/lib/veewee/provider/kvm/box/validate_kvm.rb +2 -2
  34. data/lib/veewee/provider/parallels/box/create.rb +1 -1
  35. data/lib/veewee/provider/parallels/box/destroy.rb +1 -1
  36. data/lib/veewee/provider/parallels/box/helper/buildinfo.rb +1 -1
  37. data/lib/veewee/provider/parallels/box/helper/console_type.rb +5 -5
  38. data/lib/veewee/provider/parallels/box/validate_parallels.rb +2 -2
  39. data/lib/veewee/provider/virtualbox/box/destroy.rb +7 -7
  40. data/lib/veewee/provider/virtualbox/box/export_vagrant.rb +18 -18
  41. data/lib/veewee/provider/virtualbox/box/helper/console_type.rb +8 -8
  42. data/lib/veewee/provider/virtualbox/box/helper/create.rb +8 -8
  43. data/lib/veewee/provider/virtualbox/box/helper/guest_additions.rb +1 -1
  44. data/lib/veewee/provider/virtualbox/box/poweroff.rb +1 -1
  45. data/lib/veewee/provider/virtualbox/box/up.rb +2 -2
  46. data/lib/veewee/provider/virtualbox/box/validate_vagrant.rb +3 -3
  47. data/lib/veewee/providers.rb +1 -1
  48. data/lib/veewee/ui.rb +2 -0
  49. data/lib/veewee/version.rb +1 -1
  50. data/templates/CentOS-5.7-i386-netboot/definition.rb +1 -1
  51. data/templates/CentOS-5.7-i386-netboot/ks.cfg +1 -1
  52. data/templates/Debian-6.0.3-amd64-netboot/definition.rb +1 -1
  53. data/templates/Debian-6.0.3-i386-netboot/definition.rb +1 -1
  54. metadata +3 -2
@@ -74,7 +74,7 @@ module Veewee
74
74
  venv.undefine(definition_name,options)
75
75
  venv.definitions.undefine(definition_name,options)
76
76
  rescue Error => ex
77
- env.ui.error "#{ex}"
77
+ env.ui.error("#{ex}", :prefix=> false)
78
78
  exit -1
79
79
  end
80
80
  end
@@ -10,6 +10,7 @@ require 'veewee/command/vagrant/halt'
10
10
  require 'veewee/command/vagrant/ssh'
11
11
  require 'veewee/command/vagrant/define'
12
12
  require 'veewee/command/vagrant/undefine'
13
+ require 'veewee/command/vagrant/validate'
13
14
  require 'veewee/command/vagrant/export'
14
15
 
15
16
 
@@ -34,6 +35,7 @@ module Veewee
34
35
  @subcommands.register(:define) { Veewee::Command::Vagrant::Define }
35
36
  @subcommands.register(:undefine) { Veewee::Command::Vagrant::Undefine }
36
37
  @subcommands.register(:export) { Veewee::Command::Vagrant::Export }
38
+ @subcommands.register(:validate) { Veewee::Command::Vagrant::Validate }
37
39
 
38
40
  end
39
41
 
@@ -53,7 +53,7 @@ module Veewee
53
53
  venv.ui=@env.ui
54
54
  venv.providers["virtualbox"].get_box(argv[0]).build(options)
55
55
  rescue Veewee::Error => ex
56
- venv.ui.error ex
56
+ venv.ui.error(ex, :prefix => false)
57
57
  exit -1
58
58
  end
59
59
 
@@ -37,7 +37,7 @@ module Veewee
37
37
  venv.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
38
38
  venv.ui.info "vagrant basebox build '#{definition_name}'"
39
39
  rescue Veewee::Error => ex
40
- venv.ui.error ex
40
+ venv.ui.error(ex,:prefix => false)
41
41
  exit -1
42
42
  end
43
43
 
@@ -36,7 +36,7 @@ module Veewee
36
36
  venv.ui=@env.ui
37
37
  venv.providers["virtualbox"].get_box(argv[0]).destroy(options)
38
38
  rescue Veewee::Error => ex
39
- venv.ui.error ex
39
+ venv.ui.error(ex,:prefix => false)
40
40
  exit -1
41
41
  end
42
42
 
@@ -33,7 +33,7 @@ module Veewee
33
33
  box_name=argv[0]
34
34
  venv.providers["virtualbox"].get_box(box_name).export_vagrant(options)
35
35
  rescue Veewee::Error => ex
36
- venv.ui.error ex
36
+ venv.ui.error(ex,:prefix => false)
37
37
  exit -1
38
38
  end
39
39
 
@@ -32,7 +32,7 @@ module Veewee
32
32
  venv.ui=@env.ui
33
33
  venv.providers["virtualbox"].get_box(argv[0]).halt(options)
34
34
  rescue Veewee::Error => ex
35
- venv.ui.error ex
35
+ venv.ui.error(ex,:prefix => false)
36
36
  exit -1
37
37
  end
38
38
 
@@ -25,10 +25,10 @@ module Veewee
25
25
  venv=Veewee::Environment.new(options)
26
26
  venv.ui = @env.ui
27
27
  venv.definitions.each do |name,definition|
28
- venv.ui.info "- #{name}"
28
+ venv.ui.info("- #{name}", :prefix => false)
29
29
  end
30
30
  rescue Veewee::Error => ex
31
- venv.ui.error ex
31
+ venv.ui.error(ex,:prefix => false)
32
32
  exit -1
33
33
  end
34
34
  end
@@ -25,10 +25,10 @@ module Veewee
25
25
  venv=Veewee::Environment.new(options)
26
26
  venv.ui = @env.ui
27
27
  venv.ostypes.each do |name|
28
- venv.ui.info "- #{name}"
28
+ venv.ui.info("- #{name}", :prefix => false)
29
29
  end
30
30
  rescue Veewee::Error => ex
31
- venv.ui.error ex
31
+ venv.ui.error(ex,:prefix => false)
32
32
  exit -1
33
33
  end
34
34
  end
@@ -21,14 +21,13 @@ module Veewee
21
21
  # Parse the options
22
22
  argv = parse_options(opts)
23
23
  return if !argv
24
- raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2
25
24
 
26
25
  begin
27
26
  venv=Veewee::Environment.new(options)
28
27
  venv.ui=@env.ui
29
28
  venv.providers["virtualbox"].get_box(argv[0]).issh(arg[1])
30
29
  rescue Veewee::Error => ex
31
- venv.ui.error ex
30
+ venv.ui.error(ex,:prefix => false)
32
31
  exit -1
33
32
  end
34
33
 
@@ -24,12 +24,12 @@ module Veewee
24
24
  begin
25
25
  venv=Veewee::Environment.new(options)
26
26
  venv.ui = @env.ui
27
- venv.ui.info "The following templates are available:"
27
+ venv.ui.info("The following templates are available:",:prefix => false)
28
28
  venv.templates.each do |name,template|
29
- venv.ui.info "vagrant basebox define '<boxname>' '#{name}'",:prefix => false
29
+ venv.ui.info("vagrant basebox define '<boxname>' '#{name}'",:prefix => false)
30
30
  end
31
31
  rescue Veewee::Error => ex
32
- venv.ui.error ex
32
+ venv.ui.error(ex,:prefix => false)
33
33
  exit -1
34
34
  end
35
35
  end
@@ -28,9 +28,9 @@ module Veewee
28
28
  venv.ui=@env.ui
29
29
  definition_name=argv[0]
30
30
  venv.definitions.undefine(definition_name,options)
31
- venv.ui.info "Definitio '#{definition_name}' succesfully removed"
31
+ venv.ui.info("Definition '#{definition_name}' succesfully removed",:prefix => false)
32
32
  rescue Veewee::Error => ex
33
- venv.ui.error ex
33
+ venv.ui.error(ex,:prefix => false)
34
34
  exit -1
35
35
  end
36
36
 
@@ -31,7 +31,7 @@ module Veewee
31
31
  begin
32
32
  venv=Veewee::Environment.new(options)
33
33
  venv.ui=@env.ui
34
- venv.providers["virtualbox"].get_box(argv[0]).start(options)
34
+ venv.providers["virtualbox"].get_box(argv[0]).up(options)
35
35
  rescue Veewee::Error => ex
36
36
  venv.ui.error ex
37
37
  exit -1
@@ -0,0 +1,44 @@
1
+ require 'optparse'
2
+
3
+ module Veewee
4
+ module Command
5
+ module Vagrant
6
+ class Validate < ::Vagrant::Command::Base
7
+ def execute
8
+ options = {}
9
+
10
+ opts = OptionParser.new do |opts|
11
+ opts.banner = "Validates a box against vagrant compliancy rules"
12
+ opts.separator ""
13
+ opts.separator "Usage: vagrant basebox validate <boxname>"
14
+
15
+ opts.on("-d", "--debug", "enable debugging") do |d|
16
+ options['debug'] = d
17
+ end
18
+
19
+ opts.on("-f", "--force", "force overwrite") do |f|
20
+ options['force'] = f
21
+ end
22
+
23
+ end
24
+
25
+ # Parse the options
26
+ argv = parse_options(opts)
27
+ return if !argv
28
+ raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
29
+
30
+ begin
31
+ venv=Veewee::Environment.new(options)
32
+ venv.ui=@env.ui
33
+ box_name=argv[0]
34
+ venv.providers["virtualbox"].get_box(box_name).validate_vagrant(options)
35
+ rescue Veewee::Error => ex
36
+ venv.ui.error(ex,:prefix => false)
37
+ exit -1
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -75,7 +75,7 @@ module Veewee
75
75
  venv.definitions.undefine(definition_name,options)
76
76
  env.ui.info "Definition #{definition_name} succesfully removed" , :prefix => false
77
77
  rescue Error => ex
78
- env.ui.error "#{ex}",:prefix => false
78
+ env.ui.error("#{ex}",:prefix => false)
79
79
  exit -1
80
80
  end
81
81
  end
@@ -108,7 +108,7 @@ module Veewee
108
108
  venv=Veewee::Environment.new(options)
109
109
  venv.ui=env.ui
110
110
  venv.definitions.each do |name,definition|
111
- env.ui.info "- #{name}"
111
+ env.ui.info "- #{name}",:prefix => false
112
112
  end
113
113
  end
114
114
 
@@ -121,7 +121,7 @@ module Veewee
121
121
 
122
122
  venv.providers["virtualbox"].get_box(box_name).validate_vagrant(options)
123
123
  rescue Veewee::Error => ex
124
- venv.ui.error ex
124
+ venv.ui.error(ex, :prefix => false)
125
125
  exit -1
126
126
  end
127
127
  end
@@ -14,20 +14,20 @@ module Veewee
14
14
  @env=config.env
15
15
  @components=Hash.new
16
16
  end
17
-
17
+
18
18
  # Currently not used, this is in case we will specify the a definition in the Veeweefile
19
19
  # This is for future needs
20
20
  def define(name)
21
21
  # Depending on type, we create a variable of that type
22
22
  definition_stub=OpenStruct.new
23
23
 
24
- begin
24
+ begin
25
25
  # Get a real definition object
26
26
  real_definition=::Veewee::Definition.new(name,env)
27
27
  rescue Error => e
28
- env.ui.error "Error loading provider with #{name},#{$!}"
28
+ env.ui.error("Error loading provider with #{name},#{$!}",:prefix => false)
29
29
  end
30
-
30
+
31
31
  definition_stub.definition=real_definition
32
32
 
33
33
  env.logger.debug("config definition"){ "Start defining definition"}
@@ -39,6 +39,14 @@ module Veewee
39
39
  attr_accessor :vmfusion
40
40
  attr_accessor :kvm
41
41
 
42
+
43
+ def ui
44
+ return @_ui if defined?(@_ui)
45
+ @_ui = @env.ui.dup
46
+ @_ui.resource = @name
47
+ @_ui
48
+ end
49
+
42
50
  def initialize(name,path,env)
43
51
 
44
52
  @name=name
@@ -30,6 +30,13 @@ module Veewee
30
30
 
31
31
  include ::Veewee::Provider::Core::BoxCommand
32
32
 
33
+ def ui
34
+ return @_ui if defined?(@_ui)
35
+ @_ui = @env.ui.dup
36
+ @_ui.resource = @name
37
+ @_ui
38
+ end
39
+
33
40
  def initialize(name,env)
34
41
  @env=env
35
42
  @name=name
@@ -7,9 +7,9 @@ module Veewee
7
7
 
8
8
  # Requires valid definition
9
9
 
10
- env.ui.info "Building Box #{name} with Definition #{definition.name}:"
10
+ ui.info "Building Box #{name} with Definition #{definition.name}:"
11
11
  options.each do |name,value|
12
- env.ui.info "- #{name} : #{value}"
12
+ ui.info "- #{name} : #{value}"
13
13
  end
14
14
 
15
15
  # Checking regexp of postinstall include/excludes
@@ -24,14 +24,14 @@ module Veewee
24
24
  self.destroy
25
25
  self.reload
26
26
  else
27
- env.ui.error "you need to provide --force because the box #{name} already exists"
27
+ ui.error("you need to provide --force because the box #{name} already exists",:prefix => false)
28
28
  raise Veewee::Error,"you need to provide --force because the box #{name} already exists"
29
29
  end
30
30
  end
31
31
 
32
32
  # By now the box should have been gone, just checking again
33
33
  if self.exists?
34
- env.ui.error "The box should have been deleted by now. Something went terribly wrong. Sorry"
34
+ ui.error("The box should have been deleted by now. Something went terribly wrong. Sorry",:prefix => false)
35
35
  raise Veewee::Error, "The box should have been deleted by now. Something went terribly wrong. Sorry"
36
36
  end
37
37
 
@@ -42,14 +42,14 @@ module Veewee
42
42
  self.up(options)
43
43
 
44
44
  # Waiting for it to boot
45
- env.ui.info "Waiting #{definition.boot_wait.to_i} seconds for the machine to boot"
45
+ ui.info "Waiting #{definition.boot_wait.to_i} seconds for the machine to boot"
46
46
  sleep definition.boot_wait.to_i
47
47
 
48
48
  # Calculate an available kickstart port
49
49
  unless definition.kickstart_port.nil?
50
50
  guessed_port=guess_free_port(definition.kickstart_port.to_i,7199).to_s
51
51
  if guessed_port.to_s!=definition.kickstart_port
52
- env.ui.warn "Changing kickstart port from #{definition.kickstart_port} to #{guessed_port}"
52
+ ui.warn "Changing kickstart port from #{definition.kickstart_port} to #{guessed_port}"
53
53
  definition.kickstart_port=guessed_port.to_s
54
54
  end
55
55
  end
@@ -78,9 +78,9 @@ module Veewee
78
78
  self.handle_postinstall(options)
79
79
 
80
80
 
81
- env.ui.success "The box #{name} was built succesfully!"
82
- env.ui.info "You can now login to the box with:"
83
- env.ui.info ssh_command_string
81
+ ui.success "The box #{name} was built succesfully!"
82
+ ui.info "You can now login to the box with:"
83
+ ui.info ssh_command_string
84
84
 
85
85
  return self
86
86
  end
@@ -164,10 +164,10 @@ module Veewee
164
164
  kickstartfiles=definition.kickstart_file
165
165
 
166
166
  if kickstartfiles.nil? || kickstartfiles.length == 0
167
- env.ui.info "Skipping webserver as no kickstartfile was specified"
167
+ ui.info "Skipping webserver as no kickstartfile was specified"
168
168
  end
169
169
 
170
- env.ui.info "Starting a webserver #{definition.kickstart_ip}:#{definition.kickstart_port}\n"
170
+ ui.info "Starting a webserver #{definition.kickstart_ip}:#{definition.kickstart_port}\n"
171
171
 
172
172
  # Check if the kickstart is an array or a single string
173
173
  if kickstartfiles.is_a?(String)
@@ -239,7 +239,7 @@ module Veewee
239
239
  self.scp(infofile.path,info[:filename])
240
240
  infofile.delete
241
241
  rescue RuntimeError => ex
242
- env.ui.error "Error transfering file #{info[:filename]} failed, possible not enough permissions to write? #{ex}"
242
+ ui.error("Error transfering file #{info[:filename]} failed, possible not enough permissions to write? #{ex}",:prefix => false)
243
243
  raise Veewee::Error,"Error transfering file #{info[:filename]} failed, possible not enough permissions to write? #{ex}"
244
244
  end
245
245
  end
@@ -18,12 +18,12 @@ module Veewee
18
18
  result=self.ssh_execute(self.ip_address,command,new_options)
19
19
  return result
20
20
  rescue RuntimeError => ex
21
- env.ui.error "Error executing command #{command} : #{ex}"
21
+ ui.error("Error executing command #{command} : #{ex}",:prefix => false)
22
22
  raise Veewee::SshError, ex
23
23
  end
24
24
  end
25
25
  rescue Net::SSH::AuthenticationFailed => ex
26
- env.ui.error "Authentication failure"
26
+ ui.error("Authentication failure",:prefix => false)
27
27
  raise Veewee::SshError, ex
28
28
  end
29
29
 
@@ -13,12 +13,12 @@ module Veewee
13
13
  env.logger.info "About to transfer #{localfile} to #{remotefile} to the box #{name} - #{self.ip_address} - #{new_options}"
14
14
  self.ssh_transfer_file(self.ip_address,localfile,remotefile,new_options)
15
15
  rescue RuntimeError => ex
16
- env.ui.error "Error transfering file #{localfile} failed, possible not enough permissions to write? #{ex}"
16
+ ui.error("Error transfering file #{localfile} failed, possible not enough permissions to write? #{ex}",:prefix => false)
17
17
  raise Veewee::SshError,ex
18
18
  end
19
19
  end
20
20
  rescue Net::SSH::AuthenticationFailed => ex
21
- env.ui.error "Authentication failure"
21
+ ui.error("Authentication failure",:prefix => false)
22
22
  raise Veewee::SshError,ex
23
23
  end
24
24
 
@@ -20,7 +20,7 @@ module Veewee
20
20
  fg_exec(ssh_command,options)
21
21
 
22
22
  else
23
- env.ui.error "Can't ssh into '#{@name} as we couldn't figure out it's ip-address"
23
+ ui.error("Can't ssh into '#{@name} as we couldn't figure out it's ip-address",:prefix => false)
24
24
  end
25
25
  else
26
26
  ssh_options={:user => definition.ssh_user,:password => definition.ssh_password, :port => definition.ssh_host_port}
@@ -16,7 +16,7 @@ module Veewee
16
16
  sequence.each { |s|
17
17
  counter=counter+1
18
18
 
19
- env.ui.info "Typing:[#{counter}]: "+s
19
+ ui.info "Typing:[#{counter}]: "+s
20
20
 
21
21
  keycodes=string_to_vnccode(s)
22
22
 
@@ -29,8 +29,8 @@ module Veewee
29
29
  end
30
30
  }
31
31
  vnc.close
32
- env.ui.info "Done typing."
33
- env.ui.info ""
32
+ ui.info "Done typing."
33
+ ui.info ""
34
34
 
35
35
  end
36
36
 
@@ -11,15 +11,15 @@ module Veewee
11
11
 
12
12
  def download_iso(url,filename)
13
13
  if !File.exists?(env.config.veewee.iso_dir)
14
- env.ui.info "Creating an iso directory"
14
+ ui.info "Creating an iso directory"
15
15
  FileUtils.mkdir(env.config.veewee.iso_dir)
16
16
  end
17
- env.ui.info "Checking if isofile #{filename} already exists."
17
+ ui.info "Checking if isofile #{filename} already exists."
18
18
  full_path=File.join(env.config.veewee.iso_dir,filename)
19
- env.ui.info "Full path: #{full_path}"
19
+ ui.info "Full path: #{full_path}"
20
20
  if File.exists?(full_path)
21
- env.ui.info ""
22
- env.ui.info "The isofile #{filename} already exists."
21
+ ui.info ""
22
+ ui.info "The isofile #{filename} already exists."
23
23
  else
24
24
  download_progress(url,full_path)
25
25
  end
@@ -39,7 +39,7 @@ module Veewee
39
39
  }) { |src|
40
40
  # We assume large 10K files, so this is tempfile object
41
41
  env.logger.info "#{src.class}"
42
- env.ui.info "Moving #{src.path} to #{localfile}"
42
+ ui.info "Moving #{src.path} to #{localfile}"
43
43
  # Force the close of the src stream to release handle before moving
44
44
  # Not forcing the close may cause an issue on windows (Permission Denied)
45
45
  src.close
@@ -58,7 +58,7 @@ module Veewee
58
58
  counter = 0
59
59
  while (!io.eof)
60
60
  readBuf = io.readpartial(buflen)
61
- env.ui.info('.',{:new_line => false}) if ((counter+=1) % 20000 == 0)
61
+ env.ui.info('.',{:new_line => false,:prefix => false }) if ((counter+=1) % 20000 == 0)
62
62
  checksum.update(readBuf)
63
63
  end
64
64
  end
@@ -71,51 +71,51 @@ module Veewee
71
71
  full_path=File.join(env.config.veewee.iso_dir,filename)
72
72
 
73
73
  if File.exists?(full_path)
74
- env.ui.info ""
75
- env.ui.info "The isofile #{filename} already exists."
74
+ ui.info ""
75
+ ui.info "The isofile #{filename} already exists."
76
76
  else
77
77
 
78
78
  path1=Pathname.new(full_path)
79
79
  path2=Pathname.new(Dir.pwd)
80
80
  rel_path=path1.relative_path_from(path2).to_s
81
81
 
82
- env.ui.info ""
83
- env.ui.info "We did not find an isofile in <currentdir>/iso. \n\nThe definition provided the following download information:"
82
+ ui.info ""
83
+ ui.info "We did not find an isofile in <currentdir>/iso. \n\nThe definition provided the following download information:"
84
84
  unless "#{self.iso_src}"==""
85
- env.ui.info "- Download url: #{self.iso_src}"
85
+ ui.info "- Download url: #{self.iso_src}"
86
86
  end
87
- env.ui.info "- Md5 Checksum: #{self.iso_md5}"
88
- env.ui.info "#{self.iso_download_instructions}"
89
- env.ui.info ""
87
+ ui.info "- Md5 Checksum: #{self.iso_md5}"
88
+ ui.info "#{self.iso_download_instructions}"
89
+ ui.info ""
90
90
 
91
91
  if self.iso_src == ""
92
- env.ui.info "Please follow the instructions above:"
93
- env.ui.info "- to get the ISO"
94
- env.ui.info" - put it in <currentdir>/iso"
95
- env.ui.info "- then re-run the command"
96
- env.ui.info ""
92
+ ui.info "Please follow the instructions above:"
93
+ ui.info "- to get the ISO"
94
+ ui.info" - put it in <currentdir>/iso"
95
+ ui.info "- then re-run the command"
96
+ ui.info ""
97
97
  raise Veewee::Error, "No ISO src is available, can't download it automatically"
98
98
  else
99
99
  answer=nil
100
100
  answer="yes" if options["auto"]==true
101
101
  env.logger.info "Auto download enabled?#{answer} #{!options['auto'].nil?}"
102
102
  if answer.nil?
103
- answer=env.ui.ask("Download? (Yes/No)") {|q| q.default="No"}
103
+ answer=ui.ask("Download? (Yes/No)") {|q| q.default="No"}
104
104
  end
105
105
 
106
106
  if answer.downcase == "yes"
107
107
  begin
108
108
  download_iso(self.iso_src,filename)
109
109
  rescue OpenURI::HTTPError => ex
110
- env.ui.error "There was an error downloading #{self.iso_src}:"
111
- env.ui.error "#{ex}"
110
+ ui.error "There was an error downloading #{self.iso_src}:"
111
+ ui.error "#{ex}"
112
112
  raise Veewee::Error, "There was an error downloading #{self.iso_src}:\n#{ex}"
113
113
  end
114
114
  else
115
- env.ui.info "You have selected manual download: "
116
- env.ui.info "curl -C - -L '#{self.iso_src}' -o '#{rel_path}'"
117
- env.ui.info "md5 '#{rel_path}' "
118
- env.ui.info ""
115
+ ui.info "You have selected manual download: "
116
+ ui.info "curl -C - -L '#{self.iso_src}' -o '#{rel_path}'"
117
+ ui.info "md5 '#{rel_path}' "
118
+ ui.info ""
119
119
  exit
120
120
  end
121
121
 
@@ -123,12 +123,12 @@ module Veewee
123
123
  raise Veewee::Error, "The provided iso #{full_path} is not readable"
124
124
  end
125
125
 
126
- env.ui.info "Verifying md5 checksum : #{self.iso_md5}"
126
+ ui.info "Verifying md5 checksum : #{self.iso_md5}"
127
127
  file_md5=hashsum(full_path)
128
128
 
129
129
  unless file_md5==self.iso_md5
130
- env.ui.error "The MD5 checksums for file #{filename } do not match: "
131
- env.ui.error "- #{file_md5} (current) vs #{self.iso_md5} (specified)"
130
+ ui.error "The MD5 checksums for file #{filename } do not match: "
131
+ ui.error "- #{file_md5} (current) vs #{self.iso_md5} (specified)"
132
132
  raise Veewee::Error, "The MD5 checksums for file #{filename } do not match: \n"+ "- #{file_md5} (current) vs #{self.iso_md5} (specified)"
133
133
  end
134
134