chef-sugar 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9af9d5af445419a590304e19d1b1d22e8c3c9914bd1c30e3f63bde1aeef2bd83
4
- data.tar.gz: b09532265cda101b4acad35684aafcdf8cacde06b9bdcbec0adbd7753adcc6f8
3
+ metadata.gz: 9993b7197e3f6eb070ee5f647e674c01ced3d83fcc2e60cb18c0ae048836a44c
4
+ data.tar.gz: eb4c7d5db4120a2ddef33889a5d0242267b674fd5d30f3e694f20daabce05d36
5
5
  SHA512:
6
- metadata.gz: b75c485d56ff4a0404bc0b5eb6426ff388d405f0ba5b53caf0951b1d05f8a5cd59629cd5779cd0e28b550b5786f2c565b6af965f7e6649562ee9fd817bf2757c
7
- data.tar.gz: 98bb4b85319dcf85e0f0123b88eea0d378c36838e496d5305bd445f53fba5843b641c5d6caaea2c53cdf68d358a611d6be16b49ef31cb734cb904180a1d59929
6
+ metadata.gz: 6314160cb1776c1f94dddbb459016912af9b3ea843f9bb74b78ebf296b779ca07b49f3d45ac29849a3664584b41594523577ab6f24f5cb8a284391c83d64180e
7
+ data.tar.gz: 3ee7157ada8bfaeb834f669b5791261bd502b4d14ed746765bb7c7ed6a75f39f469f811eb1eac30aebe8ead0e4df3ebc4e01694c28d0ea4083808f33fd46e009
@@ -2,6 +2,12 @@
2
2
 
3
3
  This file is used to list changes made in each version of the chef-sugar cookbook and gem.
4
4
 
5
+ ## v4.2.0 (2018-12-05)
6
+
7
+ - Added a new parallels? helper
8
+ - Added support for the Raspberry Pi 1 and Zero to armhf? helper
9
+ - Added a centos_final? helper
10
+
5
11
  ## v4.1.0 (2018-08-16)
6
12
 
7
13
  - Improve the detection of linux hosts with the linux? helper. Amazon Linux and obscure distros will now be properly detected.
data/README.md CHANGED
@@ -358,6 +358,7 @@ There are also a series of dynamically defined matchers that map named operating
358
358
  - `debian_after_squeeze?`
359
359
  - `linuxmint_after_or_at_olivia?`
360
360
  - `mac_os_x_lion?`
361
+ - `centos_final?`
361
362
  - `ubuntu_before_lucid?`
362
363
  - `ubuntu_before_or_at_maverick?`
363
364
  - `solaris_10?`
@@ -470,6 +471,7 @@ end
470
471
 
471
472
  - `kvm?`
472
473
  - `lxc?`
474
+ - `parallels?`
473
475
  - `virtualbox?`
474
476
  - `vmware?`
475
477
  - `openvz?`
@@ -106,7 +106,7 @@ class Chef
106
106
  #
107
107
  def armhf?(node)
108
108
  # Add more arm variants as needed here
109
- %w(armv7l)
109
+ %w(armv6l armv7l)
110
110
  .include?(node['kernel']['machine'])
111
111
  end
112
112
 
@@ -49,6 +49,20 @@ class Chef
49
49
  'high_sierra' => '10.13',
50
50
  'mojave' => '10.14',
51
51
  },
