class ChefCore::Actions::InstallChef::MinimumChefVersion
Constants
- CONSTRAINTS
Public Class Methods
check!(target, check_only)
click to toggle source
# File lib/chef_core/actions/install_chef/minimum_chef_version.rb, line 38 def self.check!(target, check_only) begin installed_version = target.installed_chef_version rescue ChefCore::TargetHost::ChefNotInstalled if check_only raise ClientNotInstalled.new end return :client_not_installed end os_constraints = CONSTRAINTS[target.base_os] min_14_version = os_constraints[14] min_13_version = os_constraints[13] case when installed_version >= Gem::Version.new("14.0.0") && installed_version < min_14_version raise Client14Outdated.new(installed_version, min_14_version) when installed_version >= Gem::Version.new("13.0.0") && installed_version < min_13_version raise Client13Outdated.new(installed_version, min_13_version, min_14_version) when installed_version < Gem::Version.new("13.0.0") # If they have Chef < 13.0.0 installed we want to show them the easiest upgrade path - # Chef 13 first and then Chef 14 since most customers cannot make the leap directly # to 14. raise Client13Outdated.new(installed_version, min_13_version, min_14_version) end :minimum_version_met end