lib/chef/sugar/platform.rb in chef-sugar-5.0.1 vs lib/chef/sugar/platform.rb in chef-sugar-5.1.8
- old
+ new
@@ -119,189 +119,193 @@
end
end
end
end
- #
- # Determine if the current node is linux mint.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def linux_mint?(node)
- node['platform'] == 'linuxmint'
- end
- alias_method :mint?, :linux_mint?
+ # these helpers have been moved to core chef
+ unless Gem::Requirement.new(">= 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
+ #
+ # Determine if the current node is linux mint.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def linux_mint?(node)
+ node['platform'] == 'linuxmint'
+ end
+ alias_method :mint?, :linux_mint?
- #
- # Determine if the current node is ubuntu.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def ubuntu?(node)
- node['platform'] == 'ubuntu'
- end
+ #
+ # Determine if the current node is ubuntu.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def ubuntu?(node)
+ node['platform'] == 'ubuntu'
+ end
- #
- # Determine if the current node is debian (platform, not platform_family).
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def debian_platform?(node)
- node['platform'] == 'debian'
- end
+ #
+ # Determine if the current node is debian (platform, not platform_family).
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def debian_platform?(node)
+ node['platform'] == 'debian'
+ end
- #
- # Determine if the current node is amazon linux.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def amazon_linux?(node)
- node['platform'] == 'amazon'
- end
- alias_method :amazon?, :amazon_linux?
+ #
+ # Determine if the current node is amazon linux.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def amazon_linux?(node)
+ node['platform'] == 'amazon'
+ end
+ alias_method :amazon?, :amazon_linux?
- #
- # Determine if the current node is centos.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def centos?(node)
- node['platform'] == 'centos'
- end
+ #
+ # Determine if the current node is centos.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def centos?(node)
+ node['platform'] == 'centos'
+ end
- #
- # Determine if the current node is oracle linux.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def oracle_linux?(node)
- node['platform'] == 'oracle'
- end
- alias_method :oracle?, :oracle_linux?
+ #
+ # Determine if the current node is oracle linux.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def oracle_linux?(node)
+ node['platform'] == 'oracle'
+ end
+ alias_method :oracle?, :oracle_linux?
- #
- # Determine if the current node is scientific linux.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def scientific_linux?(node)
- node['platform'] == 'scientific'
- end
- alias_method :scientific?, :scientific_linux?
+ #
+ # Determine if the current node is scientific linux.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def scientific_linux?(node)
+ node['platform'] == 'scientific'
+ end
+ alias_method :scientific?, :scientific_linux?
- #
- # Determine if the current node is redhat enterprise.
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def redhat_enterprise_linux?(node)
- node['platform'] == 'redhat'
- end
- alias_method :redhat_enterprise?, :redhat_enterprise_linux?
+ #
+ # Determine if the current node is redhat enterprise.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def redhat_enterprise_linux?(node)
+ node['platform'] == 'redhat'
+ end
+ alias_method :redhat_enterprise?, :redhat_enterprise_linux?
- #
- # Determine if the current node is fedora (platform, not platform_family).
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def fedora_platform?(node)
- node['platform'] == 'fedora'
- end
+ #
+ # Determine if the current node is fedora (platform, not platform_family).
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def fedora_platform?(node)
+ node['platform'] == 'fedora'
+ end
- #
- # Determine if the current node is solaris2
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def solaris2?(node)
- node['platform'] == 'solaris2'
- end
- alias_method :solaris?, :solaris2?
+ #
+ # Determine if the current node is solaris2
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def solaris2?(node)
+ node['platform'] == 'solaris2'
+ end
+ alias_method :solaris?, :solaris2?
- #
- # Determine if the current node is aix
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def aix?(node)
- node['platform'] == 'aix'
- end
+ #
+ # Determine if the current node is aix
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def aix?(node)
+ node['platform'] == 'aix'
+ end
- #
- # Determine if the current node is smartos
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def smartos?(node)
- node['platform'] == 'smartos'
- end
+ #
+ # Determine if the current node is smartos
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def smartos?(node)
+ node['platform'] == 'smartos'
+ end
- #
- # Determine if the current node is omnios
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def omnios?(node)
- node['platform'] == 'omnios'
- end
+ #
+ # Determine if the current node is omnios
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def omnios?(node)
+ node['platform'] == 'omnios'
+ end
- #
- # Determine if the current node is raspbian
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def raspbian?(node)
- node['platform'] == 'raspbian'
- end
+ #
+ # Determine if the current node is raspbian
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def raspbian?(node)
+ node['platform'] == 'raspbian'
+ end
- #
- # Determine if the current node is a Cisco nexus device
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def nexus?(node)
- node['platform'] == 'nexus'
- end
+ #
+ # Determine if the current node is a Cisco nexus device
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def nexus?(node)
+ node['platform'] == 'nexus'
+ end
- #
- # Determine if the current node is a Cisco IOS-XR device
- #
- # @param [Chef::Node] node
- #
- # @return [Boolean]
- #
- def ios_xr?(node)
- node['platform'] == 'ios_xr'
+ #
+ # Determine if the current node is a Cisco IOS-XR device
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def ios_xr?(node)
+ node['platform'] == 'ios_xr'
+ end
+
end
#
# Return the platform_version for the node. Acts like a String
# but also provides a mechanism for checking version constraints.