From e2cab3ba7e06c84f2748f86db51a900b7f60bbf1 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 27 Sep 2018 23:07:50 -0700 Subject: short circuit before the version_compare call combined with the other PRs this will make most of the subclasses never even call version_compare now. the subclasses that need allow_downgrade as a feature should implement both the property and implement version_compare now. Signed-off-by: Lamont Granquist --- lib/chef/provider/package.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/chef/provider/package.rb') diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 534a219ff5..f6172f1edf 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -496,7 +496,7 @@ class Chef elsif current_version.nil? logger.trace("#{new_resource} has no existing installed version. Installing install #{candidate_version}") target_version_array.push(candidate_version) - elsif version_compare(current_version, candidate_version) == 1 && !allow_downgrade + elsif !allow_downgrade && version_compare(current_version, candidate_version) == 1 logger.trace("#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{candidate_version}. Skipping...)") target_version_array.push(nil) else -- cgit v1.2.1