lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.1.0 vs lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.2.0
- old
+ new
@@ -94,16 +94,19 @@
end
end
end
pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -x' : ''
- if host['platform'] =~ /aix/ then
+ if host['platform'] =~ /windows/ then
+ "powershell -c \"cd #{host['working_dir']};[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true};\\$webClient = New-Object System.Net.WebClient;\\$webClient.DownloadFile('https://#{master}:8140/packages/#{version}/install.ps1', '#{host['working_dir']}/install.ps1');#{host['working_dir']}/install.ps1 -verbose #{frictionless_install_opts.join(' ')}\""
+ elsif host['platform'] =~ /aix/ then
curl_opts = '--tlsv1 -O'
+ "cd #{host['working_dir']} && curl #{curl_opts} https://#{master}:8140/packages/#{version}/install.bash && bash#{pe_debug} install.bash #{frictionless_install_opts.join(' ')}".strip
else
curl_opts = '--tlsv1 -kO'
+ "cd #{host['working_dir']} && curl #{curl_opts} https://#{master}:8140/packages/#{version}/install.bash && bash#{pe_debug} install.bash #{frictionless_install_opts.join(' ')}".strip
end
- "cd #{host['working_dir']} && curl #{curl_opts} https://#{master}:8140/packages/#{version}/install.bash && bash#{pe_debug} install.bash #{frictionless_install_opts.join(' ')}".strip
elsif host['platform'] =~ /osx/
version = host['pe_ver'] || opts[:pe_ver]
pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -verboseR' : ''
"cd #{host['working_dir']} && hdiutil attach #{host['dist']}.dmg && installer#{pe_debug} -pkg /Volumes/puppet-enterprise-#{version}/puppet-enterprise-installer-#{version}.pkg -target /"
elsif host['platform'] =~ /eos/
@@ -281,11 +284,19 @@
#Classify the master so that it can deploy frictionless packages for a given host.
# @param [Host] host The host to install pacakges for
# @api private
def deploy_frictionless_to_master(host)
klass = host['platform'].gsub(/-/, '_').gsub(/\./,'')
- klass = "pe_repo::platform::#{klass}"
+ if host['platform'] =~ /windows/
+ if host['template'] =~ /i386/
+ klass = "pe_repo::platform::windows_i386"
+ else
+ klass = "pe_repo::platform::windows_x86_64"
+ end
+ else
+ klass = "pe_repo::platform::#{klass}"
+ end
if version_is_less(host['pe_ver'], '3.8')
# use the old rake tasks
on dashboard, "cd /opt/puppet/share/puppet-dashboard && /opt/puppet/bin/bundle exec /opt/puppet/bin/rake nodeclass:add[#{klass},skip]"
on dashboard, "cd /opt/puppet/share/puppet-dashboard && /opt/puppet/bin/bundle exec /opt/puppet/bin/rake node:add[#{master},,,skip]"
on dashboard, "cd /opt/puppet/share/puppet-dashboard && /opt/puppet/bin/bundle exec /opt/puppet/bin/rake node:addclass[#{master},#{klass}]"
@@ -412,21 +423,25 @@
# If we're installing a database version less than 3.0, ignore the database host
install_hosts.delete(database) if pre30database and database != master and database != dashboard
end
install_hosts.each do |host|
- if agent_only_check_needed && hosts_agent_only.include?(host)
+ #windows agents from 4.0 -> 2016.1.2 were only installable via aio method
+ is_windows_msi_and_aio = (host['platform'] =~ /windows/ && (version_is_less(host['pe_ver'], '2016.3.0') && !version_is_less(host['pe_ver'], '3.99') && !(host['roles'].include?('frictionless'))))
+
+ if agent_only_check_needed && hosts_agent_only.include?(host) || is_windows_msi_and_aio
host['type'] = 'aio'
install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => host[:puppet_agent_version] || opts[:puppet_agent_version],
:puppet_agent_sha => host[:puppet_agent_sha] || opts[:puppet_agent_sha],
:pe_ver => host[:pe_ver] || opts[:pe_ver],
:puppet_collection => host[:puppet_collection] || opts[:puppet_collection] })
# 1 since no certificate found and waitforcert disabled
acceptable_exit_codes = [0, 1]
acceptable_exit_codes << 2 if opts[:type] == :upgrade
setup_defaults_and_config_helper_on(host, master, acceptable_exit_codes)
- elsif host['platform'] =~ /windows/
+ #Windows allows frictionless installs starting with PE Davis, if frictionless we need to skip this step
+ elsif (host['platform'] =~ /windows/ && !(host['roles'].include?('frictionless')))
opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
msi_path = "#{host['working_dir']}\\#{host['dist']}.msi"
install_msi_on(host, msi_path, {}, opts)
# 1 since no certificate found and waitforcert disabled
@@ -458,11 +473,10 @@
generate_installer_conf_file_for(host, hosts, opts)
on host, installer_cmd(host, opts)
configure_type_defaults_on(host)
end
end
-
# On each agent, we ensure the certificate is signed
if !masterless
if [master, database, dashboard].include?(host) && use_meep?(host['pe_ver'])
# This step is not necessary for the core pe nodes when using meep
else
@@ -495,9 +509,14 @@
sleep_until_puppetdb_started(database)
check_puppetdb_status_endpoint(database)
end
if host == dashboard
check_console_status_endpoint(host)
+ end
+ #Workaround for windows frictionless install, see BKR-943 for the reason
+ if (host['platform'] =~ /windows/) and (host['roles'].include? 'frictionless')
+ client_datadir = host.puppet['client_datadir']
+ on(host , puppet("resource file \"#{client_datadir}\" ensure=absent force=true"))
end
end
end
install_hosts.each do |host|