diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-14 13:35:09 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-14 13:35:09 -0800 |
commit | 0abe9ee9a5ea1ba74ae78e6eac404be9d37252a9 (patch) | |
tree | ffd833a7397cd3dee52e8c68581a03cb8c0f40e1 /chef-utils/lib/chef-utils/dsl/platform_family.rb | |
parent | 37d505f3240e4b0a0ba0c316e6ecff4e9c3e5e45 (diff) | |
download | chef-0abe9ee9a5ea1ba74ae78e6eac404be9d37252a9.tar.gz |
additional chef-utils helpers for rhel6/7/8
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'chef-utils/lib/chef-utils/dsl/platform_family.rb')
-rw-r--r-- | chef-utils/lib/chef-utils/dsl/platform_family.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/platform_family.rb b/chef-utils/lib/chef-utils/dsl/platform_family.rb index f13a2e146b..55ca6196c9 100644 --- a/chef-utils/lib/chef-utils/dsl/platform_family.rb +++ b/chef-utils/lib/chef-utils/dsl/platform_family.rb @@ -77,7 +77,9 @@ module ChefUtils alias_method :mac?, :macos? alias_method :mac_os_x?, :macos? - # Determine if the current node is a member of the redhat family. + # Determine if the current node is a member of the rhel family (RHEL, CentOS, Oracle or Scientific Linux, no Amazon or Fedora). + # + # The platform_versions for these operating systems must match (rhel7 == centos7 == oracle7 == scientfic7), modulo additional packages # # @param [Chef::Node] node # @@ -88,6 +90,36 @@ module ChefUtils end alias_method :el?, :rhel? + # Determine if the current node is a rhel6 compatible build (RHEL, CentOS, Oracle or Scientific Linux) + # + # @param [Chef::Node] node + # + # @return [Boolean] + # + def rhel6?(node = __getnode) + node["platform_family"] == "rhel" && node["platform_version"].to_f >= 6.0 && node["platform_version"].to_f < 7.0 + end + + # Determine if the current node is a rhel7 compatible build (RHEL, CentOS, Oracle or Scientific Linux) + # + # @param [Chef::Node] node + # + # @return [Boolean] + # + def rhel7?(node = __getnode) + node["platform_family"] == "rhel" && node["platform_version"].to_f >= 7.0 && node["platform_version"].to_f < 8.0 + end + + # Determine if the current node is a rhel8 compatible build (RHEL, CentOS, Oracle or Scientific Linux) + # + # @param [Chef::Node] node + # + # @return [Boolean] + # + def rhel8?(node = __getnode) + node["platform_family"] == "rhel" && node["platform_version"].to_f >= 8.0 && node["platform_version"].to_f < 9.0 + end + # Determine if the current node is a member of the amazon family. # # @param [Chef::Node] node |