diff options
author | Tim Smith <tsmith@chef.io> | 2018-07-31 16:57:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 16:57:41 -0700 |
commit | fb654c52cdfe439b3e009ca7dd008b09d453214c (patch) | |
tree | ce9f35c5bc85937c35af1fdc63298e77ade23515 /lib | |
parent | ba486abf84f0d40ed5d484fd1803ecfdc8f33da6 (diff) | |
parent | eba0385cdd993554c70caf8c25926b4e867f80fe (diff) | |
download | chef-fb654c52cdfe439b3e009ca7dd008b09d453214c.tar.gz |
Merge pull request #7495 from MsysTechnologiesllc/piyush/added_downgrade_exception
MSYS-858 : added warning if allow_downgrade set to be false and tried to install older version
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/package.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 01d8829dd2..113d33a2fc 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -500,11 +500,13 @@ class Chef end when :install - if new_version if version_requirement_satisfied?(current_version, new_version) logger.trace("#{new_resource} #{package_name} #{current_version} satisifies #{new_version} requirement") target_version_array.push(nil) + elsif current_version && !allow_downgrade && version_compare(current_version, new_version) == 1 + logger.warn("#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{new_version}. Skipping...)") + target_version_array.push(nil) else logger.trace("#{new_resource} #{package_name} #{current_version} needs updating to #{new_version}") target_version_array.push(new_version) |