chef-utils 15.7.32 → 15.11.8
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 +4 -4
- data/lib/chef-utils.rb +11 -4
- data/lib/chef-utils/dsl/architecture.rb +42 -10
- data/lib/chef-utils/dsl/cloud.rb +143 -0
- data/lib/chef-utils/dsl/introspection.rb +24 -5
- data/lib/chef-utils/dsl/os.rb +7 -5
- data/lib/chef-utils/dsl/path_sanity.rb +2 -1
- data/lib/chef-utils/dsl/platform.rb +135 -90
- data/lib/chef-utils/dsl/platform_family.rb +70 -39
- data/lib/chef-utils/dsl/platform_version.rb +40 -0
- data/lib/chef-utils/dsl/service.rb +20 -1
- data/lib/chef-utils/dsl/train_helpers.rb +2 -2
- data/lib/chef-utils/dsl/virtualization.rb +249 -0
- data/lib/chef-utils/dsl/which.rb +1 -1
- data/lib/chef-utils/dsl/windows.rb +33 -6
- data/lib/chef-utils/internal.rb +1 -1
- data/lib/chef-utils/version.rb +2 -2
- data/lib/chef-utils/version_string.rb +6 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/unit/dsl/architecture_spec.rb +16 -5
- data/spec/unit/dsl/cloud_spec.rb +88 -0
- data/spec/unit/dsl/dsl_spec.rb +1 -1
- data/spec/unit/dsl/introspection_spec.rb +20 -1
- data/spec/unit/dsl/os_spec.rb +1 -1
- data/spec/unit/dsl/path_sanity_spec.rb +1 -1
- data/spec/unit/dsl/platform_family_spec.rb +1 -1
- data/spec/unit/dsl/platform_spec.rb +1 -1
- data/spec/unit/dsl/service_spec.rb +1 -1
- data/spec/unit/dsl/virtualization_spec.rb +74 -0
- data/spec/unit/dsl/which_spec.rb +1 -1
- data/spec/unit/dsl/windows_spec.rb +32 -12
- data/spec/unit/mash_spec.rb +1 -1
- metadata +7 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -29,43 +29,51 @@ module ChefUtils
|
|
29
29
|
|
30
30
|
# Determine if the current node is linux mint.
|
31
31
|
#
|
32
|
-
# @param [Chef::Node] node
|
32
|
+
# @param [Chef::Node] node the node to check
|
33
|
+
# @since 15.5
|
33
34
|
#
|
34
35
|
# @return [Boolean]
|
35
36
|
#
|
36
|
-
def
|
37
|
+
def linuxmint_platform?(node = __getnode)
|
37
38
|
node["platform"] == "linuxmint"
|
38
39
|
end
|
39
|
-
# chef-sugar backcompat
|
40
|
-
alias_method :mint?, :
|
41
|
-
|
42
|
-
alias_method :
|
40
|
+
# chef-sugar backcompat method
|
41
|
+
alias_method :mint?, :linuxmint_platform?
|
42
|
+
# chef-sugar backcompat method
|
43
|
+
alias_method :linux_mint?, :linuxmint_platform?
|
44
|
+
# chef-sugar backcompat method
|
45
|
+
alias_method :linuxmint?, :linuxmint_platform?
|
43
46
|
|
44
|
-
# Determine if the current node is
|
47
|
+
# Determine if the current node is Ubuntu.
|
45
48
|
#
|
46
|
-
# @param [Chef::Node] node
|
49
|
+
# @param [Chef::Node] node the node to check
|
50
|
+
# @since 15.5
|
47
51
|
#
|
48
52
|
# @return [Boolean]
|
49
53
|
#
|
50
|
-
def
|
54
|
+
def ubuntu_platform?(node = __getnode)
|
51
55
|
node["platform"] == "ubuntu"
|
52
56
|
end
|
53
|
-
|
57
|
+
# chef-sugar backcompat method
|
58
|
+
alias_method :ubuntu?, :ubuntu_platform?
|
54
59
|
|
55
|
-
# Determine if the current node is
|
60
|
+
# Determine if the current node is Raspbian.
|
56
61
|
#
|
57
|
-
# @param [Chef::Node] node
|
62
|
+
# @param [Chef::Node] node the node to check
|
63
|
+
# @since 15.5
|
58
64
|
#
|
59
65
|
# @return [Boolean]
|
60
66
|
#
|
61
|
-
def
|
67
|
+
def raspbian_platform?(node = __getnode)
|
62
68
|
node["platform"] == "raspbian"
|
63
69
|
end
|
64
|
-
|
70
|
+
# chef-sugar backcompat method
|
71
|
+
alias_method :raspbian?, :raspbian_platform?
|
65
72
|
|
66
|
-
# Determine if the current node is
|
73
|
+
# Determine if the current node is Debian.
|
67
74
|
#
|
68
|
-
# @param [Chef::Node] node
|
75
|
+
# @param [Chef::Node] node the node to check
|
76
|
+
# @since 15.5
|
69
77
|
#
|
70
78
|
# @return [Boolean]
|
71
79
|
#
|
@@ -73,9 +81,10 @@ module ChefUtils
|
|
73
81
|
node["platform"] == "debian"
|
74
82
|
end
|
75
83
|
|
76
|
-
# Determine if the current node is
|
84
|
+
# Determine if the current node is Amazon Linux.
|
77
85
|
#
|
78
|
-
# @param [Chef::Node] node
|
86
|
+
# @param [Chef::Node] node the node to check
|
87
|
+
# @since 15.5
|
79
88
|
#
|
80
89
|
# @return [Boolean]
|
81
90
|
#
|
@@ -83,71 +92,83 @@ module ChefUtils
|
|
83
92
|
node["platform"] == "amazon"
|
84
93
|
end
|
85
94
|
|
86
|
-
# Determine if the current node is
|
95
|
+
# Determine if the current node is Red Hat Enterprise Linux.
|
87
96
|
#
|
88
|
-
# @param [Chef::Node] node
|
97
|
+
# @param [Chef::Node] node the node to check
|
98
|
+
# @since 15.5
|
89
99
|
#
|
90
100
|
# @return [Boolean]
|
91
101
|
#
|
92
|
-
def
|
102
|
+
def redhat_platform?(node = __getnode)
|
93
103
|
node["platform"] == "redhat"
|
94
104
|
end
|
95
|
-
# chef-sugar backcompat
|
96
|
-
alias_method :redhat_enterprise?, :
|
97
|
-
|
98
|
-
alias_method :
|
105
|
+
# chef-sugar backcompat method
|
106
|
+
alias_method :redhat_enterprise?, :redhat_platform?
|
107
|
+
# chef-sugar backcompat method
|
108
|
+
alias_method :redhat_enterprise_linux?, :redhat_platform?
|
109
|
+
# chef-sugar backcompat method
|
110
|
+
alias_method :redhat?, :redhat_platform?
|
99
111
|
|
100
|
-
# Determine if the current node is
|
112
|
+
# Determine if the current node is CentOS.
|
101
113
|
#
|
102
|
-
# @param [Chef::Node] node
|
114
|
+
# @param [Chef::Node] node the node to check
|
115
|
+
# @since 15.5
|
103
116
|
#
|
104
117
|
# @return [Boolean]
|
105
118
|
#
|
106
|
-
def
|
119
|
+
def centos_platform?(node = __getnode)
|
107
120
|
node["platform"] == "centos"
|
108
121
|
end
|
109
|
-
|
122
|
+
# chef-sugar backcompat method
|
123
|
+
alias_method :centos?, :centos_platform?
|
110
124
|
|
111
|
-
# Determine if the current node is
|
125
|
+
# Determine if the current node is Oracle Linux.
|
112
126
|
#
|
113
|
-
# @param [Chef::Node] node
|
127
|
+
# @param [Chef::Node] node the node to check
|
128
|
+
# @since 15.5
|
114
129
|
#
|
115
130
|
# @return [Boolean]
|
116
131
|
#
|
117
|
-
def
|
132
|
+
def oracle_platform?(node = __getnode)
|
118
133
|
node["platform"] == "oracle"
|
119
134
|
end
|
120
|
-
# chef-sugar backcompat
|
121
|
-
alias_method :oracle_linux?, :
|
122
|
-
|
135
|
+
# chef-sugar backcompat method
|
136
|
+
alias_method :oracle_linux?, :oracle_platform?
|
137
|
+
# chef-sugar backcompat method
|
138
|
+
alias_method :oracle?, :oracle_platform?
|
123
139
|
|
124
|
-
# Determine if the current node is
|
140
|
+
# Determine if the current node is Scientific Linux.
|
125
141
|
#
|
126
|
-
# @param [Chef::Node] node
|
142
|
+
# @param [Chef::Node] node the node to check
|
143
|
+
# @since 15.5
|
127
144
|
#
|
128
145
|
# @return [Boolean]
|
129
146
|
#
|
130
|
-
def
|
147
|
+
def scientific_platform?(node = __getnode)
|
131
148
|
node["platform"] == "scientific"
|
132
149
|
end
|
133
|
-
# chef-sugar backcompat
|
134
|
-
alias_method :scientific_linux?, :
|
135
|
-
|
150
|
+
# chef-sugar backcompat method
|
151
|
+
alias_method :scientific_linux?, :scientific_platform?
|
152
|
+
# chef-sugar backcompat method
|
153
|
+
alias_method :scientific?, :scientific_platform?
|
136
154
|
|
137
|
-
# Determine if the current node is
|
155
|
+
# Determine if the current node is ClearOS.
|
138
156
|
#
|
139
|
-
# @param [Chef::Node] node
|
157
|
+
# @param [Chef::Node] node the node to check
|
158
|
+
# @since 15.5
|
140
159
|
#
|
141
160
|
# @return [Boolean]
|
142
161
|
#
|
143
|
-
def
|
162
|
+
def clearos_platform?(node = __getnode)
|
144
163
|
node["platform"] == "clearos"
|
145
164
|
end
|
146
|
-
|
165
|
+
# chef-sugar backcompat method
|
166
|
+
alias_method :clearos?, :clearos_platform?
|
147
167
|
|
148
|
-
# Determine if the current node is
|
168
|
+
# Determine if the current node is Fedora.
|
149
169
|
#
|
150
|
-
# @param [Chef::Node] node
|
170
|
+
# @param [Chef::Node] node the node to check
|
171
|
+
# @since 15.5
|
151
172
|
#
|
152
173
|
# @return [Boolean]
|
153
174
|
#
|
@@ -155,9 +176,10 @@ module ChefUtils
|
|
155
176
|
node["platform"] == "fedora"
|
156
177
|
end
|
157
178
|
|
158
|
-
# Determine if the current node is
|
179
|
+
# Determine if the current node is Arch Linux
|
159
180
|
#
|
160
|
-
# @param [Chef::Node] node
|
181
|
+
# @param [Chef::Node] node the node to check
|
182
|
+
# @since 15.5
|
161
183
|
#
|
162
184
|
# @return [Boolean]
|
163
185
|
#
|
@@ -165,9 +187,10 @@ module ChefUtils
|
|
165
187
|
node["platform"] == "arch"
|
166
188
|
end
|
167
189
|
|
168
|
-
# Determine if the current node is
|
190
|
+
# Determine if the current node is Solaris2.
|
169
191
|
#
|
170
|
-
# @param [Chef::Node] node
|
192
|
+
# @param [Chef::Node] node the node to check
|
193
|
+
# @since 15.5
|
171
194
|
#
|
172
195
|
# @return [Boolean]
|
173
196
|
#
|
@@ -175,9 +198,10 @@ module ChefUtils
|
|
175
198
|
node["platform"] == "solaris2"
|
176
199
|
end
|
177
200
|
|
178
|
-
# Determine if the current node is
|
201
|
+
# Determine if the current node is SmartOS.
|
179
202
|
#
|
180
|
-
# @param [Chef::Node] node
|
203
|
+
# @param [Chef::Node] node the node to check
|
204
|
+
# @since 15.5
|
181
205
|
#
|
182
206
|
# @return [Boolean]
|
183
207
|
#
|
@@ -185,42 +209,49 @@ module ChefUtils
|
|
185
209
|
node["platform"] == "smartos"
|
186
210
|
end
|
187
211
|
|
188
|
-
# Determine if the current node is
|
212
|
+
# Determine if the current node is OmniOS.
|
189
213
|
#
|
190
|
-
# @param [Chef::Node] node
|
214
|
+
# @param [Chef::Node] node the node to check
|
215
|
+
# @since 15.5
|
191
216
|
#
|
192
217
|
# @return [Boolean]
|
193
218
|
#
|
194
|
-
def
|
219
|
+
def omnios_platform?(node = __getnode)
|
195
220
|
node["platform"] == "omnios"
|
196
221
|
end
|
197
|
-
|
222
|
+
# chef-sugar backcompat method
|
223
|
+
alias_method :omnios?, :omnios_platform?
|
198
224
|
|
199
|
-
# Determine if the current node is
|
225
|
+
# Determine if the current node is OpenIndiana.
|
200
226
|
#
|
201
|
-
# @param [Chef::Node] node
|
227
|
+
# @param [Chef::Node] node the node to check
|
228
|
+
# @since 15.5
|
202
229
|
#
|
203
230
|
# @return [Boolean]
|
204
231
|
#
|
205
|
-
def
|
232
|
+
def openindiana_platform?(node = __getnode)
|
206
233
|
node["platform"] == "openindiana"
|
207
234
|
end
|
208
|
-
|
235
|
+
# chef-sugar backcompat method
|
236
|
+
alias_method :openindiana?, :openindiana_platform?
|
209
237
|
|
210
|
-
# Determine if the current node is
|
238
|
+
# Determine if the current node is Nexenta Core Platform aka Nexenta OS.
|
211
239
|
#
|
212
|
-
# @param [Chef::Node] node
|
240
|
+
# @param [Chef::Node] node the node to check
|
241
|
+
# @since 15.5
|
213
242
|
#
|
214
243
|
# @return [Boolean]
|
215
244
|
#
|
216
|
-
def
|
245
|
+
def nexentacore_platform?(node = __getnode)
|
217
246
|
node["platform"] == "nexentacore"
|
218
247
|
end
|
219
|
-
|
248
|
+
# chef-sugar backcompat method
|
249
|
+
alias_method :nexentacore?, :nexentacore_platform?
|
220
250
|
|
221
|
-
# Determine if the current node is
|
251
|
+
# Determine if the current node is AIX.
|
222
252
|
#
|
223
|
-
# @param [Chef::Node] node
|
253
|
+
# @param [Chef::Node] node the node to check
|
254
|
+
# @since 15.5
|
224
255
|
#
|
225
256
|
# @return [Boolean]
|
226
257
|
#
|
@@ -228,9 +259,10 @@ module ChefUtils
|
|
228
259
|
node["platform"] == "aix"
|
229
260
|
end
|
230
261
|
|
231
|
-
# Determine if the current node is
|
262
|
+
# Determine if the current node is FreeBSD.
|
232
263
|
#
|
233
|
-
# @param [Chef::Node] node
|
264
|
+
# @param [Chef::Node] node the node to check
|
265
|
+
# @since 15.5
|
234
266
|
#
|
235
267
|
# @return [Boolean]
|
236
268
|
#
|
@@ -238,9 +270,10 @@ module ChefUtils
|
|
238
270
|
node["platform"] == "freebsd"
|
239
271
|
end
|
240
272
|
|
241
|
-
# Determine if the current node is
|
273
|
+
# Determine if the current node is OpenBSD.
|
242
274
|
#
|
243
|
-
# @param [Chef::Node] node
|
275
|
+
# @param [Chef::Node] node the node to check
|
276
|
+
# @since 15.5
|
244
277
|
#
|
245
278
|
# @return [Boolean]
|
246
279
|
#
|
@@ -248,9 +281,10 @@ module ChefUtils
|
|
248
281
|
node["platform"] == "openbsd"
|
249
282
|
end
|
250
283
|
|
251
|
-
# Determine if the current node is
|
284
|
+
# Determine if the current node is NetBSD.
|
252
285
|
#
|
253
|
-
# @param [Chef::Node] node
|
286
|
+
# @param [Chef::Node] node the node to check
|
287
|
+
# @since 15.5
|
254
288
|
#
|
255
289
|
# @return [Boolean]
|
256
290
|
#
|
@@ -258,9 +292,10 @@ module ChefUtils
|
|
258
292
|
node["platform"] == "netbsd"
|
259
293
|
end
|
260
294
|
|
261
|
-
# Determine if the current node is
|
295
|
+
# Determine if the current node is DragonFly BSD.
|
262
296
|
#
|
263
|
-
# @param [Chef::Node] node
|
297
|
+
# @param [Chef::Node] node the node to check
|
298
|
+
# @since 15.5
|
264
299
|
#
|
265
300
|
# @return [Boolean]
|
266
301
|
#
|
@@ -268,20 +303,23 @@ module ChefUtils
|
|
268
303
|
node["platform"] == "dragonfly"
|
269
304
|
end
|
270
305
|
|
271
|
-
# Determine if the current node is
|
306
|
+
# Determine if the current node is macOS.
|
272
307
|
#
|
273
|
-
# @param [Chef::Node] node
|
308
|
+
# @param [Chef::Node] node the node to check
|
309
|
+
# @since 15.5
|
274
310
|
#
|
275
311
|
# @return [Boolean]
|
276
312
|
#
|
277
313
|
def macos_platform?(node = __getnode)
|
278
314
|
node["platform"] == "mac_os_x"
|
279
315
|
end
|
316
|
+
# chef-sugar backcompat method
|
280
317
|
alias_method :mac_os_x_platform?, :macos_platform?
|
281
318
|
|
282
|
-
# Determine if the current node is
|
319
|
+
# Determine if the current node is Gentoo.
|
283
320
|
#
|
284
|
-
# @param [Chef::Node] node
|
321
|
+
# @param [Chef::Node] node the node to check
|
322
|
+
# @since 15.5
|
285
323
|
#
|
286
324
|
# @return [Boolean]
|
287
325
|
#
|
@@ -289,9 +327,10 @@ module ChefUtils
|
|
289
327
|
node["platform"] == "gentoo"
|
290
328
|
end
|
291
329
|
|
292
|
-
# Determine if the current node is
|
330
|
+
# Determine if the current node is Slackware.
|
293
331
|
#
|
294
|
-
# @param [Chef::Node] node
|
332
|
+
# @param [Chef::Node] node the node to check
|
333
|
+
# @since 15.5
|
295
334
|
#
|
296
335
|
# @return [Boolean]
|
297
336
|
#
|
@@ -301,7 +340,8 @@ module ChefUtils
|
|
301
340
|
|
302
341
|
# Determine if the current node is SuSE.
|
303
342
|
#
|
304
|
-
# @param [Chef::Node] node
|
343
|
+
# @param [Chef::Node] node the node to check
|
344
|
+
# @since 15.5
|
305
345
|
#
|
306
346
|
# @return [Boolean]
|
307
347
|
#
|
@@ -309,23 +349,28 @@ module ChefUtils
|
|
309
349
|
node["platform"] == "suse"
|
310
350
|
end
|
311
351
|
|
312
|
-
# Determine if the current node is
|
352
|
+
# Determine if the current node is OpenSUSE.
|
313
353
|
#
|
314
|
-
# @param [Chef::Node] node
|
354
|
+
# @param [Chef::Node] node the node to check
|
355
|
+
# @since 15.5
|
315
356
|
#
|
316
357
|
# @return [Boolean]
|
317
358
|
#
|
318
|
-
def
|
359
|
+
def opensuse_platform?(node = __getnode)
|
319
360
|
node["platform"] == "opensuse" || node["platform"] == "opensuseleap"
|
320
361
|
end
|
321
|
-
|
322
|
-
alias_method :
|
323
|
-
|
362
|
+
# chef-sugar backcompat method
|
363
|
+
alias_method :opensuse?, :opensuse_platform?
|
364
|
+
# chef-sugar backcompat method
|
365
|
+
alias_method :opensuseleap_platform?, :opensuse_platform?
|
366
|
+
# chef-sugar backcompat method
|
367
|
+
alias_method :leap_platform?, :opensuse_platform?
|
324
368
|
# NOTE: to anyone adding :tumbleweed_platform? - :[opensuse]leap_platform? should be false on tumbleweed, :opensuse[_platform]? should be true
|
325
369
|
|
326
370
|
# Determine if the current node is Windows.
|
327
371
|
#
|
328
|
-
# @param [Chef::Node] node
|
372
|
+
# @param [Chef::Node] node the node to check
|
373
|
+
# @since 15.5
|
329
374
|
#
|
330
375
|
# @return [Boolean]
|
331
376
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -24,19 +24,21 @@ module ChefUtils
|
|
24
24
|
|
25
25
|
# Determine if the current node is a member of the 'arch' family.
|
26
26
|
#
|
27
|
-
# @param [Chef::Node] node
|
27
|
+
# @param [Chef::Node] node the node to check
|
28
|
+
# @since 15.5
|
28
29
|
#
|
29
30
|
# @return [Boolean]
|
30
31
|
#
|
31
32
|
def arch?(node = __getnode)
|
32
33
|
node["platform_family"] == "arch"
|
33
34
|
end
|
34
|
-
# chef-sugar backcompat
|
35
|
+
# chef-sugar backcompat method
|
35
36
|
alias_method :arch_linux?, :arch?
|
36
37
|
|
37
38
|
# Determine if the current node is a member of the 'aix' platform family.
|
38
39
|
#
|
39
|
-
# @param [Chef::Node] node
|
40
|
+
# @param [Chef::Node] node the node to check
|
41
|
+
# @since 15.5
|
40
42
|
#
|
41
43
|
# @return [Boolean]
|
42
44
|
#
|
@@ -46,7 +48,8 @@ module ChefUtils
|
|
46
48
|
|
47
49
|
# Determine if the current node is a member of the 'debian' platform family (Debian, Ubuntu and derivatives).
|
48
50
|
#
|
49
|
-
# @param [Chef::Node] node
|
51
|
+
# @param [Chef::Node] node the node to check
|
52
|
+
# @since 15.5
|
50
53
|
#
|
51
54
|
# @return [Boolean]
|
52
55
|
#
|
@@ -54,9 +57,10 @@ module ChefUtils
|
|
54
57
|
node["platform_family"] == "debian"
|
55
58
|
end
|
56
59
|
|
57
|
-
# Determine if the current node is a member of the 'fedora' platform family (Fedora and
|
60
|
+
# Determine if the current node is a member of the 'fedora' platform family (Fedora and Arista).
|
58
61
|
#
|
59
|
-
# @param [Chef::Node] node
|
62
|
+
# @param [Chef::Node] node the node to check
|
63
|
+
# @since 15.5
|
60
64
|
#
|
61
65
|
# @return [Boolean]
|
62
66
|
#
|
@@ -66,31 +70,38 @@ module ChefUtils
|
|
66
70
|
|
67
71
|
# Determine if the current node is a member of the 'mac_os_x' platform family.
|
68
72
|
#
|
69
|
-
# @param [Chef::Node] node
|
73
|
+
# @param [Chef::Node] node the node to check
|
74
|
+
# @since 15.5
|
70
75
|
#
|
71
76
|
# @return [Boolean]
|
72
77
|
#
|
73
78
|
def macos?(node = __getnode)
|
74
79
|
node["platform_family"] == "mac_os_x"
|
75
80
|
end
|
81
|
+
# chef-sugar backcompat method
|
76
82
|
alias_method :osx?, :macos?
|
83
|
+
# chef-sugar backcompat method
|
77
84
|
alias_method :mac?, :macos?
|
85
|
+
# chef-sugar backcompat method
|
78
86
|
alias_method :mac_os_x?, :macos?
|
79
87
|
|
80
88
|
# Determine if the current node is a member of the 'rhel' platform family (Red Hat, CentOS, Oracle or Scientific Linux, but NOT Amazon Linux or Fedora).
|
81
89
|
#
|
82
|
-
# @param [Chef::Node] node
|
90
|
+
# @param [Chef::Node] node the node to check
|
91
|
+
# @since 15.5
|
83
92
|
#
|
84
93
|
# @return [Boolean]
|
85
94
|
#
|
86
95
|
def rhel?(node = __getnode)
|
87
96
|
node["platform_family"] == "rhel"
|
88
97
|
end
|
98
|
+
# chef-sugar backcompat method
|
89
99
|
alias_method :el?, :rhel?
|
90
100
|
|
91
|
-
# Determine if the current node is a rhel6 compatible build (Red Hat, CentOS, Oracle or Scientific Linux)
|
101
|
+
# Determine if the current node is a rhel6 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
92
102
|
#
|
93
|
-
# @param [Chef::Node] node
|
103
|
+
# @param [Chef::Node] node the node to check
|
104
|
+
# @since 15.5
|
94
105
|
#
|
95
106
|
# @return [Boolean]
|
96
107
|
#
|
@@ -98,9 +109,10 @@ module ChefUtils
|
|
98
109
|
node["platform_family"] == "rhel" && node["platform_version"].to_f >= 6.0 && node["platform_version"].to_f < 7.0
|
99
110
|
end
|
100
111
|
|
101
|
-
# Determine if the current node is a rhel7 compatible build (Red Hat, CentOS, Oracle or Scientific Linux)
|
112
|
+
# Determine if the current node is a rhel7 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
102
113
|
#
|
103
|
-
# @param [Chef::Node] node
|
114
|
+
# @param [Chef::Node] node the node to check
|
115
|
+
# @since 15.5
|
104
116
|
#
|
105
117
|
# @return [Boolean]
|
106
118
|
#
|
@@ -108,9 +120,10 @@ module ChefUtils
|
|
108
120
|
node["platform_family"] == "rhel" && node["platform_version"].to_f >= 7.0 && node["platform_version"].to_f < 8.0
|
109
121
|
end
|
110
122
|
|
111
|
-
# Determine if the current node is a rhel8 compatible build (Red Hat, CentOS, Oracle or Scientific Linux)
|
123
|
+
# Determine if the current node is a rhel8 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
112
124
|
#
|
113
|
-
# @param [Chef::Node] node
|
125
|
+
# @param [Chef::Node] node the node to check
|
126
|
+
# @since 15.5
|
114
127
|
#
|
115
128
|
# @return [Boolean]
|
116
129
|
#
|
@@ -120,30 +133,34 @@ module ChefUtils
|
|
120
133
|
|
121
134
|
# Determine if the current node is a member of the 'amazon' platform family.
|
122
135
|
#
|
123
|
-
# @param [Chef::Node] node
|
136
|
+
# @param [Chef::Node] node the node to check
|
137
|
+
# @since 15.5
|
124
138
|
#
|
125
139
|
# @return [Boolean]
|
126
140
|
#
|
127
141
|
def amazon?(node = __getnode)
|
128
142
|
node["platform_family"] == "amazon"
|
129
143
|
end
|
144
|
+
# chef-sugar backcompat method
|
130
145
|
alias_method :amazon_linux?, :amazon?
|
131
146
|
|
132
147
|
# Determine if the current node is a member of the 'solaris2' platform family.
|
133
148
|
#
|
134
|
-
# @param [Chef::Node] node
|
149
|
+
# @param [Chef::Node] node the node to check
|
150
|
+
# @since 15.5
|
135
151
|
#
|
136
152
|
# @return [Boolean]
|
137
153
|
#
|
138
154
|
def solaris2?(node = __getnode)
|
139
155
|
node["platform_family"] == "solaris2"
|
140
156
|
end
|
141
|
-
# chef-sugar backcompat
|
157
|
+
# chef-sugar backcompat method
|
142
158
|
alias_method :solaris?, :solaris2?
|
143
159
|
|
144
160
|
# Determine if the current node is a member of the 'smartos' platform family.
|
145
161
|
#
|
146
|
-
# @param [Chef::Node] node
|
162
|
+
# @param [Chef::Node] node the node to check
|
163
|
+
# @since 15.5
|
147
164
|
#
|
148
165
|
# @return [Boolean]
|
149
166
|
#
|
@@ -151,9 +168,10 @@ module ChefUtils
|
|
151
168
|
node["platform_family"] == "smartos"
|
152
169
|
end
|
153
170
|
|
154
|
-
# Determine if the current node is a member of the 'suse' platform family
|
171
|
+
# Determine if the current node is a member of the 'suse' platform family (openSUSE, SLES, and SLED).
|
155
172
|
#
|
156
|
-
# @param [Chef::Node] node
|
173
|
+
# @param [Chef::Node] node the node to check
|
174
|
+
# @since 15.5
|
157
175
|
#
|
158
176
|
# @return [Boolean]
|
159
177
|
#
|
@@ -163,7 +181,8 @@ module ChefUtils
|
|
163
181
|
|
164
182
|
# Determine if the current node is a member of the 'gentoo' platform family.
|
165
183
|
#
|
166
|
-
# @param [Chef::Node] node
|
184
|
+
# @param [Chef::Node] node the node to check
|
185
|
+
# @since 15.5
|
167
186
|
#
|
168
187
|
# @return [Boolean]
|
169
188
|
#
|
@@ -173,7 +192,8 @@ module ChefUtils
|
|
173
192
|
|
174
193
|
# Determine if the current node is a member of the 'freebsd' platform family.
|
175
194
|
#
|
176
|
-
# @param [Chef::Node] node
|
195
|
+
# @param [Chef::Node] node the node to check
|
196
|
+
# @since 15.5
|
177
197
|
#
|
178
198
|
# @return [Boolean]
|
179
199
|
#
|
@@ -183,7 +203,8 @@ module ChefUtils
|
|
183
203
|
|
184
204
|
# Determine if the current node is a member of the 'openbsd' platform family.
|
185
205
|
#
|
186
|
-
# @param [Chef::Node] node
|
206
|
+
# @param [Chef::Node] node the node to check
|
207
|
+
# @since 15.5
|
187
208
|
#
|
188
209
|
# @return [Boolean]
|
189
210
|
#
|
@@ -193,7 +214,8 @@ module ChefUtils
|
|
193
214
|
|
194
215
|
# Determine if the current node is a member of the 'netbsd' platform family.
|
195
216
|
#
|
196
|
-
# @param [Chef::Node] node
|
217
|
+
# @param [Chef::Node] node the node to check
|
218
|
+
# @since 15.5
|
197
219
|
#
|
198
220
|
# @return [Boolean]
|
199
221
|
#
|
@@ -203,7 +225,8 @@ module ChefUtils
|
|
203
225
|
|
204
226
|
# Determine if the current node is a member of the 'dragonflybsd' platform family.
|
205
227
|
#
|
206
|
-
# @param [Chef::Node] node
|
228
|
+
# @param [Chef::Node] node the node to check
|
229
|
+
# @since 15.5
|
207
230
|
#
|
208
231
|
# @return [Boolean]
|
209
232
|
#
|
@@ -213,7 +236,8 @@ module ChefUtils
|
|
213
236
|
|
214
237
|
# Determine if the current node is a member of the 'windows' platform family.
|
215
238
|
#
|
216
|
-
# @param [Chef::Node] node
|
239
|
+
# @param [Chef::Node] node the node to check
|
240
|
+
# @since 15.5
|
217
241
|
#
|
218
242
|
# @return [Boolean]
|
219
243
|
#
|
@@ -231,8 +255,10 @@ module ChefUtils
|
|
231
255
|
node ? node["platform_family"] == "windows" : windows_ruby?
|
232
256
|
end
|
233
257
|
|
234
|
-
# Determine if the
|
235
|
-
# this behavior, so this is useful for code which can never be parsed on a non-
|
258
|
+
# Determine if the Ruby VM is currently running on a Windows node (ChefSpec can never stub
|
259
|
+
# this behavior, so this is useful for code which can never be parsed on a non-Windows box).
|
260
|
+
#
|
261
|
+
# @since 15.5
|
236
262
|
#
|
237
263
|
# @return [Boolean]
|
238
264
|
#
|
@@ -252,7 +278,8 @@ module ChefUtils
|
|
252
278
|
# less useful since in no way can AIX trace its lineage back to old redhat distros. This is most useful for
|
253
279
|
# "smells like redhat, including SuSE".
|
254
280
|
#
|
255
|
-
# @param [Chef::Node] node
|
281
|
+
# @param [Chef::Node] node the node to check
|
282
|
+
# @since 15.5
|
256
283
|
#
|
257
284
|
# @return [Boolean]
|
258
285
|
#
|
@@ -260,11 +287,12 @@ module ChefUtils
|
|
260
287
|
fedora_derived?(node) || node["platform_family"] == "suse"
|
261
288
|
end
|
262
289
|
|
263
|
-
# RPM-based distros which are not SuSE and are very loosely similar to fedora, using yum or dnf.
|
264
|
-
# lineage of the distro should have forked off from old redhat fedora distros at some point.
|
265
|
-
# fedora and amazon.
|
290
|
+
# RPM-based distros which are not SuSE and are very loosely similar to fedora, using yum or dnf. The historical
|
291
|
+
# lineage of the distro should have forked off from old redhat fedora distros at some point. Currently rhel,
|
292
|
+
# fedora and amazon. This is most useful for "smells like redhat, but isn't SuSE".
|
266
293
|
#
|
267
|
-
# @param [Chef::Node] node
|
294
|
+
# @param [Chef::Node] node the node to check
|
295
|
+
# @since 15.5
|
268
296
|
#
|
269
297
|
# @return [Boolean]
|
270
298
|
#
|
@@ -272,10 +300,11 @@ module ChefUtils
|
|
272
300
|
redhat_based?(node) || node["platform_family"] == "amazon"
|
273
301
|
end
|
274
302
|
|
275
|
-
# RedHat distros -- fedora and rhel platform_families, nothing else.
|
303
|
+
# RedHat distros -- fedora and rhel platform_families, nothing else. This is most likely not as useful as the
|
276
304
|
# "fedora_dervied?" helper.
|
277
305
|
#
|
278
|
-
# @param [Chef::Node] node
|
306
|
+
# @param [Chef::Node] node the node to check
|
307
|
+
# @since 15.5
|
279
308
|
#
|
280
309
|
# @return [Boolean]
|
281
310
|
#
|
@@ -285,7 +314,8 @@ module ChefUtils
|
|
285
314
|
|
286
315
|
# All of the Solaris-lineage.
|
287
316
|
#
|
288
|
-
# @param [Chef::Node] node
|
317
|
+
# @param [Chef::Node] node the node to check
|
318
|
+
# @since 15.5
|
289
319
|
#
|
290
320
|
# @return [Boolean]
|
291
321
|
#
|
@@ -295,9 +325,10 @@ module ChefUtils
|
|
295
325
|
|
296
326
|
# All of the BSD-lineage.
|
297
327
|
#
|
298
|
-
# Note that
|
328
|
+
# Note that macOS is not included since macOS deviates so significantly from BSD that including it would not be useful.
|
299
329
|
#
|
300
|
-
# @param [Chef::Node] node
|
330
|
+
# @param [Chef::Node] node the node to check
|
331
|
+
# @since 15.5
|
301
332
|
#
|
302
333
|
# @return [Boolean]
|
303
334
|
#
|