chef-utils 17.10.0 → 17.10.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/Rakefile +15 -15
  4. data/chef-utils.gemspec +50 -50
  5. data/lib/chef-utils/dist.rb +151 -151
  6. data/lib/chef-utils/dsl/architecture.rb +150 -150
  7. data/lib/chef-utils/dsl/cloud.rb +155 -155
  8. data/lib/chef-utils/dsl/default_paths.rb +60 -60
  9. data/lib/chef-utils/dsl/introspection.rb +134 -134
  10. data/lib/chef-utils/dsl/os.rb +58 -58
  11. data/lib/chef-utils/dsl/path_sanity.rb +39 -39
  12. data/lib/chef-utils/dsl/platform.rb +387 -387
  13. data/lib/chef-utils/dsl/platform_family.rb +355 -355
  14. data/lib/chef-utils/dsl/platform_version.rb +41 -41
  15. data/lib/chef-utils/dsl/service.rb +112 -112
  16. data/lib/chef-utils/dsl/train_helpers.rb +87 -87
  17. data/lib/chef-utils/dsl/virtualization.rb +272 -272
  18. data/lib/chef-utils/dsl/which.rb +123 -123
  19. data/lib/chef-utils/dsl/windows.rb +86 -86
  20. data/lib/chef-utils/internal.rb +114 -114
  21. data/lib/chef-utils/mash.rb +263 -255
  22. data/lib/chef-utils/parallel_map.rb +131 -131
  23. data/lib/chef-utils/version.rb +20 -20
  24. data/lib/chef-utils/version_string.rb +160 -160
  25. data/lib/chef-utils.rb +53 -53
  26. data/spec/spec_helper.rb +100 -100
  27. data/spec/unit/dsl/architecture_spec.rb +151 -151
  28. data/spec/unit/dsl/cloud_spec.rb +93 -93
  29. data/spec/unit/dsl/dsl_spec.rb +34 -34
  30. data/spec/unit/dsl/introspection_spec.rb +201 -201
  31. data/spec/unit/dsl/os_spec.rb +175 -175
  32. data/spec/unit/dsl/path_sanity_spec.rb +86 -86
  33. data/spec/unit/dsl/platform_family_spec.rb +235 -235
  34. data/spec/unit/dsl/platform_spec.rb +252 -252
  35. data/spec/unit/dsl/service_spec.rb +117 -117
  36. data/spec/unit/dsl/virtualization_spec.rb +75 -75
  37. data/spec/unit/dsl/which_spec.rb +171 -171
  38. data/spec/unit/dsl/windows_spec.rb +84 -84
  39. data/spec/unit/mash_spec.rb +51 -51
  40. data/spec/unit/parallel_map_spec.rb +156 -156
  41. metadata +2 -2
