Module: Windows::Pkg
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #check_for_command(name) ⇒ Object
- #check_for_package(name) ⇒ Object
-
#determine_if_x86_64 ⇒ Boolean
Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used.
- #install_package(name, cmdline_args = '') ⇒ Object
-
#pe_puppet_agent_promoted_package_info(puppet_collection = nil, opts = {}) ⇒ String
Gets host-specific information for PE promoted puppet-agent packages.
-
#puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
Gets the path & file name for the puppet agent dev package on Windows.
- #uninstall_package(name, cmdline_args = '') ⇒ Object
Methods included from Beaker::CommandFactory
Instance Method Details
#check_for_command(name) ⇒ Object
4 5 6 7 |
# File 'lib/beaker/host/windows/pkg.rb', line 4 def check_for_command(name) result = exec(Beaker::Command.new("which #{name}"), :accept_all_exit_codes => true) result.exit_code == 0 end |
#check_for_package(name) ⇒ Object
9 10 11 12 |
# File 'lib/beaker/host/windows/pkg.rb', line 9 def check_for_package(name) result = exec(Beaker::Command.new("cygcheck #{name}"), :accept_all_exit_codes => true) result.exit_code == 0 end |
#determine_if_x86_64 ⇒ Boolean
Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used
46 47 48 |
# File 'lib/beaker/host/windows/pkg.rb', line 46 def determine_if_x86_64 (identify_windows_architecture =~ /64/) == 0 end |
#install_package(name, cmdline_args = '') ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/beaker/host/windows/pkg.rb', line 14 def install_package(name, cmdline_args = '') cygwin = "" rootdir = "" arch = identify_windows_architecture if arch == '64' rootdir = "c:\\\\cygwin64" cygwin = "setup-x86_64.exe" else #32 bit version rootdir = "c:\\\\cygwin" cygwin = "setup-x86.exe" end if not check_for_command(cygwin) command = "curl --retry 5 https://cygwin.com/#{cygwin} -o /cygdrive/c/Windows/System32/#{cygwin}" begin execute(command) rescue Beaker::Host::CommandFailure command.sub!('https', 'http') execute(command) end end execute("#{cygwin} -q -n -N -d -R #{cmdline_args} #{rootdir} -s http://cygwin.osuosl.org -P #{name}") end |
#pe_puppet_agent_promoted_package_info(puppet_collection = nil, opts = {}) ⇒ String
Gets host-specific information for PE promoted puppet-agent packages
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/beaker/host/windows/pkg.rb', line 87 def pe_puppet_agent_promoted_package_info( puppet_collection = nil, opts = {} ) is_config_32 = self['ruby_arch'] == 'x86' || self['install_32'] || self['install_32'] should_install_64bit = self.is_x86_64? && !is_config_32 # only install 64bit builds if # - we do not have install_32 set on host # - we do not have install_32 set globally arch_suffix = should_install_64bit ? '64' : '86' release_path_end = "/windows" release_file = "/puppet-agent-x#{arch_suffix}.msi" download_file = "puppet-agent-x#{arch_suffix}.msi" return release_path_end, release_file, download_file end |
#puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
Note:
Windows only uses the ‘install_32’ option of the opts hash at this time. Note that it will not fail if not provided, however
Gets the path & file name for the puppet agent dev package on Windows
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/beaker/host/windows/pkg.rb', line 60 def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} ) release_path_end = 'windows' is_config_32 = self['ruby_arch'] == 'x86' || self['install_32'] || opts['install_32'] should_install_64bit = self.is_x86_64? && !is_config_32 # only install 64bit builds if # - we do not have install_32 set on host # - we do not have install_32 set globally arch_suffix = should_install_64bit ? '64' : '86' # If a version was specified, use it; otherwise fall back to a default name. # Avoid when puppet_agent_version is set to a SHA, which isn't used in package names. if puppet_agent_version =~ /^\d+\.\d+\.\d+/ release_file = "puppet-agent-#{puppet_agent_version}-x#{arch_suffix}.msi" else release_file = "puppet-agent-x#{arch_suffix}.msi" end return release_path_end, release_file end |
#uninstall_package(name, cmdline_args = '') ⇒ Object
40 41 42 |
# File 'lib/beaker/host/windows/pkg.rb', line 40 def uninstall_package(name, cmdline_args = '') raise "Package #{name} cannot be uninstalled on #{self}" end |