Skip to content

Commit

Permalink
(PE-18728) Skip frictionless install if agent is affected by powershe…
Browse files Browse the repository at this point in the history
…ll 2 bug (#45)

We introduced frictionless installs for Windows agents in PE 2016.4.0.
For upgrade scenarios where we are testing frictionless upgrades, to
install we need to use the old MSI method if we are installing less then
PE 2016.4.0.
However, we have discovered that frictionless installs of windows2008r2
will fail on PE 2016.4.0 and PE 2016.4.2.
This PR adds in logic to install with the non-frictionless method if the
agent is windows2008r2 and version is less then PE 2016.4.3.
  • Loading branch information
cthorn42 authored and kevpl committed Dec 30, 2016
1 parent 2e748b9 commit 48b3b78
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/beaker-pe/install/pe_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,8 @@ def do_install hosts, opts = {}
end

install_hosts.each do |host|
#windows agents from 4.0 -> 2016.1.2 were only installable via the 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')))

if agent_only_check_needed && hosts_agent_only.include?(host) || is_windows_msi_and_aio
if agent_only_check_needed && hosts_agent_only.include?(host) || install_via_msi?(host)
host['type'] = 'aio'
install_puppet_agent_pe_promoted_repo_on(host, {
:puppet_agent_version => get_puppet_agent_version(host, opts),
Expand All @@ -413,7 +411,7 @@ def do_install hosts, opts = {}
acceptable_exit_codes << 2 if opts[:type] == :upgrade
setup_defaults_and_config_helper_on(host, master, acceptable_exit_codes)
#Windows allows frictionless installs starting with PE Davis, if frictionless we need to skip this step
elsif (host['platform'] =~ /windows/ && !(host['roles'].include?('frictionless')))
elsif (host['platform'] =~ /windows/ && !(host['roles'].include?('frictionless')) || install_via_msi?(host))
opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
msi_path = "#{host['working_dir']}\\#{host['dist']}.msi"
install_msi_on(host, msi_path, {}, opts)
Expand Down Expand Up @@ -615,6 +613,15 @@ def use_meep?(version)
!version_is_less(version, MEEP_CUTOVER_VERSION)
end

# Check if windows host is able to frictionlessly install puppet
# @param [Beaker::Host] host that we are checking if it is possible to install frictionlessly to
# @return [Boolean] true if frictionless is supported and not affected by known bugs
def install_via_msi?(host)
#windows agents from 4.0 -> 2016.1.2 were only installable via the aio method
#powershell2 bug was fixed in PE 2016.4.3
(host['platform'] =~ /windows/ && (version_is_less(host['pe_ver'], '2016.4.0') && !version_is_less(host['pe_ver'], '3.99'))) || (host['platform'] =~ /windows-2008r2/ && (version_is_less(host['pe_ver'], '2016.4.3') && !version_is_less(host['pe_ver'], '3.99')))
end

# On July 8th, 2016, the gpg key that was shipped and used to sign repos in
# PE tarballs expired. This affects all PE version earlier then 3.8.5, and
# versions between 2015.2 to 2016.1.2.
Expand Down
32 changes: 32 additions & 0 deletions spec/beaker-pe/install/pe_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,38 @@ def logger
the_host[:pe_debug] = true
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.8.0/install.bash && bash -x install.bash"
end
end

describe 'install_via_msi?' do
it 'returns true if pe_version is before PE 2016.4.0' do
the_host = winhost.dup
the_host['roles'] = ['frictionless']
the_host['pe_ver'] = '2015.2.3'
expect(subject.install_via_msi?(the_host)).to eq(true)
end

it 'returns nil if pe_version is PE 2016.4.0 or newer' do
the_host = winhost.dup
the_host['roles'] = ['frictionless']
the_host['pe_ver'] = '2016.4.2'
expect(subject.install_via_msi?(the_host)).to be nil
end

it 'returns true if pe_version is 2016.4.0 and platform is windows-2008r2 bug' do
the_host = winhost.dup
the_host['roles'] = ['frictionless']
the_host['platform'] = 'windows-2008r2'
the_host['pe_ver'] = '2016.4.0'
expect(subject.install_via_msi?(the_host)).to eq(true)
end

it 'returns false if pe_version is 2016.4.3 and platform is windows-2008r2 bug' do
the_host = winhost.dup
the_host['roles'] = ['frictionless']
the_host['platform'] = 'windows-2008r2'
the_host['pe_ver'] = '2016.4.3'
expect(subject.install_via_msi?(the_host)).to eq(false)
end

end

Expand Down

0 comments on commit 48b3b78

Please sign in to comment.