52
+ 'redhat' => {
53
+ 'santiago' => '6',
54
+ '6' => '6',
55
+ 'maipo' => '7',
56
+ '7' => '7',
57
+ 'oompa' => '8',
58
+ '8' => '8'
59
+ },
60
+ 'centos' => {
61
+ 'final' => '6',
62
+ '6' => '6',
63
+ 'core' => '7',
64
+ '7' => '7'
65
+ },
52
66
  'solaris' => {
53
67
  '7' => '5.7',
54
68
  '8' => '5.8',
@@ -16,6 +16,6 @@
16
16
 
17
17
  class Chef
18
18
  module Sugar
19
- VERSION = '4.1.0'
19
+ VERSION = '4.2.0'
20
20
  end
21
21
  end
@@ -45,6 +45,19 @@ class Chef
45
45
  node.key?('virtualization') && node['virtualization']['system'] == 'lxc'
46
46
  end
47
47
 
48
+ #
49
+ # Determine if the current node is running under Parallels Desktop.
50
+ #
51
+ # @param [Chef::Node] node
52
+ #
53
+ # @return [Boolean]
54
+ # true if the machine is currently running under Parallels Desktop, false
55
+ # otherwise
56
+ #
57
+ def parallels?(node)
58
+ node.key?('virtualization') && node['virtualization']['system'] == 'Parallels'
59
+ end
60
+
48
61
  #
49
62
  # Determine if the current node is running under VirtualBox.
50
63
  #
@@ -85,7 +98,7 @@ class Chef
85
98
  end
86
99
 
87
100
  def virtual?(node)
88
- openvz?(node) || vmware?(node) || virtualbox?(node) || lxc?(node) || kvm?(node)
101
+ openvz?(node) || vmware?(node) || virtualbox?(node) || parallels?(node) || lxc?(node) || kvm?(node)
89
102
  end
90
103
 
91
104
  def physical?(node)
@@ -95,25 +108,44 @@ class Chef
95
108
 
96
109
  module DSL
97
110
  # @see Chef::Sugar::Virtualization#kvm?
98
- def kvm?; Chef::Sugar::Virtualization.kvm?(node); end
111
+ def kvm?
112
+ Chef::Sugar::Virtualization.kvm?(node)
113
+ end
99
114
 
100
115
  # @see Chef::Sugar::Virtualization#lxc?
101
- def lxc?; Chef::Sugar::Virtualization.lxc?(node); end
116
+ def lxc?
117
+ Chef::Sugar::Virtualization.lxc?(node)
118
+ end
119
+
120
+ # @see Chef::Sugar::Virtualization#parallels?
121
+ def parallels?
122
+ Chef::Sugar::Virtualization.parallels?(node)
123
+ end
102
124
 
103
125
  # @see Chef::Sugar::Virtualization#virtualbox?
104
- def virtualbox?; Chef::Sugar::Virtualization.virtualbox?(node); end
126
+ def virtualbox?
127
+ Chef::Sugar::Virtualization.virtualbox?(node)
128
+ end
105
129
 
106
130
  # @see Chef::Sugar::Virtualization#vmware?
107
- def vmware?; Chef::Sugar::Virtualization.vmware?(node); end
131
+ def vmware?
132
+ Chef::Sugar::Virtualization.vmware?(node)
133
+ end
108
134
 
109
135
  # @see Chef::Sugar::Virtualization#openvz?
110
- def openvz?; Chef::Sugar::Virtualization.openvz?(node); end
136
+ def openvz?
137
+ Chef::Sugar::Virtualization.openvz?(node)
138
+ end
111
139
 
112
140
  # @see Chef::Sugar::Virtualization#virtual?
113
- def virtual?; Chef::Sugar::Virtualization.virtual?(node); end
114
-
141
+ def virtual?
142
+ Chef::Sugar::Virtualization.virtual?(node)
143
+ end
144
+
115
145
  # @see Chef::Sugar::Virtualization#physical?
116
- def physical?; Chef::Sugar::Virtualization.physical?(node); end
146
+ def physical?
147
+ Chef::Sugar::Virtualization.physical?(node)
148
+ end
117
149
  end
118
150
  end
119
151
  end
@@ -289,6 +289,18 @@ describe Chef::Sugar::Platform do
289
289
  end
290
290
  end
291
291
 
292
+ describe '#centos_final?' do
293
+ it 'returns true when the version is a subset of the major' do
294
+ node = { 'platform' => 'centos', 'platform_version' => '6.8' }
295
+ expect(described_class.centos_final?(node)).to be true
296
+ end
297
+
298
+ it 'returns false when the version is not the major' do
299
+ node = { 'platform' => 'centos', 'platform_version' => '7.4' }
300
+ expect(described_class.centos_final?(node)).to be false
301
+ end
302
+ end
303
+
292
304
  describe '#debian_wheezy?' do
293
305
  it 'returns true when the version is a subset of the major' do
294
306
  node = { 'platform' => 'debian', 'platform_version' => '7.1' }
@@ -37,6 +37,23 @@ describe Chef::Sugar::Virtualization do
37
37
  end
38
38
  end
39
39
 
40
+ describe '#parallels?' do
41
+ it 'returns true when the machine is under parallels' do
42
+ node = { 'virtualization' => { 'system' => 'Parallels' } }
43
+ expect(described_class.parallels?(node)).to be true
44
+ end
45
+
46
+ it 'returns false when the virtual machine is not under parallels' do
47
+ node = { 'virtualization' => { 'system' => 'kvm' } }
48
+ expect(described_class.parallels?(node)).to be false
49
+ end
50
+
51
+ it 'returns false when the machine is not virtual' do
52
+ node = {}
53
+ expect(described_class.parallels?(node)).to be false
54
+ end
55
+ end
56
+
40
57
  describe '#virtualbox?' do
41
58
  it 'returns true when the machine is under virtualbox' do
42
59
  node = { 'virtualization' => { 'system' => 'vbox' } }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-17 00:00:00.000000000 Z
11
+ date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.7.6
175
+ rubygems_version: 2.7.7
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: A collection of helper methods and modules that make working with Chef recipes