Permalink
Browse files

winrm integration for fusion

  • Loading branch information...
jedi4ever committed Nov 6, 2012
1 parent cdeceab commit bc1db9214bcdbeb4775d0dc3de6055f8cc534dbd
@@ -16,7 +16,7 @@ def build(box_name)
venv.providers["vmfusion"].get_box(box_name).build(options)
end
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "force the destroy"
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "force the destroy"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
method_option :nogui,:type => :boolean , :default => false, :aliases => "-n", :desc => "no gui"
desc "destroy [BOXNAME]", "Destroys the virtualmachine that was built"
@@ -27,7 +27,7 @@ def destroy(box_name)
end
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "force the shutdown"
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "force the shutdown"
desc "halt [BOXNAME]", "Activates a shutdown the virtualmachine"
def halt(box_name)
venv=Veewee::Environment.new(options)
@@ -52,6 +52,25 @@ def ssh(box_name,command=nil)
venv.providers["vmfusion"].get_box(box_name).issh(command)
end
desc "winrm [BOXNAME] [COMMAND]", "Execute command via winrm"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
def winrm(box_name,command=nil)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["vmfusion"].get_box(box_name).winrm(command,{:exitcode => "*"})
end
desc "copy [BOXNAME] [SRC] [DST]", "Copy a file to the VM"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
def copy(box_name,src,dst)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["vmfusion"].get_box(box_name).copy_to_box(src,dst)
end
desc "define [BOXNAME] [TEMPLATE]", "Define a new basebox starting from a template"
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "overwrite the definition"
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging"
@@ -94,7 +113,7 @@ def ostypes
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.ostypes.each do |name|
env.ui.info "- #{name}"
env.ui.info "- #{name}"
end
end
@@ -5,6 +5,7 @@
require 'veewee/provider/vmfusion/box/helper/status'
require 'veewee/provider/vmfusion/box/helper/ip'
require 'veewee/provider/vmfusion/box/helper/ssh_options'
require 'veewee/provider/vmfusion/box/helper/winrm_options'
require 'veewee/provider/vmfusion/box/helper/vnc'
require 'veewee/provider/vmfusion/box/helper/console_type'
require 'veewee/provider/vmfusion/box/helper/buildinfo'
@@ -40,12 +40,15 @@ def transfer_buildinfo(options)
# 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
env.logger.info "About to transfer vmware tools iso buildinfo to the box #{name} - #{ip_address} - #{ssh_options}"
iso_image=guest_iso_path
if File.exists?(iso_image)
self.copy_to_box(iso_image,File.basename(iso_image))
else
raise Veewee::Error, "We could not find the file #{iso_image}. In newer versions of Fusion, you might have to download the Guest Additions yourself. You can do this by first manually creating a vm and than 'installing the guest additions'"
if not (definition.winrm_user && definition.winrm_password)
# with windows, we just use the mounted volume
env.logger.info "About to transfer vmware tools iso buildinfo to the box #{name} - #{ip_address} - #{ssh_options}"
iso_image=guest_iso_path
if File.exists?(iso_image)
self.copy_to_box(iso_image,File.basename(iso_image))
else
raise Veewee::Error, "We could not find the file #{iso_image}. In newer versions of Fusion, you might have to download the Guest Additions yourself. You can do this by first manually creating a vm and than 'installing the guest additions'"
end
end
end
@@ -27,7 +27,13 @@ def fusion_version
env.logger.info("Checking version by querying the system_profiler")
env.logger.debug(shell_results.stdout)
version = shell_results.stdout.split(/VMware/)[1].split(/\n/)[2].split(/:/)[1].strip
if (shell_results.stdout == "")
ui.warn "Could not detect the exact version of vmware. assuming 5.1"
version = "5.1"
else
version = shell_results.stdout.split(/VMware/)[1].split(/\n/)[2].split(/:/)[1].strip
end
return version
end
@@ -20,7 +20,7 @@
:postinstall_timeout => "10000",
:postinstall_files => [
"install-chef.bat",
"install-vbox.bat"
"_install-vbox.bat"
],
:shutdown_cmd => "shutdown /s /t 10 /c \"Vagrant Shutdown\" /f /d p:4:1",
})

0 comments on commit bc1db92

Please sign in to comment.