Module: Chef::Sugar::Platform

Extended by:
Platform
Included in:
Platform
Defined in:
lib/chef/sugar/platform.rb

Constant Summary collapse

PLATFORM_VERSIONS =
{
  'debian' => {
    'squeeze' => '6',
    'wheezy'  => '7',
    'jessie'  => '8',
  },
  'linuxmint' => {
    'qiana'  => '17',
    'petra'  => '16',
    'olivia' => '15',
    'nadia'  => '14',
    'maya'   => '13',
    'lisa'   => '12',
  },
  'mac_os_x' => {
    'lion'          => '10.7',
    'mountain_lion' => '10.8',
    'mavericks'     => '10.9',
    'yosemite'      => '10.10',
  },
  'ubuntu' => {
    'lucid'    => '10.04',
    'maverick' => '10.10',
    'natty'    => '11.04',
    'oneiric'  => '11.10',
    'precise'  => '12.04',
    'quantal'  => '12.10',
    'raring'   => '13.04',
    'saucy'    => '13.10',
    'trusty'   => '14.04',
  },
}
COMPARISON_OPERATORS =
{
  'after'        => ->(a, b) { a > b },
  'after_or_at'  => ->(a, b) { a >= b },
  ''             => ->(a, b) { a == b },
  'before'       => ->(a, b) { a < b },
  'before_or_at' => ->(a, b) { a <= b },
}

Instance Method Summary collapse

Instance Method Details

#aix?(node) ⇒ Boolean

Determine if the current node is aix

Parameters:

Returns:

  • (Boolean)


185
186
187
# File 'lib/chef/sugar/platform.rb', line 185

def aix?(node)
  node['platform'] == 'aix'
end

#amazon_linux?(node) ⇒ Boolean Also known as: amazon?

Determine if the current node is amazon linux.

Parameters:

Returns:

  • (Boolean)


114
115
116
# File 'lib/chef/sugar/platform.rb', line 114

def amazon_linux?(node)
  node['platform'] == 'amazon'
end

#centos?(node) ⇒ Boolean

Determine if the current node is centos.

Parameters:

Returns:

  • (Boolean)


126
127
128
# File 'lib/chef/sugar/platform.rb', line 126

def centos?(node)
  node['platform'] == 'centos'
end

#linux_mint?(node) ⇒ Boolean Also known as: mint?

Determine if the current node is linux mint.

Parameters:

Returns:

  • (Boolean)


91
92
93
# File 'lib/chef/sugar/platform.rb', line 91

def linux_mint?(node)
  node['platform'] == 'linuxmint'
end

#omnios?(node) ⇒ Boolean

Determine if the current node is omnios

Parameters:

Returns:

  • (Boolean)


207
208
209
# File 'lib/chef/sugar/platform.rb', line 207

def omnios?(node)
  node['platform'] == 'omnios'
end

#oracle_linux?(node) ⇒ Boolean Also known as: oracle?

Determine if the current node is oracle linux.

Parameters:

Returns:

  • (Boolean)


137
138
139
# File 'lib/chef/sugar/platform.rb', line 137

def oracle_linux?(node)
  node['platform'] == 'oracle'
end

#redhat_enterprise_linux?(node) ⇒ Boolean Also known as: redhat_enterprise?

Determine if the current node is redhat enterprise.

Parameters:

Returns:

  • (Boolean)


161
162
163
# File 'lib/chef/sugar/platform.rb', line 161

def redhat_enterprise_linux?(node)
  node['platform'] == 'enterprise'
end

#scientific_linux?(node) ⇒ Boolean Also known as: scientific?

Determine if the current node is scientific linux.

Parameters:

Returns:

  • (Boolean)


149
150
151
# File 'lib/chef/sugar/platform.rb', line 149

def scientific_linux?(node)
  node['platform'] == 'scientific'
end

#smartos?(node) ⇒ Boolean

Determine if the current node is smartos

Parameters:

Returns:

  • (Boolean)


196
197
198
# File 'lib/chef/sugar/platform.rb', line 196

def smartos?(node)
  node['platform'] == 'smartos'
end

#solaris2?(node) ⇒ Boolean Also known as: solaris?

Determine if the current node is solaris2

Parameters:

Returns:

  • (Boolean)


173
174
175
# File 'lib/chef/sugar/platform.rb', line 173

def solaris2?(node)
  node['platform'] == 'solaris2'
end

#ubuntu?(node) ⇒ Boolean

Determine if the current node is ubuntu.

Parameters:

Returns:

  • (Boolean)


103
104
105
# File 'lib/chef/sugar/platform.rb', line 103

def ubuntu?(node)
  node['platform'] == 'ubuntu'
end