Skip to content

Commit

Permalink
Fixed upcase issue on 1.8.7 and removed some test
Browse files Browse the repository at this point in the history
  • Loading branch information
jedi4ever committed Sep 27, 2011
1 parent d2a4503 commit 844e0f9
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 368 deletions.
12 changes: 6 additions & 6 deletions lib/veewee/builder/core/builder/build.rb
Expand Up @@ -44,10 +44,10 @@ def build(definition_name,box_name,options)
# By now the machine if it existed, should have been shutdown
# The last thing to check is if the power we are supposed to ssh to, is still open

if Veewee::Util::Tcp.is_port_open?("localhost", definition.ssh_host_port)
puts "Hmm, the port #{definition.ssh_host_port} is open. And we shut down?"
exit -1
end
# if Veewee::Util::Tcp.is_port_open?(box.ip_address, ssh_options(definition)[:port])
# puts "Hmm, the #{box.ip_address}:#{ssh_options(definition)[:port]} is open. And we shut down?"
# exit -1
# end

box.create(definition)

Expand All @@ -66,7 +66,7 @@ def build(definition_name,box_name,options)
# Let fill's in the variable we need
boot_sequence=fill_sequence(definition.boot_cmd_sequence,{
:ip =>Veewee::Util::Tcp.local_ip,
:port => definition.kickstart_port,
:port => definition.kickstart_port.to_s,
:name => box.name
})

Expand Down Expand Up @@ -116,7 +116,7 @@ def fill_sequence(sequence,options)
filled=sequence.dup
options.each do |key,value|
filled.each do |s|
s.gsub!("%#{key.upcase}%",value)
s.gsub!("%#{key.to_s.upcase}%",value)
end
end
return filled
Expand Down
13 changes: 12 additions & 1 deletion lib/veewee/builder/vmfusion/builder.rb
@@ -1,10 +1,15 @@
require 'veewee/builder/core/builder'
require 'veewee/builder/vmfusion/helper/validate_vmfusion'


module Veewee
module Builder
module Vmfusion
class Builder < Veewee::Builder::Core::Builder

include ::Veewee::Builder::Vmfusion::BuilderHelper


def check_requirements
unless gem_available?("fission")
raise ::Veewee::Error, "The Vmfusion Builder requires the gem 'fission' to be installed\n"+ "gem install fission"
Expand Down Expand Up @@ -41,11 +46,17 @@ def transfer_buildinfo(box,definition)

# When we get here, ssh is available and no postinstall scripts have been executed yet
# So we begin by transferring the ISO file of the vmware tools

iso_image="/Library/Application Support/VMware Fusion/isoimages/linux.iso"
iso_image="/Library/Application Support/VMware Fusion/isoimages/darwin.iso" if definition.os_type_id=~/^Darwin/
iso_image="/Library/Application Support/VMware Fusion/isoimages/freebsd.iso" if definition.os_type_id=~/^Free/
iso_image="/Library/Application Support/VMware Fusion/isoimages/windows.iso" if definition.os_type_id=~/^Win/

begin
Veewee::Util::Ssh.when_ssh_login_works(box.ip_address,ssh_options(definition).merge({:timeout => definition.postinstall_timeout.to_i})) do
begin
env.logger.info "About to transfer vmware tools iso buildinfo to the box #{box.name} - #{box.ip_address} - #{ssh_options(definition)}"
Veewee::Util::Ssh.transfer_file(box.ip_address,"/Library/Application Support/VMware Fusion/isoimages/linux.iso","linux.iso",ssh_options(definition))
Veewee::Util::Ssh.transfer_file(box.ip_address,iso_image,File.basename(iso_image),ssh_options(definition))
rescue RuntimeError => ex
env.ui.error "Error transfering vmware tools iso , possible not enough permissions to write? #{ex}"
exit -1
Expand Down
35 changes: 35 additions & 0 deletions lib/veewee/builder/vmfusion/helper/validate_vmfusion.rb
@@ -0,0 +1,35 @@
module Veewee
module Builder
module Vmfusion
module BuilderHelper

def validate_vmfusion(box_name,options)
require 'cucumber'

require 'cucumber/rspec/disable_option_parser'
require 'cucumber/cli/main'

ENV['veewee_user']=options[:user]
feature_path=File.join(File.dirname(__FILE__),"..","..","..","..","..","validation","vagrant.feature")

features=Array.new
features[0]=feature_path

begin
# The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
failure = Cucumber::Cli::Main.execute(features.dup)
Kernel.exit(failure ? 1 : 0)
rescue SystemExit => e
Kernel.exit(e.status)
rescue Exception => e
STDERR.puts("#{e.message} (#{e.class})")
STDERR.puts(e.backtrace.join("\n"))
Kernel.exit(1)
end

end
end #Module

end #Module
end #Module
end #Module
9 changes: 9 additions & 0 deletions lib/veewee/command/vmfusion.rb
Expand Up @@ -54,6 +54,15 @@ def undefine(definition_name)
exit -1
end
end

desc "validate [NAME]", "Validates a box against vmfusion compliancy rules"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
def validate(box_name)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.config.builders["vmfusion"].validate_vmfusion(box_name,options)
end


desc "ostypes", "List the available Operating System types"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
Expand Down
4 changes: 0 additions & 4 deletions lib/veewee/tasks/test.rb

This file was deleted.

106 changes: 0 additions & 106 deletions lib/veewee/vagrant/command.rb

This file was deleted.

45 changes: 0 additions & 45 deletions test.old/build_test.rb

This file was deleted.

11 changes: 0 additions & 11 deletions test.old/definition_test.rb

This file was deleted.

67 changes: 0 additions & 67 deletions test.old/environment_test.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/build_test.rb
Expand Up @@ -33,7 +33,7 @@ def test_virtualbox_3_console_type

def test_virtualbox_4_destroy
assert_nothing_raised {
@ve.builder(:virtualbox).get_box(@vm_name,@vd,{}).destroy({})
@ve.config.builders["virtualbox"].get_box(@vm_name,@vd,{}).destroy({})
}
end

Expand Down
File renamed without changes.

0 comments on commit 844e0f9

Please sign in to comment.