File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
lib/puppet/provider/puppet_agent_end_run Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,13 @@ def needs_upgrade?
3232 return false if desired_version == 'present'
3333
3434 if desired_version == 'latest'
35- latest_version = @resource . catalog . resource ( 'package' , 'puppet-agent' ) . parameters [ :ensure ] . latest
36- desired_version = latest_version . match ( %r{^(?:[0-9]:)?(\d +\. \d +(\. \d +)?(?:\. \d +))?} ) . captures . first
35+ # Package name might be different to puppet-agent, hence we need to look it up.
36+ package_name = @resource . catalog . resource ( 'class' , 'puppet_agent' ) [ :package_name ]
37+
38+ # Latest version might be undefined, e.G. if we're about to install a different named
39+ # package than the currently running one. In that case, we'll leave desired_version empty.
40+ latest_version = @resource . catalog . resource ( 'package' , package_name ) . parameters [ :ensure ] . latest
41+ desired_version = latest_version . match ( %r{^(?:[0-9]:)?(\d +\. \d +(\. \d +)?(?:\. \d +))?} ) . captures . first unless latest_version . nil?
3742 end
3843
3944 Puppet ::Util ::Package . versioncmp ( desired_version , current_version ) != 0
You can’t perform that action at this time.
0 commit comments