Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-10713) Fix agent upgrade on Solaris 11 #499

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def needs_upgrade?
current_version = Facter.value('aio_agent_version')
desired_version = @resource.name

# Ensure version has no git SHA or Debian codenames
desired_version = Gem::Version.new(desired_version).release.version

Puppet::Util::Package.versioncmp(desired_version, current_version) != 0
end
end
5 changes: 3 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@
$_source = undef
}
}
$_aio_package_version = $package_version.match(/^\d+\.\d+\.\d+(\.\d+)?/)[0]
package { $::puppet_agent::package_name:
ensure => $_package_version,
install_options => $_install_options,
provider => $_provider,
source => $_source,
notify => Puppet_agent_end_run[$_package_version],
notify => Puppet_agent_end_run[$_aio_package_version],
}
puppet_agent_end_run { $_package_version : }
puppet_agent_end_run { $_aio_package_version : }
}
}
5 changes: 3 additions & 2 deletions manifests/install/solaris.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@
}
}
} else {
$_aio_package_version = $package_version.match(/^\d+\.\d+\.\d+(\.\d+)?/)[0]
package { $::puppet_agent::package_name:
ensure => $package_version,
install_options => $install_options,
notify => Puppet_agent_end_run[$package_version],
notify => Puppet_agent_end_run[$_aio_package_version],
}
puppet_agent_end_run { $package_version : }
puppet_agent_end_run { $_aio_package_version : }
}
}
3 changes: 2 additions & 1 deletion spec/classes/puppet_agent_osfamily_solaris_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def install_script(ver, arch)
:clientcert => 'foo.example.vm',
:env_temp_variable => '/tmp',
:puppet_agent_pid => 42,
:aio_agent_version => package_version,
:aio_agent_version => '1.10.100.90',
}
# Strips out strings in the version string on Solaris 11,
# because pkg doesn't accept strings in version numbers. This
Expand Down Expand Up @@ -148,6 +148,7 @@ def install_script(ver, arch)
it { should compile.with_all_deps }
it { is_expected.to contain_file('/opt/puppetlabs') }
it { is_expected.to contain_file('/opt/puppetlabs/packages') }
it { is_expected.to contain_puppet_agent_end_run(facts[:aio_agent_version]) }
it do
is_expected.to contain_file("/opt/puppetlabs/packages/puppet-agent@#{sol11_package_version},5.11-1.i386.p5p").with({
'ensure' => 'present',
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/puppet_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ def global_facts(facts, os)
global_facts(facts, os)
end

# Windows, Solaris 10 and OS X use scripts for upgrading agents
# We test Solaris 11 in its own class
if os !~ %r{windows|solaris|darwin}
context 'when using a dev build' do
let(:params) { { :package_version => '5.2.0.100.g23e53f2' } }
it { is_expected.to contain_puppet_agent_end_run('5.2.0.100') }
end

context 'when using a release build' do
let(:params) { { :package_version => '5.2.0' } }
it { is_expected.to contain_puppet_agent_end_run('5.2.0') }
end
end

context 'when the aio_agent_version fact is undefined' do
let(:facts) do
global_facts(facts, os).merge(aio_agent_version: nil)
Expand Down