Class: PEBuild::Cap::StageInstaller::Windows
- Inherits:
-
Object
- Object
- PEBuild::Cap::StageInstaller::Windows
- Extended by:
- OnMachine
- Defined in:
- lib/pe_build/cap/stage_installer/windows.rb
Overview
Download PE installers to a Windows VM
Class Method Summary collapse
-
.stage_installer(machine, uri, dest_dir = '.') ⇒ void
Download an installer to a remote VM.
Methods included from OnMachine
Class Method Details
.stage_installer(machine, uri, dest_dir = '.') ⇒ void
This method returns an undefined value.
Download an installer to a remote VM
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pe_build/cap/stage_installer/windows.rb', line 17 def self.stage_installer(machine, uri, dest_dir='.') filename = File.basename(uri.path) unless machine.communicate.test(%Q[If (Test-Path "#{dest_dir}/#{filename}) { Exit 0 } Else { Exit 1 }]) machine.ui.info I18n.t('pebuild.cap.stage_installer.downloading_installer', :url => uri) # Setting ServerCertificateValidationCallback to always return true # allows us to download from HTTPS sources that present a self-signed # certificate. For example, a Puppet Master. on_machine(machine, <<-EOS) $DestDir = (Get-Item -Path "#{dest_dir}").FullName Write-Host "Downloading #{filename} to: ${DestDir}" [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} (New-Object System.Net.WebClient).DownloadFile("#{uri}","$DestDir/#{filename}") EOS end end |