libraries/sensu_helpers.rb
# Derives Sensu package version strings for Amazon Linux 2 platforms.
# When the desired Sensu version is '0.27.0' or later, the package
# requires a '.elX' suffix.
#
# @param sensu_version [String] Sensu version string
# @param platform_version [String] Platform version
# @param suffix_override [String,NilClass] Suffix to override default '.elX'
Derives Sensu package version strings for Amazon Linux 2 platforms.
When the desired Sensu version is '0.27.0' or later, the package
requires a '.elX' suffix.
Derives Sensu package version strings for Amazon Linux 2 platforms . When the desired Sensu version is ' 0 . 27 . 0 ' or later the package requires a ' . elX ' suffix .
def amazon_linux_2_version_string(sensu_version, platform_version, suffix_override = nil)
        bare_version = sensu_version.split('-').first
        if Gem::Version.new(bare_version) < Gem::Version.new('0.27.0')
          sensu_version
        else
          platform_major = Gem::Version.new(platform_version).segments.first
          suffix = suffix_override || ".el#{platform_major}"
          [sensu_version, suffix].join
        end
      end
def amazon_linux_2_version_string ( sensu_version , platform_version , suffix_override = nil ) bare_version = sensu_version . split ( '-' ) . first if Gem :: Version . new ( bare_version ) < Gem :: Version . new ( '0.27.0' ) sensu_version else platform_major = Gem :: Version . new ( platform_version ) . segments . first suffix = suffix_override || ".el#{platform_major}" [ sensu_version , suffix ] . join end end
Derives Sensu package version strings for Amazon Linux 2 platforms.
Derives Sensu package version strings for Amazon Linux 2 platforms .
sensu_version
Sensu version string
Sensu version string
platform_version
None
suffix_override
Suffix to override default '.elX'
Suffix to override default ' . elX '