chef-sugar-sre 5.1.13
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 +7 -0
- data/LICENSE +201 -0
- data/lib/chef/sugar/architecture.rb +176 -0
- data/lib/chef/sugar/cloud.rb +192 -0
- data/lib/chef/sugar/constraints.rb +108 -0
- data/lib/chef/sugar/constraints_dsl.rb +83 -0
- data/lib/chef/sugar/core_extensions/array.rb +34 -0
- data/lib/chef/sugar/core_extensions/object.rb +27 -0
- data/lib/chef/sugar/core_extensions/string.rb +66 -0
- data/lib/chef/sugar/core_extensions.rb +19 -0
- data/lib/chef/sugar/data_bag.rb +146 -0
- data/lib/chef/sugar/deprecation.rb +45 -0
- data/lib/chef/sugar/docker.rb +45 -0
- data/lib/chef/sugar/filters.rb +227 -0
- data/lib/chef/sugar/init.rb +61 -0
- data/lib/chef/sugar/ip.rb +48 -0
- data/lib/chef/sugar/kernel.rb +49 -0
- data/lib/chef/sugar/kitchen.rb +45 -0
- data/lib/chef/sugar/node.rb +219 -0
- data/lib/chef/sugar/platform.rb +331 -0
- data/lib/chef/sugar/platform_family.rb +184 -0
- data/lib/chef/sugar/ruby.rb +51 -0
- data/lib/chef/sugar/run_context.rb +41 -0
- data/lib/chef/sugar/shell.rb +151 -0
- data/lib/chef/sugar/vagrant.rb +77 -0
- data/lib/chef/sugar/version.rb +21 -0
- data/lib/chef/sugar/virtualization.rb +151 -0
- data/lib/chef/sugar.rb +51 -0
- metadata +73 -0
@@ -0,0 +1,331 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require_relative 'constraints'
|
18
|
+
|
19
|
+
class Chef
|
20
|
+
module Sugar
|
21
|
+
module Platform
|
22
|
+
extend self
|
23
|
+
|
24
|
+
PLATFORM_VERSIONS = {
|
25
|
+
'debian' => {
|
26
|
+
'squeeze' => '6',
|
27
|
+
'wheezy' => '7',
|
28
|
+
'jessie' => '8',
|
29
|
+
'stretch' => '9',
|
30
|
+
'buster' => '10',
|
31
|
+
},
|
32
|
+
'linuxmint' => {
|
33
|
+
'tara' => '19',
|
34
|
+
'sarah' => '18',
|
35
|
+
'qiana' => '17',
|
36
|
+
'petra' => '16',
|
37
|
+
'olivia' => '15',
|
38
|
+
'nadia' => '14',
|
39
|
+
'maya' => '13',
|
40
|
+
'lisa' => '12',
|
41
|
+
},
|
42
|
+
'mac_os_x' => {
|
43
|
+
'lion' => '10.7',
|
44
|
+
'mountain_lion' => '10.8',
|
45
|
+
'mavericks' => '10.9',
|
46
|
+
'yosemite' => '10.10',
|
47
|
+
'el_capitan' => '10.11',
|
48
|
+
'sierra' => '10.12',
|
49
|
+
'high_sierra' => '10.13',
|
50
|
+
'mojave' => '10.14',
|
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
|
+
},
|
66
|
+
'solaris' => {
|
67
|
+
'7' => '5.7',
|
68
|
+
'8' => '5.8',
|
69
|
+
'9' => '5.9',
|
70
|
+
'10' => '5.10',
|
71
|
+
'11' => '5.11',
|
72
|
+
},
|
73
|
+
'ubuntu' => {
|
74
|
+
'lucid' => '10.04',
|
75
|
+
'maverick' => '10.10',
|
76
|
+
'natty' => '11.04',
|
77
|
+
'oneiric' => '11.10',
|
78
|
+
'precise' => '12.04',
|
79
|
+
'quantal' => '12.10',
|
80
|
+
'raring' => '13.04',
|
81
|
+
'saucy' => '13.10',
|
82
|
+
'trusty' => '14.04',
|
83
|
+
'utopic' => '14.10',
|
84
|
+
'vivid' => '15.04',
|
85
|
+
'wily' => '15.10',
|
86
|
+
'xenial' => '16.04',
|
87
|
+
'zesty' => '17.04',
|
88
|
+
'artful' => '17.10',
|
89
|
+
'bionic' => '18.04',
|
90
|
+
'cosmic' => '18.10',
|
91
|
+
},
|
92
|
+
}
|
93
|
+
|
94
|
+
COMPARISON_OPERATORS = {
|
95
|
+
'after' => ->(a, b) { a > b },
|
96
|
+
'after_or_at' => ->(a, b) { a >= b },
|
97
|
+
'' => ->(a, b) { a == b },
|
98
|
+
'before' => ->(a, b) { a < b },
|
99
|
+
'before_or_at' => ->(a, b) { a <= b },
|
100
|
+
}
|
101
|
+
|
102
|
+
# Dynamically define custom matchers at runtime in a matrix. For each
|
103
|
+
# Platform, we create a map of named versions to their numerical
|
104
|
+
# equivalents (e.g. debian_before_squeeze?).
|
105
|
+
PLATFORM_VERSIONS.each do |platform, versions|
|
106
|
+
versions.each do |name, version|
|
107
|
+
COMPARISON_OPERATORS.each do |operator, block|
|
108
|
+
method_name = "#{platform}_#{operator}_#{name}?".squeeze('_').to_sym
|
109
|
+
define_method(method_name) do |node|
|
110
|
+
# Find the highest precedence that we actually care about based
|
111
|
+
# off of what was given to us in the list.
|
112
|
+
length = version.split('.').size
|
113
|
+
check = node['platform_version'].split('.')[0...length].join('.')
|
114
|
+
|
115
|
+
# Calling #to_f will ensure we only check major versions since
|
116
|
+
# '10.04.4'.to_f #=> 10.04. We also use a regex to match on
|
117
|
+
# platform so things like `solaris2` match on `solaris`.
|
118
|
+
node['platform'] =~ %r(^#{platform}) && block.call(check.to_f, version.to_f)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
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?
|
137
|
+
|
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
|
148
|
+
|
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
|
159
|
+
|
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?
|
171
|
+
|
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
|
182
|
+
|
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?
|
194
|
+
|
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?
|
206
|
+
|
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?
|
218
|
+
|
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
|
229
|
+
|
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?
|
241
|
+
|
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
|
252
|
+
|
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
|
263
|
+
|
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
|
274
|
+
|
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
|
285
|
+
|
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
|
307
|
+
|
308
|
+
end
|
309
|
+
|
310
|
+
#
|
311
|
+
# Return the platform_version for the node. Acts like a String
|
312
|
+
# but also provides a mechanism for checking version constraints.
|
313
|
+
#
|
314
|
+
# @param [Chef::Node] node
|
315
|
+
#
|
316
|
+
# @return [Chef::Sugar::Constraints::Version]
|
317
|
+
#
|
318
|
+
def platform_version(node)
|
319
|
+
Chef::Sugar::Constraints::Version.new(node['platform_version'])
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
module DSL
|
324
|
+
Chef::Sugar::Platform.instance_methods.each do |name|
|
325
|
+
define_method(name) do
|
326
|
+
Chef::Sugar::Platform.send(name, node)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
module Sugar
|
19
|
+
module PlatformFamily
|
20
|
+
extend self
|
21
|
+
|
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))
|
24
|
+
|
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?
|
36
|
+
|
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
|
47
|
+
|
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
|
58
|
+
|
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
|
69
|
+
|
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
|
80
|
+
|
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?
|
93
|
+
|
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
|
104
|
+
|
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
|
172
|
+
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
module DSL
|
177
|
+
Chef::Sugar::PlatformFamily.instance_methods.each do |name|
|
178
|
+
define_method(name) do
|
179
|
+
Chef::Sugar::PlatformFamily.send(name, node)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
module Sugar
|
19
|
+
module Ruby
|
20
|
+
extend self
|
21
|
+
|
22
|
+
#
|
23
|
+
# Determine if the current Ruby version is 2.0.
|
24
|
+
#
|
25
|
+
# @return [Boolean]
|
26
|
+
#
|
27
|
+
def ruby_20?(node)
|
28
|
+
version = Gem::Version.new(node['languages']['ruby']['version'])
|
29
|
+
Gem::Requirement.new('~> 2.0.0').satisfied_by?(version)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Determine if the current Ruby version is 1.9.
|
34
|
+
#
|
35
|
+
# @return [Boolean]
|
36
|
+
#
|
37
|
+
def ruby_19?(node)
|
38
|
+
version = Gem::Version.new(node['languages']['ruby']['version'])
|
39
|
+
Gem::Requirement.new('~> 1.9.0').satisfied_by?(version)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module DSL
|
44
|
+
# @see Chef::Sugar::Ruby#ruby_20?
|
45
|
+
def ruby_20?; Chef::Sugar::Ruby.ruby_20?(node); end
|
46
|
+
|
47
|
+
# @see Chef::Sugar::Ruby#ruby_19?
|
48
|
+
def ruby_19?; Chef::Sugar::Ruby.ruby_19?(node); end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
module Sugar
|
19
|
+
module RunContext
|
20
|
+
extend self
|
21
|
+
|
22
|
+
#
|
23
|
+
# Determine if the current node includes the given recipe name.
|
24
|
+
#
|
25
|
+
# @param [String] recipe_name
|
26
|
+
#
|
27
|
+
def includes_recipe?(node, recipe_name)
|
28
|
+
node.recipe?(recipe_name)
|
29
|
+
end
|
30
|
+
alias_method :include_recipe?, :includes_recipe?
|
31
|
+
end
|
32
|
+
|
33
|
+
module DSL
|
34
|
+
# @see Chef::Sugar::IP#best_ip_for
|
35
|
+
def includes_recipe?(recipe_name)
|
36
|
+
Chef::Sugar::RunContext.includes_recipe?(node, recipe_name)
|
37
|
+
end
|
38
|
+
alias_method :include_recipe?, :includes_recipe?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|