@@ -1,387 +1,387 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require_relative "../internal"
20
-
21
- module ChefUtils
22
- module DSL
23
- module Platform
24
- include Internal
25
-
26
- # NOTE: if you are adding new platform helpers they should all have the `_platform?` suffix.
27
- # DO NOT add new short aliases without the suffix (they will be deprecated in the future)
28
- # aliases here are mostly for backwards compatibility with chef-sugar and new ones are DISCOURAGED.
29
- # generally there should be one obviously correct way to do things.
30
-
31
- # Determine if the current node is linux mint.
32
- #
33
- # @param [Chef::Node] node the node to check
34
- # @since 15.5
35
- #
36
- # @return [Boolean]
37
- #
38
- def linuxmint_platform?(node = __getnode)
39
- node["platform"] == "linuxmint"
40
- end
41
- # chef-sugar backcompat method
42
- alias_method :mint?, :linuxmint_platform?
43
- # chef-sugar backcompat method
44
- alias_method :linux_mint?, :linuxmint_platform?
45
- # chef-sugar backcompat method
46
- alias_method :linuxmint?, :linuxmint_platform?
47
-
48
- # Determine if the current node is Ubuntu.
49
- #
50
- # @param [Chef::Node] node the node to check
51
- # @since 15.5
52
- #
53
- # @return [Boolean]
54
- #
55
- def ubuntu_platform?(node = __getnode)
56
- node["platform"] == "ubuntu"
57
- end
58
- # chef-sugar backcompat method
59
- alias_method :ubuntu?, :ubuntu_platform?
60
-
61
- # Determine if the current node is Raspbian.
62
- #
63
- # @param [Chef::Node] node the node to check
64
- # @since 15.5
65
- #
66
- # @return [Boolean]
67
- #
68
- def raspbian_platform?(node = __getnode)
69
- node["platform"] == "raspbian"
70
- end
71
- # chef-sugar backcompat method
72
- alias_method :raspbian?, :raspbian_platform?
73
-
74
- # Determine if the current node is Debian.
75
- #
76
- # @param [Chef::Node] node the node to check
77
- # @since 15.5
78
- #
79
- # @return [Boolean]
80
- #
81
- def debian_platform?(node = __getnode)
82
- node["platform"] == "debian"
83
- end
84
-
85
- # Determine if the current node is Amazon Linux.
86
- #
87
- # @param [Chef::Node] node the node to check
88
- # @since 15.5
89
- #
90
- # @return [Boolean]
91
- #
92
- def amazon_platform?(node = __getnode)
93
- node["platform"] == "amazon"
94
- end
95
-
96
- # Determine if the current node is Red Hat Enterprise Linux.
97
- #
98
- # @param [Chef::Node] node the node to check
99
- # @since 15.5
100
- #
101
- # @return [Boolean]
102
- #
103
- def redhat_platform?(node = __getnode)
104
- node["platform"] == "redhat"
105
- end
106
- # chef-sugar backcompat method
107
- alias_method :redhat_enterprise?, :redhat_platform?
108
- # chef-sugar backcompat method
109
- alias_method :redhat_enterprise_linux?, :redhat_platform?
110
- # chef-sugar backcompat method
111
- alias_method :redhat?, :redhat_platform?
112
-
113
- # Determine if the current node is CentOS.
114
- #
115
- # @param [Chef::Node] node the node to check
116
- # @since 15.5
117
- #
118
- # @return [Boolean]
119
- #
120
- def centos_platform?(node = __getnode)
121
- node["platform"] == "centos"
122
- end
123
- # chef-sugar backcompat method
124
- alias_method :centos?, :centos_platform?
125
-
126
- # Determine if the current node is CentOS Stream.
127
- #
128
- # @param [Chef::Node] node the node to check
129
- # @since 17.0
130
- #
131
- # @return [Boolean]
132
- #
133
- def centos_stream_platform?(node = __getnode)
134
- if node["os_release"]
135
- node.dig("os_release", "name") == "CentOS Stream"
136
- else
137
- node.dig("lsb", "id") == "CentOSStream"
138
- end
139
- end
140
-
141
- # Determine if the current node is Oracle Linux.
142
- #
143
- # @param [Chef::Node] node the node to check
144
- # @since 15.5
145
- #
146
- # @return [Boolean]
147
- #
148
- def oracle_platform?(node = __getnode)
149
- node["platform"] == "oracle"
150
- end
151
- # chef-sugar backcompat method
152
- alias_method :oracle_linux?, :oracle_platform?
153
- # chef-sugar backcompat method
154
- alias_method :oracle?, :oracle_platform?
155
-
156
- # Determine if the current node is Scientific Linux.
157
- #
158
- # @param [Chef::Node] node the node to check
159
- # @since 15.5
160
- #
161
- # @return [Boolean]
162
- #
163
- def scientific_platform?(node = __getnode)
164
- node["platform"] == "scientific"
165
- end
166
- # chef-sugar backcompat method
167
- alias_method :scientific_linux?, :scientific_platform?
168
- # chef-sugar backcompat method
169
- alias_method :scientific?, :scientific_platform?
170
-
171
- # Determine if the current node is ClearOS.
172
- #
173
- # @param [Chef::Node] node the node to check
174
- # @since 15.5
175
- #
176
- # @return [Boolean]
177
- #
178
- def clearos_platform?(node = __getnode)
179
- node["platform"] == "clearos"
180
- end
181
- # chef-sugar backcompat method
182
- alias_method :clearos?, :clearos_platform?
183
-
184
- # Determine if the current node is Fedora.
185
- #
186
- # @param [Chef::Node] node the node to check
187
- # @since 15.5
188
- #
189
- # @return [Boolean]
190
- #
191
- def fedora_platform?(node = __getnode)
192
- node["platform"] == "fedora"
193
- end
194
-
195
- # Determine if the current node is Arch Linux
196
- #
197
- # @param [Chef::Node] node the node to check
198
- # @since 15.5
199
- #
200
- # @return [Boolean]
201
- #
202
- def arch_platform?(node = __getnode)
203
- node["platform"] == "arch"
204
- end
205
-
206
- # Determine if the current node is Solaris2.
207
- #
208
- # @param [Chef::Node] node the node to check
209
- # @since 15.5
210
- #
211
- # @return [Boolean]
212
- #
213
- def solaris2_platform?(node = __getnode)
214
- node["platform"] == "solaris2"
215
- end
216
-
217
- # Determine if the current node is SmartOS.
218
- #
219
- # @param [Chef::Node] node the node to check
220
- # @since 15.5
221
- #
222
- # @return [Boolean]
223
- #
224
- def smartos_platform?(node = __getnode)
225
- node["platform"] == "smartos"
226
- end
227
-
228
- # Determine if the current node is OmniOS.
229
- #
230
- # @param [Chef::Node] node the node to check
231
- # @since 15.5
232
- #
233
- # @return [Boolean]
234
- #
235
- def omnios_platform?(node = __getnode)
236
- node["platform"] == "omnios"
237
- end
238
- # chef-sugar backcompat method
239
- alias_method :omnios?, :omnios_platform?
240
-
241
- # Determine if the current node is OpenIndiana.
242
- #
243
- # @param [Chef::Node] node the node to check
244
- # @since 15.5
245
- #
246
- # @return [Boolean]
247
- #
248
- def openindiana_platform?(node = __getnode)
249
- node["platform"] == "openindiana"
250
- end
251
- # chef-sugar backcompat method
252
- alias_method :openindiana?, :openindiana_platform?
253
-
254
- # Determine if the current node is AIX.
255
- #
256
- # @param [Chef::Node] node the node to check
257
- # @since 15.5
258
- #
259
- # @return [Boolean]
260
- #
261
- def aix_platform?(node = __getnode)
262
- node["platform"] == "aix"
263
- end
264
-
265
- # Determine if the current node is FreeBSD.
266
- #
267
- # @param [Chef::Node] node the node to check
268
- # @since 15.5
269
- #
270
- # @return [Boolean]
271
- #
272
- def freebsd_platform?(node = __getnode)
273
- node["platform"] == "freebsd"
274
- end
275
-
276
- # Determine if the current node is OpenBSD.
277
- #
278
- # @param [Chef::Node] node the node to check
279
- # @since 15.5
280
- #
281
- # @return [Boolean]
282
- #
283
- def openbsd_platform?(node = __getnode)
284
- node["platform"] == "openbsd"
285
- end
286
-
287
- # Determine if the current node is NetBSD.
288
- #
289
- # @param [Chef::Node] node the node to check
290
- # @since 15.5
291
- #
292
- # @return [Boolean]
293
- #
294
- def netbsd_platform?(node = __getnode)
295
- node["platform"] == "netbsd"
296
- end
297
-
298
- # Determine if the current node is DragonFly BSD.
299
- #
300
- # @param [Chef::Node] node the node to check
301
- # @since 15.5
302
- #
303
- # @return [Boolean]
304
- #
305
- def dragonfly_platform?(node = __getnode)
306
- node["platform"] == "dragonfly"
307
- end
308
-
309
- # Determine if the current node is macOS.
310
- #
311
- # @param [Chef::Node] node the node to check
312
- # @since 15.5
313
- #
314
- # @return [Boolean]
315
- #
316
- def macos_platform?(node = __getnode)
317
- node["platform"] == "mac_os_x"
318
- end
319
- # chef-sugar backcompat method
320
- alias_method :mac_os_x_platform?, :macos_platform?
321
-
322
- # Determine if the current node is Gentoo.
323
- #
324
- # @param [Chef::Node] node the node to check
325
- # @since 15.5
326
- #
327
- # @return [Boolean]
328
- #
329
- def gentoo_platform?(node = __getnode)
330
- node["platform"] == "gentoo"
331
- end
332
-
333
- # Determine if the current node is Slackware.
334
- #
335
- # @param [Chef::Node] node the node to check
336
- # @since 15.5
337
- #
338
- # @return [Boolean]
339
- #
340
- def slackware_platform?(node = __getnode)
341
- node["platform"] == "slackware"
342
- end
343
-
344
- # Determine if the current node is SuSE.
345
- #
346
- # @param [Chef::Node] node the node to check
347
- # @since 15.5
348
- #
349
- # @return [Boolean]
350
- #
351
- def suse_platform?(node = __getnode)
352
- node["platform"] == "suse"
353
- end
354
-
355
- # Determine if the current node is openSUSE.
356
- #
357
- # @param [Chef::Node] node the node to check
358
- # @since 15.5
359
- #
360
- # @return [Boolean]
361
- #
362
- def opensuse_platform?(node = __getnode)
363
- node["platform"] == "opensuse" || node["platform"] == "opensuseleap"
364
- end
365
- # chef-sugar backcompat method
366
- alias_method :opensuse?, :opensuse_platform?
367
- # chef-sugar backcompat method
368
- alias_method :opensuseleap_platform?, :opensuse_platform?
369
- # chef-sugar backcompat method
370
- alias_method :leap_platform?, :opensuse_platform?
371
- # NOTE: to anyone adding :tumbleweed_platform? - :[opensuse]leap_platform? should be false on tumbleweed, :opensuse[_platform]? should be true
372
-
373
- # Determine if the current node is Windows.
374
- #
375
- # @param [Chef::Node] node the node to check
376
- # @since 15.5
377
- #
378
- # @return [Boolean]
379
- #
380
- def windows_platform?(node = __getnode)
381
- node["platform"] == "windows"
382
- end
383
-
384
- extend self
385
- end
386
- end
387
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require_relative "../internal"
20
+
21
+ module ChefUtils
22
+ module DSL
23
+ module Platform
24
+ include Internal
25
+
26
+ # NOTE: if you are adding new platform helpers they should all have the `_platform?` suffix.
27
+ # DO NOT add new short aliases without the suffix (they will be deprecated in the future)
28
+ # aliases here are mostly for backwards compatibility with chef-sugar and new ones are DISCOURAGED.
29
+ # generally there should be one obviously correct way to do things.
30
+
31
+ # Determine if the current node is linux mint.
32
+ #
33
+ # @param [Chef::Node] node the node to check
34
+ # @since 15.5
35
+ #
36
+ # @return [Boolean]
37
+ #
38
+ def linuxmint_platform?(node = __getnode)
39
+ node["platform"] == "linuxmint"
40
+ end
41
+ # chef-sugar backcompat method
42
+ alias_method :mint?, :linuxmint_platform?
43
+ # chef-sugar backcompat method
44
+ alias_method :linux_mint?, :linuxmint_platform?
45
+ # chef-sugar backcompat method
46
+ alias_method :linuxmint?, :linuxmint_platform?
47
+
48
+ # Determine if the current node is Ubuntu.
49
+ #
50
+ # @param [Chef::Node] node the node to check
51
+ # @since 15.5
52
+ #
53
+ # @return [Boolean]
54
+ #
55
+ def ubuntu_platform?(node = __getnode)
56
+ node["platform"] == "ubuntu"
57
+ end
58
+ # chef-sugar backcompat method
59
+ alias_method :ubuntu?, :ubuntu_platform?
60
+
61
+ # Determine if the current node is Raspbian.
62
+ #
63
+ # @param [Chef::Node] node the node to check
64
+ # @since 15.5
65
+ #
66
+ # @return [Boolean]
67
+ #
68
+ def raspbian_platform?(node = __getnode)
69
+ node["platform"] == "raspbian"
70
+ end
71
+ # chef-sugar backcompat method
72
+ alias_method :raspbian?, :raspbian_platform?
73
+
74
+ # Determine if the current node is Debian.
75
+ #
76
+ # @param [Chef::Node] node the node to check
77
+ # @since 15.5
78
+ #
79
+ # @return [Boolean]
80
+ #
81
+ def debian_platform?(node = __getnode)
82
+ node["platform"] == "debian"
83
+ end
84
+
85
+ # Determine if the current node is Amazon Linux.
86
+ #
87
+ # @param [Chef::Node] node the node to check
88
+ # @since 15.5
89
+ #
90
+ # @return [Boolean]
91
+ #
92
+ def amazon_platform?(node = __getnode)
93
+ node["platform"] == "amazon"
94
+ end
95
+
96
+ # Determine if the current node is Red Hat Enterprise Linux.
97
+ #
98
+ # @param [Chef::Node] node the node to check
99
+ # @since 15.5
100
+ #
101
+ # @return [Boolean]
102
+ #
103
+ def redhat_platform?(node = __getnode)
104
+ node["platform"] == "redhat"
105
+ end
106
+ # chef-sugar backcompat method
107
+ alias_method :redhat_enterprise?, :redhat_platform?
108
+ # chef-sugar backcompat method
109
+ alias_method :redhat_enterprise_linux?, :redhat_platform?
110
+ # chef-sugar backcompat method
111
+ alias_method :redhat?, :redhat_platform?
112
+
113
+ # Determine if the current node is CentOS.
114
+ #
115
+ # @param [Chef::Node] node the node to check
116
+ # @since 15.5
117
+ #
118
+ # @return [Boolean]
119
+ #
120
+ def centos_platform?(node = __getnode)
121
+ node["platform"] == "centos"
122
+ end
123
+ # chef-sugar backcompat method
124
+ alias_method :centos?, :centos_platform?
125
+
126
+ # Determine if the current node is CentOS Stream.
127
+ #
128
+ # @param [Chef::Node] node the node to check
129
+ # @since 17.0
130
+ #
131
+ # @return [Boolean]
132
+ #
133
+ def centos_stream_platform?(node = __getnode)
134
+ if node["os_release"]
135
+ node.dig("os_release", "name") == "CentOS Stream"
136
+ else
137
+ node.dig("lsb", "id") == "CentOSStream"
138
+ end
139
+ end
140
+
141
+ # Determine if the current node is Oracle Linux.
142
+ #
143
+ # @param [Chef::Node] node the node to check
144
+ # @since 15.5
145
+ #
146
+ # @return [Boolean]
147
+ #
148
+ def oracle_platform?(node = __getnode)
149
+ node["platform"] == "oracle"
150
+ end
151
+ # chef-sugar backcompat method
152
+ alias_method :oracle_linux?, :oracle_platform?
153
+ # chef-sugar backcompat method
154
+ alias_method :oracle?, :oracle_platform?
155
+
156
+ # Determine if the current node is Scientific Linux.
157
+ #
158
+ # @param [Chef::Node] node the node to check
159
+ # @since 15.5
160
+ #
161
+ # @return [Boolean]
162
+ #
163
+ def scientific_platform?(node = __getnode)
164
+ node["platform"] == "scientific"
165
+ end
166
+ # chef-sugar backcompat method
167
+ alias_method :scientific_linux?, :scientific_platform?
168
+ # chef-sugar backcompat method
169
+ alias_method :scientific?, :scientific_platform?
170
+
171
+ # Determine if the current node is ClearOS.
172
+ #
173
+ # @param [Chef::Node] node the node to check
174
+ # @since 15.5
175
+ #
176
+ # @return [Boolean]
177
+ #
178
+ def clearos_platform?(node = __getnode)
179
+ node["platform"] == "clearos"
180
+ end
181
+ # chef-sugar backcompat method
182
+ alias_method :clearos?, :clearos_platform?
183
+
184
+ # Determine if the current node is Fedora.
185
+ #
186
+ # @param [Chef::Node] node the node to check
187
+ # @since 15.5
188
+ #
189
+ # @return [Boolean]
190
+ #
191
+ def fedora_platform?(node = __getnode)
192
+ node["platform"] == "fedora"
193
+ end
194
+
195
+ # Determine if the current node is Arch Linux
196
+ #
197
+ # @param [Chef::Node] node the node to check
198
+ # @since 15.5
199
+ #
200
+ # @return [Boolean]
201
+ #
202
+ def arch_platform?(node = __getnode)
203
+ node["platform"] == "arch"
204
+ end
205
+
206
+ # Determine if the current node is Solaris2.
207
+ #
208
+ # @param [Chef::Node] node the node to check
209
+ # @since 15.5
210
+ #
211
+ # @return [Boolean]
212
+ #
213
+ def solaris2_platform?(node = __getnode)
214
+ node["platform"] == "solaris2"
215
+ end
216
+
217
+ # Determine if the current node is SmartOS.
218
+ #
219
+ # @param [Chef::Node] node the node to check
220
+ # @since 15.5
221
+ #
222
+ # @return [Boolean]
223
+ #
224
+ def smartos_platform?(node = __getnode)
225
+ node["platform"] == "smartos"
226
+ end
227
+
228
+ # Determine if the current node is OmniOS.
229
+ #
230
+ # @param [Chef::Node] node the node to check
231
+ # @since 15.5
232
+ #
233
+ # @return [Boolean]
234
+ #
235
+ def omnios_platform?(node = __getnode)
236
+ node["platform"] == "omnios"
237
+ end
238
+ # chef-sugar backcompat method
239
+ alias_method :omnios?, :omnios_platform?
240
+
241
+ # Determine if the current node is OpenIndiana.
242
+ #
243
+ # @param [Chef::Node] node the node to check
244
+ # @since 15.5
245
+ #
246
+ # @return [Boolean]
247
+ #
248
+ def openindiana_platform?(node = __getnode)
249
+ node["platform"] == "openindiana"
250
+ end
251
+ # chef-sugar backcompat method
252
+ alias_method :openindiana?, :openindiana_platform?
253
+
254
+ # Determine if the current node is AIX.
255
+ #
256
+ # @param [Chef::Node] node the node to check
257
+ # @since 15.5
258
+ #
259
+ # @return [Boolean]
260
+ #
261
+ def aix_platform?(node = __getnode)
262
+ node["platform"] == "aix"
263
+ end
264
+
265
+ # Determine if the current node is FreeBSD.
266
+ #
267
+ # @param [Chef::Node] node the node to check
268
+ # @since 15.5
269
+ #
270
+ # @return [Boolean]
271
+ #
272
+ def freebsd_platform?(node = __getnode)
273
+ node["platform"] == "freebsd"
274
+ end
275
+
276
+ # Determine if the current node is OpenBSD.
277
+ #
278
+ # @param [Chef::Node] node the node to check
279
+ # @since 15.5
280
+ #
281
+ # @return [Boolean]
282
+ #
283
+ def openbsd_platform?(node = __getnode)
284
+ node["platform"] == "openbsd"
285
+ end
286
+
287
+ # Determine if the current node is NetBSD.
288
+ #
289
+ # @param [Chef::Node] node the node to check
290
+ # @since 15.5
291
+ #
292
+ # @return [Boolean]
293
+ #
294
+ def netbsd_platform?(node = __getnode)
295
+ node["platform"] == "netbsd"
296
+ end
297
+
298
+ # Determine if the current node is DragonFly BSD.
299
+ #
300
+ # @param [Chef::Node] node the node to check
301
+ # @since 15.5
302
+ #
303
+ # @return [Boolean]
304
+ #
305
+ def dragonfly_platform?(node = __getnode)
306
+ node["platform"] == "dragonfly"
307
+ end
308
+
309
+ # Determine if the current node is macOS.
310
+ #
311
+ # @param [Chef::Node] node the node to check
312
+ # @since 15.5
313
+ #
314
+ # @return [Boolean]
315
+ #
316
+ def macos_platform?(node = __getnode)
317
+ node["platform"] == "mac_os_x"
318
+ end
319
+ # chef-sugar backcompat method
320
+ alias_method :mac_os_x_platform?, :macos_platform?
321
+
322
+ # Determine if the current node is Gentoo.
323
+ #
324
+ # @param [Chef::Node] node the node to check
325
+ # @since 15.5
326
+ #
327
+ # @return [Boolean]
328
+ #
329
+ def gentoo_platform?(node = __getnode)
330
+ node["platform"] == "gentoo"
331
+ end
332
+
333
+ # Determine if the current node is Slackware.
334
+ #
335
+ # @param [Chef::Node] node the node to check
336
+ # @since 15.5
337
+ #
338
+ # @return [Boolean]
339
+ #
340
+ def slackware_platform?(node = __getnode)
341
+ node["platform"] == "slackware"
342
+ end
343
+
344
+ # Determine if the current node is SuSE.
345
+ #
346
+ # @param [Chef::Node] node the node to check
347
+ # @since 15.5
348
+ #
349
+ # @return [Boolean]
350
+ #
351
+ def suse_platform?(node = __getnode)
352
+ node["platform"] == "suse"
353
+ end
354
+
355
+ # Determine if the current node is openSUSE.
356
+ #
357
+ # @param [Chef::Node] node the node to check
358
+ # @since 15.5
359
+ #
360
+ # @return [Boolean]
361
+ #
362
+ def opensuse_platform?(node = __getnode)
363
+ node["platform"] == "opensuse" || node["platform"] == "opensuseleap"
364
+ end
365
+ # chef-sugar backcompat method
366
+ alias_method :opensuse?, :opensuse_platform?
367
+ # chef-sugar backcompat method
368
+ alias_method :opensuseleap_platform?, :opensuse_platform?
369
+ # chef-sugar backcompat method
370
+ alias_method :leap_platform?, :opensuse_platform?
371
+ # NOTE: to anyone adding :tumbleweed_platform? - :[opensuse]leap_platform? should be false on tumbleweed, :opensuse[_platform]? should be true
372
+
373
+ # Determine if the current node is Windows.
374
+ #
375
+ # @param [Chef::Node] node the node to check
376
+ # @since 15.5
377
+ #
378
+ # @return [Boolean]
379
+ #
380
+ def windows_platform?(node = __getnode)
381
+ node["platform"] == "windows"
382
+ end
383
+
384
+ extend self
385
+ end
386
+ end
387
+ end