summaryrefslogtreecommitdiff
path: root/chef-utils/lib/chef-utils/dsl
diff options
context:
space:
mode:
authorLance Albertson <lance@osuosl.org>2021-04-02 17:04:46 -0700
committerLance Albertson <lance@osuosl.org>2021-04-07 15:06:55 -0700
commit594b539c131b765a3abe161e2a4e832e75cf0db1 (patch)
treec25849445d57280ebb47a09f87c138d426e81ce7 /chef-utils/lib/chef-utils/dsl
parent0dc00fae7b99d0cca1cc43c6539d0e79221c31ad (diff)
downloadchef-594b539c131b765a3abe161e2a4e832e75cf0db1.tar.gz
Add centos_stream_platform? helper
This checks /etc/os-release to see if the system is CentOS Stream. Signed-off-by: Lance Albertson <lance@osuosl.org>
Diffstat (limited to 'chef-utils/lib/chef-utils/dsl')
-rw-r--r--chef-utils/lib/chef-utils/dsl/platform.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/platform.rb b/chef-utils/lib/chef-utils/dsl/platform.rb
index f44cb811bb..c90117cb33 100644
--- a/chef-utils/lib/chef-utils/dsl/platform.rb
+++ b/chef-utils/lib/chef-utils/dsl/platform.rb
@@ -17,11 +17,13 @@
#
require_relative "../internal"
+require_relative "train_helpers"
module ChefUtils
module DSL
module Platform
include Internal
+ include TrainHelpers
# NOTE: if you are adding new platform helpers they should all have the `_platform?` suffix.
# DO NOT add new short aliases without the suffix (they will be deprecated in the future)
@@ -123,6 +125,16 @@ module ChefUtils
# chef-sugar backcompat method
alias_method :centos?, :centos_platform?
+ # Determine if the current node is CentOS Stream.
+ #
+ # @since 17.0
+ #
+ # @return [Boolean]
+ #
+ def centos_stream_platform?
+ file_exist?("/etc/os-release") && file_read("/etc/os-release").match?("CentOS Stream")
+ end
+
# Determine if the current node is Oracle Linux.
#
# @param [Chef::Node] node the node to check