chef-sugar-ng 5.0.3 → 5.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/sugar/architecture.rb +137 -132
- data/lib/chef/sugar/deprecation.rb +45 -0
- data/lib/chef/sugar/docker.rb +17 -12
- data/lib/chef/sugar/kitchen.rb +17 -12
- data/lib/chef/sugar/node.rb +6 -0
- data/lib/chef/sugar/platform.rb +169 -165
- data/lib/chef/sugar/platform_family.rb +142 -137
- data/lib/chef/sugar/shell.rb +34 -24
- data/lib/chef/sugar/version.rb +1 -1
- metadata +7 -76
data/lib/chef/sugar/platform.rb
CHANGED
@@ -121,186 +121,190 @@ class Chef
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
#
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
124
|
+
# these helpers have been moved to core chef
|
125
|
+
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
|
126
|
+
#
|
127
|
+
# Determine if the current node is linux mint.
|
128
|
+
#
|
129
|
+
# @param [Chef::Node] node
|
130
|
+
#
|
131
|
+
# @return [Boolean]
|
132
|
+
#
|
133
|
+
def linux_mint?(node)
|
134
|
+
node['platform'] == 'linuxmint'
|
135
|
+
end
|
136
|
+
alias_method :mint?, :linux_mint?
|
135
137
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
138
|
+
#
|
139
|
+
# Determine if the current node is ubuntu.
|
140
|
+
#
|
141
|
+
# @param [Chef::Node] node
|
142
|
+
#
|
143
|
+
# @return [Boolean]
|
144
|
+
#
|
145
|
+
def ubuntu?(node)
|
146
|
+
node['platform'] == 'ubuntu'
|
147
|
+
end
|
146
148
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
149
|
+
#
|
150
|
+
# Determine if the current node is debian (platform, not platform_family).
|
151
|
+
#
|
152
|
+
# @param [Chef::Node] node
|
153
|
+
#
|
154
|
+
# @return [Boolean]
|
155
|
+
#
|
156
|
+
def debian_platform?(node)
|
157
|
+
node['platform'] == 'debian'
|
158
|
+
end
|
157
159
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
160
|
+
#
|
161
|
+
# Determine if the current node is amazon linux.
|
162
|
+
#
|
163
|
+
# @param [Chef::Node] node
|
164
|
+
#
|
165
|
+
# @return [Boolean]
|
166
|
+
#
|
167
|
+
def amazon_linux?(node)
|
168
|
+
node['platform'] == 'amazon'
|
169
|
+
end
|
170
|
+
alias_method :amazon?, :amazon_linux?
|
169
171
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
172
|
+
#
|
173
|
+
# Determine if the current node is centos.
|
174
|
+
#
|
175
|
+
# @param [Chef::Node] node
|
176
|
+
#
|
177
|
+
# @return [Boolean]
|
178
|
+
#
|
179
|
+
def centos?(node)
|
180
|
+
node['platform'] == 'centos'
|
181
|
+
end
|
180
182
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
183
|
+
#
|
184
|
+
# Determine if the current node is oracle linux.
|
185
|
+
#
|
186
|
+
# @param [Chef::Node] node
|
187
|
+
#
|
188
|
+
# @return [Boolean]
|
189
|
+
#
|
190
|
+
def oracle_linux?(node)
|
191
|
+
node['platform'] == 'oracle'
|
192
|
+
end
|
193
|
+
alias_method :oracle?, :oracle_linux?
|
192
194
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
195
|
+
#
|
196
|
+
# Determine if the current node is scientific linux.
|
197
|
+
#
|
198
|
+
# @param [Chef::Node] node
|
199
|
+
#
|
200
|
+
# @return [Boolean]
|
201
|
+
#
|
202
|
+
def scientific_linux?(node)
|
203
|
+
node['platform'] == 'scientific'
|
204
|
+
end
|
205
|
+
alias_method :scientific?, :scientific_linux?
|
204
206
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
207
|
+
#
|
208
|
+
# Determine if the current node is redhat enterprise.
|
209
|
+
#
|
210
|
+
# @param [Chef::Node] node
|
211
|
+
#
|
212
|
+
# @return [Boolean]
|
213
|
+
#
|
214
|
+
def redhat_enterprise_linux?(node)
|
215
|
+
node['platform'] == 'redhat'
|
216
|
+
end
|
217
|
+
alias_method :redhat_enterprise?, :redhat_enterprise_linux?
|
216
218
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
219
|
+
#
|
220
|
+
# Determine if the current node is fedora (platform, not platform_family).
|
221
|
+
#
|
222
|
+
# @param [Chef::Node] node
|
223
|
+
#
|
224
|
+
# @return [Boolean]
|
225
|
+
#
|
226
|
+
def fedora_platform?(node)
|
227
|
+
node['platform'] == 'fedora'
|
228
|
+
end
|
227
229
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
230
|
+
#
|
231
|
+
# Determine if the current node is solaris2
|
232
|
+
#
|
233
|
+
# @param [Chef::Node] node
|
234
|
+
#
|
235
|
+
# @return [Boolean]
|
236
|
+
#
|
237
|
+
def solaris2?(node)
|
238
|
+
node['platform'] == 'solaris2'
|
239
|
+
end
|
240
|
+
alias_method :solaris?, :solaris2?
|
239
241
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
242
|
+
#
|
243
|
+
# Determine if the current node is aix
|
244
|
+
#
|
245
|
+
# @param [Chef::Node] node
|
246
|
+
#
|
247
|
+
# @return [Boolean]
|
248
|
+
#
|
249
|
+
def aix?(node)
|
250
|
+
node['platform'] == 'aix'
|
251
|
+
end
|
250
252
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
253
|
+
#
|
254
|
+
# Determine if the current node is smartos
|
255
|
+
#
|
256
|
+
# @param [Chef::Node] node
|
257
|
+
#
|
258
|
+
# @return [Boolean]
|
259
|
+
#
|
260
|
+
def smartos?(node)
|
261
|
+
node['platform'] == 'smartos'
|
262
|
+
end
|
261
263
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
264
|
+
#
|
265
|
+
# Determine if the current node is omnios
|
266
|
+
#
|
267
|
+
# @param [Chef::Node] node
|
268
|
+
#
|
269
|
+
# @return [Boolean]
|
270
|
+
#
|
271
|
+
def omnios?(node)
|
272
|
+
node['platform'] == 'omnios'
|
273
|
+
end
|
272
274
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
275
|
+
#
|
276
|
+
# Determine if the current node is raspbian
|
277
|
+
#
|
278
|
+
# @param [Chef::Node] node
|
279
|
+
#
|
280
|
+
# @return [Boolean]
|
281
|
+
#
|
282
|
+
def raspbian?(node)
|
283
|
+
node['platform'] == 'raspbian'
|
284
|
+
end
|
283
285
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
286
|
+
#
|
287
|
+
# Determine if the current node is a Cisco nexus device
|
288
|
+
#
|
289
|
+
# @param [Chef::Node] node
|
290
|
+
#
|
291
|
+
# @return [Boolean]
|
292
|
+
#
|
293
|
+
def nexus?(node)
|
294
|
+
node['platform'] == 'nexus'
|
295
|
+
end
|
296
|
+
|
297
|
+
#
|
298
|
+
# Determine if the current node is a Cisco IOS-XR device
|
299
|
+
#
|
300
|
+
# @param [Chef::Node] node
|
301
|
+
#
|
302
|
+
# @return [Boolean]
|
303
|
+
#
|
304
|
+
def ios_xr?(node)
|
305
|
+
node['platform'] == 'ios_xr'
|
306
|
+
end
|
294
307
|
|
295
|
-
#
|
296
|
-
# Determine if the current node is a Cisco IOS-XR device
|
297
|
-
#
|
298
|
-
# @param [Chef::Node] node
|
299
|
-
#
|
300
|
-
# @return [Boolean]
|
301
|
-
#
|
302
|
-
def ios_xr?(node)
|
303
|
-
node['platform'] == 'ios_xr'
|
304
308
|
end
|
305
309
|
|
306
310
|
#
|
@@ -19,152 +19,157 @@ class Chef
|
|
19
19
|
module PlatformFamily
|
20
20
|
extend self
|
21
21
|
|
22
|
-
#
|
23
|
-
|
24
|
-
#
|
25
|
-
# @param [Chef::Node] node
|
26
|
-
#
|
27
|
-
# @return [Boolean]
|
28
|
-
#
|
29
|
-
def arch_linux?(node)
|
30
|
-
node['platform_family'] == 'arch'
|
31
|
-
end
|
32
|
-
alias_method :arch?, :arch_linux?
|
33
|
-
|
34
|
-
#
|
35
|
-
# Determine if the current node is a member of the debian family.
|
36
|
-
#
|
37
|
-
# @param [Chef::Node] node
|
38
|
-
#
|
39
|
-
# @return [Boolean]
|
40
|
-
#
|
41
|
-
def debian?(node)
|
42
|
-
node['platform_family'] == 'debian'
|
43
|
-
end
|
22
|
+
# these helpers have been moved to core chef
|
23
|
+
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
|
44
24
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
25
|
+
#
|
26
|
+
# Determine if the current node is a member of the arch family.
|
27
|
+
#
|
28
|
+
# @param [Chef::Node] node
|
29
|
+
#
|
30
|
+
# @return [Boolean]
|
31
|
+
#
|
32
|
+
def arch_linux?(node)
|
33
|
+
node['platform_family'] == 'arch'
|
34
|
+
end
|
35
|
+
alias_method :arch?, :arch_linux?
|
55
36
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
37
|
+
#
|
38
|
+
# Determine if the current node is a member of the debian family.
|
39
|
+
#
|
40
|
+
# @param [Chef::Node] node
|
41
|
+
#
|
42
|
+
# @return [Boolean]
|
43
|
+
#
|
44
|
+
def debian?(node)
|
45
|
+
node['platform_family'] == 'debian'
|
46
|
+
end
|
66
47
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
48
|
+
#
|
49
|
+
# Determine if the current node is a member of the fedora family.
|
50
|
+
#
|
51
|
+
# @param [Chef::Node] node
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
#
|
55
|
+
def fedora?(node)
|
56
|
+
node['platform_family'] == 'fedora'
|
57
|
+
end
|
77
58
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
alias_method :osx?, :mac_os_x?
|
89
|
-
alias_method :mac?, :mac_os_x?
|
90
|
-
|
91
|
-
#
|
92
|
-
# Determine if the current node is a member of the openbsd family.
|
93
|
-
#
|
94
|
-
# @param [Chef::Node] node
|
95
|
-
#
|
96
|
-
# @return [Boolean]
|
97
|
-
#
|
98
|
-
def openbsd?(node)
|
99
|
-
node['platform_family'] == 'openbsd'
|
100
|
-
end
|
59
|
+
#
|
60
|
+
# Determine if the current node is a member of the freebsd family.
|
61
|
+
#
|
62
|
+
# @param [Chef::Node] node
|
63
|
+
#
|
64
|
+
# @return [Boolean]
|
65
|
+
#
|
66
|
+
def freebsd?(node)
|
67
|
+
node['platform_family'] == 'freebsd'
|
68
|
+
end
|
101
69
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
alias_method :redhat?, :rhel?
|
113
|
-
alias_method :el?, :rhel?
|
114
|
-
|
115
|
-
#
|
116
|
-
# Determine if the current node is a member of the slackware family.
|
117
|
-
#
|
118
|
-
# @param [Chef::Node] node
|
119
|
-
#
|
120
|
-
# @return [Boolean]
|
121
|
-
#
|
122
|
-
def slackware?(node)
|
123
|
-
node['platform_family'] == 'slackware'
|
124
|
-
end
|
70
|
+
#
|
71
|
+
# Determine if the current node is a member of the arch family.
|
72
|
+
#
|
73
|
+
# @param [Chef::Node] node
|
74
|
+
#
|
75
|
+
# @return [Boolean]
|
76
|
+
#
|
77
|
+
def gentoo?(node)
|
78
|
+
node['platform_family'] == 'gentoo'
|
79
|
+
end
|
125
80
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
81
|
+
#
|
82
|
+
# Determine if the current node is a member of the OSX family.
|
83
|
+
#
|
84
|
+
# @param [Chef::Node] node
|
85
|
+
#
|
86
|
+
# @return [Boolean]
|
87
|
+
#
|
88
|
+
def mac_os_x?(node)
|
89
|
+
node['platform_family'] == 'mac_os_x'
|
90
|
+
end
|
91
|
+
alias_method :osx?, :mac_os_x?
|
92
|
+
alias_method :mac?, :mac_os_x?
|
136
93
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
94
|
+
#
|
95
|
+
# Determine if the current node is a member of the openbsd family.
|
96
|
+
#
|
97
|
+
# @param [Chef::Node] node
|
98
|
+
#
|
99
|
+
# @return [Boolean]
|
100
|
+
#
|
101
|
+
def openbsd?(node)
|
102
|
+
node['platform_family'] == 'openbsd'
|
103
|
+
end
|
147
104
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
105
|
+
#
|
106
|
+
# Determine if the current node is a member of the redhat family.
|
107
|
+
#
|
108
|
+
# @param [Chef::Node] node
|
109
|
+
#
|
110
|
+
# @return [Boolean]
|
111
|
+
#
|
112
|
+
def rhel?(node)
|
113
|
+
node['platform_family'] == 'rhel'
|
114
|
+
end
|
115
|
+
alias_method :redhat?, :rhel?
|
116
|
+
alias_method :el?, :rhel?
|
117
|
+
|
118
|
+
#
|
119
|
+
# Determine if the current node is a member of the slackware family.
|
120
|
+
#
|
121
|
+
# @param [Chef::Node] node
|
122
|
+
#
|
123
|
+
# @return [Boolean]
|
124
|
+
#
|
125
|
+
def slackware?(node)
|
126
|
+
node['platform_family'] == 'slackware'
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# Determine if the current node is a member of the suse family.
|
131
|
+
#
|
132
|
+
# @param [Chef::Node] node
|
133
|
+
#
|
134
|
+
# @return [Boolean]
|
135
|
+
#
|
136
|
+
def suse?(node)
|
137
|
+
node['platform_family'] == 'suse'
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# Determine if the current node is a member of the windows family.
|
142
|
+
#
|
143
|
+
# @param [Chef::Node] node
|
144
|
+
#
|
145
|
+
# @return [Boolean]
|
146
|
+
#
|
147
|
+
def windows?(node)
|
148
|
+
node['platform_family'] == 'windows'
|
149
|
+
end
|
150
|
+
|
151
|
+
#
|
152
|
+
# Determine if the current node is a member of the wrlinux family.
|
153
|
+
#
|
154
|
+
# @param [Chef::Node] node
|
155
|
+
#
|
156
|
+
# @return [Boolean]
|
157
|
+
#
|
158
|
+
def wrlinux?(node)
|
159
|
+
node['platform_family'] == 'wrlinux'
|
160
|
+
end
|
161
|
+
|
162
|
+
#
|
163
|
+
# Determine if the current system is a linux derivative
|
164
|
+
#
|
165
|
+
# @param [Chef::Node] node
|
166
|
+
#
|
167
|
+
# @return [Boolean]
|
168
|
+
#
|
169
|
+
def linux?(node)
|
170
|
+
node['os'] == 'linux'
|
171
|
+
end
|
158
172
|
|
159
|
-
#
|
160
|
-
# Determine if the current system is a linux derivative
|
161
|
-
#
|
162
|
-
# @param [Chef::Node] node
|
163
|
-
#
|
164
|
-
# @return [Boolean]
|
165
|
-
#
|
166
|
-
def linux?(node)
|
167
|
-
node['os'] == 'linux'
|
168
173
|
end
|
169
174
|
end
|
170
175
|
|