chef 11.10.2-x86-mingw32 → 11.10.4.ohai7.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/dsl/recipe.rb +3 -16
- data/lib/chef/provider.rb +6 -0
- data/lib/chef/version.rb +1 -1
- data/spec/support/lib/chef/resource/zen_master.rb +1 -0
- data/spec/unit/dsl/recipe_spec.rb +70 -0
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +4 -1
- data/spec/unit/recipe_spec.rb +143 -86
- metadata +10 -9
data/lib/chef/dsl/recipe.rb
CHANGED
@@ -31,20 +31,6 @@ class Chef
|
|
31
31
|
|
32
32
|
include Chef::Mixin::ConvertToClassName
|
33
33
|
|
34
|
-
# Default +cookbook_name+ implementation, always returns "none". This
|
35
|
-
# should be overriden in including classes whenever a meaningful value
|
36
|
-
# can be provided.
|
37
|
-
def cookbook_name
|
38
|
-
"none"
|
39
|
-
end
|
40
|
-
|
41
|
-
# Default +recipe_name+ implementation, always returns "none". This
|
42
|
-
# should be overridden in including classes whenever a meaningful value
|
43
|
-
# can be provided.
|
44
|
-
def recipe_name
|
45
|
-
"none"
|
46
|
-
end
|
47
|
-
|
48
34
|
def method_missing(method_symbol, *args, &block)
|
49
35
|
# If we have a definition that matches, we want to use that instead. This should
|
50
36
|
# let you do some really crazy over-riding of "native" types, if you really want
|
@@ -119,12 +105,13 @@ class Chef
|
|
119
105
|
|
120
106
|
resource = resource_class.new(name, run_context)
|
121
107
|
resource.source_line = created_at
|
122
|
-
resource.cookbook_name = cookbook_name
|
123
|
-
resource.recipe_name = recipe_name
|
124
108
|
# If we have a resource like this one, we want to steal its state
|
125
109
|
# This behavior is very counter-intuitive and should be removed.
|
126
110
|
# See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694
|
111
|
+
# Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052
|
127
112
|
resource.load_prior_resource
|
113
|
+
resource.cookbook_name = cookbook_name
|
114
|
+
resource.recipe_name = recipe_name
|
128
115
|
# Determine whether this resource is being created in the context of an enclosing Provider
|
129
116
|
resource.enclosing_provider = self.is_a?(Chef::Provider) ? self : nil
|
130
117
|
|
data/lib/chef/provider.rb
CHANGED
@@ -31,6 +31,9 @@ class Chef
|
|
31
31
|
attr_accessor :current_resource
|
32
32
|
attr_accessor :run_context
|
33
33
|
|
34
|
+
attr_reader :recipe_name
|
35
|
+
attr_reader :cookbook_name
|
36
|
+
|
34
37
|
#--
|
35
38
|
# TODO: this should be a reader, and the action should be passed in the
|
36
39
|
# constructor; however, many/most subclasses override the constructor so
|
@@ -44,6 +47,9 @@ class Chef
|
|
44
47
|
@current_resource = nil
|
45
48
|
@run_context = run_context
|
46
49
|
@converge_actions = nil
|
50
|
+
|
51
|
+
@recipe_name = nil
|
52
|
+
@cookbook_name = nil
|
47
53
|
end
|
48
54
|
|
49
55
|
def whyrun_mode?
|
data/lib/chef/version.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@getchef.com>)
|
3
|
+
# Copyright:: Copyright (c) 2014 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 'spec_helper'
|
20
|
+
require 'chef/dsl/recipe'
|
21
|
+
|
22
|
+
|
23
|
+
RecipeDSLExampleClass = Struct.new(:cookbook_name, :recipe_name)
|
24
|
+
class RecipeDSLExampleClass
|
25
|
+
include Chef::DSL::Recipe
|
26
|
+
end
|
27
|
+
|
28
|
+
RecipeDSLBaseAPI = Struct.new(:cookbook_name, :recipe_name)
|
29
|
+
class RecipeDSLExampleSubclass < RecipeDSLBaseAPI
|
30
|
+
include Chef::DSL::Recipe
|
31
|
+
end
|
32
|
+
|
33
|
+
# TODO: most of DSL::Recipe's implementation is tested in Chef::Recipe's tests,
|
34
|
+
# move those to here.
|
35
|
+
describe Chef::DSL::Recipe do
|
36
|
+
|
37
|
+
let(:cookbook_name) { "example_cb" }
|
38
|
+
let(:recipe_name) { "example_recipe" }
|
39
|
+
|
40
|
+
shared_examples_for "A Recipe DSL Implementation" do
|
41
|
+
|
42
|
+
it "responds to cookbook_name" do
|
43
|
+
expect(recipe.cookbook_name).to eq(cookbook_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "responds to recipe_name" do
|
47
|
+
expect(recipe.recipe_name).to eq(recipe_name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when included in a class that defines the required interface directly" do
|
52
|
+
|
53
|
+
let(:recipe) { RecipeDSLExampleClass.new(cookbook_name, recipe_name) }
|
54
|
+
|
55
|
+
include_examples "A Recipe DSL Implementation"
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# This is the situation that occurs when the Recipe DSL gets mixed in to a
|
60
|
+
# resource, for example.
|
61
|
+
context "when included in a class that defines the required interface in a superclass" do
|
62
|
+
|
63
|
+
let(:recipe) { RecipeDSLExampleSubclass.new(cookbook_name, recipe_name) }
|
64
|
+
|
65
|
+
include_examples "A Recipe DSL Implementation"
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
@@ -32,6 +32,10 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
|
|
32
32
|
"rspec-example"
|
33
33
|
end
|
34
34
|
|
35
|
+
def recipe_name
|
36
|
+
"rspec-example-recipe"
|
37
|
+
end
|
38
|
+
|
35
39
|
before do
|
36
40
|
@description = Chef::Formatters::ErrorDescription.new("Error Converging Resource:")
|
37
41
|
@stdout = StringIO.new
|
@@ -43,7 +47,6 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
|
|
43
47
|
|
44
48
|
describe "when explaining an error converging a resource" do
|
45
49
|
before do
|
46
|
-
source_line = caller(0)[0]
|
47
50
|
@resource = package("non-existing-package") do
|
48
51
|
|
49
52
|
only_if do
|
data/spec/unit/recipe_spec.rb
CHANGED
@@ -22,28 +22,38 @@
|
|
22
22
|
require 'spec_helper'
|
23
23
|
|
24
24
|
describe Chef::Recipe do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
25
|
+
|
26
|
+
let(:cookbook_repo) { File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks")) }
|
27
|
+
|
28
|
+
let(:cookbook_loader) do
|
29
|
+
loader = Chef::CookbookLoader.new(cookbook_repo)
|
30
|
+
loader.load_cookbooks
|
31
|
+
loader
|
32
|
+
end
|
33
|
+
|
34
|
+
let(:cookbook_collection) { Chef::CookbookCollection.new(cookbook_loader) }
|
35
|
+
|
36
|
+
let(:node) do
|
37
|
+
Chef::Node.new.tap {|n| n.normal[:tags] = [] }
|
38
|
+
end
|
39
|
+
|
40
|
+
let(:events) do
|
41
|
+
Chef::EventDispatch::Dispatcher.new
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:run_context) do
|
45
|
+
Chef::RunContext.new(node, cookbook_collection, events)
|
46
|
+
end
|
47
|
+
|
48
|
+
let(:recipe) do
|
49
|
+
Chef::Recipe.new("hjk", "test", run_context)
|
40
50
|
end
|
41
51
|
|
42
52
|
describe "method_missing" do
|
43
53
|
describe "resources" do
|
44
54
|
it "should load a two word (zen_master) resource" do
|
45
55
|
lambda do
|
46
|
-
|
56
|
+
recipe.zen_master "monkey" do
|
47
57
|
peace true
|
48
58
|
end
|
49
59
|
end.should_not raise_error
|
@@ -51,7 +61,7 @@ describe Chef::Recipe do
|
|
51
61
|
|
52
62
|
it "should load a one word (cat) resource" do
|
53
63
|
lambda do
|
54
|
-
|
64
|
+
recipe.cat "loulou" do
|
55
65
|
pretty_kitty true
|
56
66
|
end
|
57
67
|
end.should_not raise_error
|
@@ -59,47 +69,47 @@ describe Chef::Recipe do
|
|
59
69
|
|
60
70
|
it "should load a four word (one_two_three_four) resource" do
|
61
71
|
lambda do
|
62
|
-
|
72
|
+
recipe.one_two_three_four "numbers" do
|
63
73
|
i_can_count true
|
64
74
|
end
|
65
75
|
end.should_not raise_error
|
66
76
|
end
|
67
77
|
|
68
78
|
it "should throw an error if you access a resource that we can't find" do
|
69
|
-
lambda {
|
79
|
+
lambda { recipe.not_home("not_home_resource") }.should raise_error(NameError)
|
70
80
|
end
|
71
81
|
|
72
82
|
it "should require a name argument" do
|
73
83
|
lambda {
|
74
|
-
|
84
|
+
recipe.cat
|
75
85
|
}.should raise_error(ArgumentError, "You must supply a name when declaring a cat resource")
|
76
86
|
end
|
77
87
|
|
78
88
|
it "should allow regular errors (not NameErrors) to pass unchanged" do
|
79
89
|
lambda {
|
80
|
-
|
90
|
+
recipe.cat("felix") { raise ArgumentError, "You Suck" }
|
81
91
|
}.should raise_error(ArgumentError)
|
82
92
|
end
|
83
93
|
|
84
94
|
it "should add our zen_master to the collection" do
|
85
|
-
|
95
|
+
recipe.zen_master "monkey" do
|
86
96
|
peace true
|
87
97
|
end
|
88
|
-
|
98
|
+
run_context.resource_collection.lookup("zen_master[monkey]").name.should eql("monkey")
|
89
99
|
end
|
90
100
|
|
91
101
|
it "should add our zen masters to the collection in the order they appear" do
|
92
102
|
%w{monkey dog cat}.each do |name|
|
93
|
-
|
103
|
+
recipe.zen_master name do
|
94
104
|
peace true
|
95
105
|
end
|
96
106
|
end
|
97
107
|
|
98
|
-
|
108
|
+
run_context.resource_collection.map{|r| r.name}.should eql(["monkey", "dog", "cat"])
|
99
109
|
end
|
100
110
|
|
101
111
|
it "should return the new resource after creating it" do
|
102
|
-
res =
|
112
|
+
res = recipe.zen_master "makoto" do
|
103
113
|
peace true
|
104
114
|
end
|
105
115
|
res.resource_name.should eql(:zen_master)
|
@@ -110,16 +120,16 @@ describe Chef::Recipe do
|
|
110
120
|
|
111
121
|
it "locate resource for particular platform" do
|
112
122
|
Object.const_set('ShaunTheSheep', Class.new(Chef::Resource){ provides :laughter, :on_platforms => ["television"] })
|
113
|
-
|
114
|
-
|
115
|
-
res =
|
123
|
+
node.automatic[:platform] = "television"
|
124
|
+
node.automatic[:platform_version] = "123"
|
125
|
+
res = recipe.laughter "timmy"
|
116
126
|
res.name.should eql("timmy")
|
117
127
|
res.kind_of?(ShaunTheSheep)
|
118
128
|
end
|
119
129
|
|
120
130
|
it "locate a resource for all platforms" do
|
121
131
|
Object.const_set("YourMom", Class.new(Chef::Resource){ provides :love_and_caring })
|
122
|
-
res =
|
132
|
+
res = recipe.love_and_caring "mommy"
|
123
133
|
res.name.should eql("mommy")
|
124
134
|
res.kind_of?(YourMom)
|
125
135
|
end
|
@@ -129,7 +139,7 @@ describe Chef::Recipe do
|
|
129
139
|
|
130
140
|
describe "creating resources via build_resource" do
|
131
141
|
let(:zm_resource) do
|
132
|
-
|
142
|
+
recipe.build_resource(:zen_master, "klopp") do
|
133
143
|
something "bvb"
|
134
144
|
end
|
135
145
|
end
|
@@ -146,14 +156,14 @@ describe Chef::Recipe do
|
|
146
156
|
|
147
157
|
it "does not add the resource to the resource collection" do
|
148
158
|
zm_resource # force let binding evaluation
|
149
|
-
expect {
|
159
|
+
expect { run_context.resource_collection.resources(:zen_master => "klopp") }.to raise_error(Chef::Exceptions::ResourceNotFound)
|
150
160
|
end
|
151
161
|
|
152
162
|
end
|
153
163
|
|
154
164
|
describe "creating resources via declare_resource" do
|
155
165
|
let(:zm_resource) do
|
156
|
-
|
166
|
+
recipe.declare_resource(:zen_master, "klopp") do
|
157
167
|
something "bvb"
|
158
168
|
end
|
159
169
|
end
|
@@ -170,7 +180,7 @@ describe Chef::Recipe do
|
|
170
180
|
|
171
181
|
it "adds the resource to the resource collection" do
|
172
182
|
zm_resource # force let binding evaluation
|
173
|
-
|
183
|
+
run_context.resource_collection.resources(:zen_master => "klopp").should == zm_resource
|
174
184
|
end
|
175
185
|
|
176
186
|
end
|
@@ -179,13 +189,13 @@ describe Chef::Recipe do
|
|
179
189
|
|
180
190
|
it "gives a sane error message when using method_missing" do
|
181
191
|
lambda do
|
182
|
-
|
192
|
+
recipe.no_such_resource("foo")
|
183
193
|
end.should raise_error(NoMethodError, %q[No resource or method named `no_such_resource' for `Chef::Recipe "test"'])
|
184
194
|
end
|
185
195
|
|
186
196
|
it "gives a sane error message when using method_missing 'bare'" do
|
187
197
|
lambda do
|
188
|
-
|
198
|
+
recipe.instance_eval do
|
189
199
|
# Giving an argument will change this from NameError to NoMethodError
|
190
200
|
no_such_resource
|
191
201
|
end
|
@@ -193,11 +203,11 @@ describe Chef::Recipe do
|
|
193
203
|
end
|
194
204
|
|
195
205
|
it "gives a sane error message when using build_resource" do
|
196
|
-
expect {
|
206
|
+
expect { recipe.build_resource(:no_such_resource, "foo") }.to raise_error(Chef::Exceptions::NoSuchResourceType)
|
197
207
|
end
|
198
208
|
|
199
209
|
it "gives a sane error message when using declare_resource" do
|
200
|
-
expect {
|
210
|
+
expect { recipe.declare_resource(:no_such_resource, "bar") }.to raise_error(Chef::Exceptions::NoSuchResourceType)
|
201
211
|
end
|
202
212
|
|
203
213
|
end
|
@@ -206,7 +216,7 @@ describe Chef::Recipe do
|
|
206
216
|
|
207
217
|
it "does not obfuscate the error source" do
|
208
218
|
lambda do
|
209
|
-
|
219
|
+
recipe.zen_master("klopp") do
|
210
220
|
this_method_doesnt_exist
|
211
221
|
end
|
212
222
|
end.should raise_error(NoMethodError, "undefined method `this_method_doesnt_exist' for Chef::Resource::ZenMaster")
|
@@ -215,6 +225,53 @@ describe Chef::Recipe do
|
|
215
225
|
|
216
226
|
end
|
217
227
|
|
228
|
+
describe "resource cloning" do
|
229
|
+
|
230
|
+
let(:second_recipe) do
|
231
|
+
Chef::Recipe.new("second_cb", "second_recipe", run_context)
|
232
|
+
end
|
233
|
+
|
234
|
+
let(:original_resource) do
|
235
|
+
recipe.zen_master("klopp") do
|
236
|
+
something "bvb09"
|
237
|
+
action :score
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
let(:duplicated_resource) do
|
242
|
+
original_resource
|
243
|
+
second_recipe.zen_master("klopp") do
|
244
|
+
# attrs should be cloned
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
it "copies attributes from the first resource" do
|
249
|
+
duplicated_resource.something.should == "bvb09"
|
250
|
+
end
|
251
|
+
|
252
|
+
it "does not copy the action from the first resource" do
|
253
|
+
original_resource.action.should == [:score]
|
254
|
+
duplicated_resource.action.should == :nothing
|
255
|
+
end
|
256
|
+
|
257
|
+
it "does not copy the source location of the first resource" do
|
258
|
+
# sanity check source location:
|
259
|
+
original_resource.source_line.should include(__FILE__)
|
260
|
+
duplicated_resource.source_line.should include(__FILE__)
|
261
|
+
# actual test:
|
262
|
+
original_resource.source_line.should_not == duplicated_resource.source_line
|
263
|
+
end
|
264
|
+
|
265
|
+
it "sets the cookbook name on the cloned resource to that resource's cookbook" do
|
266
|
+
duplicated_resource.cookbook_name.should == "second_cb"
|
267
|
+
end
|
268
|
+
|
269
|
+
it "sets the recipe name on the cloned resource to that resoure's recipe" do
|
270
|
+
duplicated_resource.recipe_name.should == "second_recipe"
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
|
218
275
|
describe "resource definitions" do
|
219
276
|
it "should execute defined resources" do
|
220
277
|
crow_define = Chef::ResourceDefinition.new
|
@@ -224,12 +281,12 @@ describe Chef::Recipe do
|
|
224
281
|
something params[:something]
|
225
282
|
end
|
226
283
|
end
|
227
|
-
|
228
|
-
|
284
|
+
run_context.definitions[:crow] = crow_define
|
285
|
+
recipe.crow "mine" do
|
229
286
|
peace true
|
230
287
|
end
|
231
|
-
|
232
|
-
|
288
|
+
run_context.resource_collection.resources(:zen_master => "lao tzu").name.should eql("lao tzu")
|
289
|
+
run_context.resource_collection.resources(:zen_master => "lao tzu").something.should eql(true)
|
233
290
|
end
|
234
291
|
|
235
292
|
it "should set the node on defined resources" do
|
@@ -240,12 +297,12 @@ describe Chef::Recipe do
|
|
240
297
|
something params[:something]
|
241
298
|
end
|
242
299
|
end
|
243
|
-
|
244
|
-
|
245
|
-
|
300
|
+
run_context.definitions[:crow] = crow_define
|
301
|
+
node.normal[:foo] = false
|
302
|
+
recipe.crow "mine" do
|
246
303
|
something node[:foo]
|
247
304
|
end
|
248
|
-
|
305
|
+
recipe.resources(:zen_master => "lao tzu").something.should eql(false)
|
249
306
|
end
|
250
307
|
end
|
251
308
|
|
@@ -258,15 +315,15 @@ describe Chef::Recipe do
|
|
258
315
|
peace = true
|
259
316
|
end
|
260
317
|
CODE
|
261
|
-
lambda {
|
262
|
-
|
318
|
+
lambda { recipe.instance_eval(code) }.should_not raise_error
|
319
|
+
recipe.resources(:zen_master => "gnome").name.should eql("gnome")
|
263
320
|
end
|
264
321
|
end
|
265
322
|
|
266
323
|
describe "from_file" do
|
267
324
|
it "should load a resource from a ruby file" do
|
268
|
-
|
269
|
-
res =
|
325
|
+
recipe.from_file(File.join(CHEF_SPEC_DATA, "recipes", "test.rb"))
|
326
|
+
res = recipe.resources(:file => "/etc/nsswitch.conf")
|
270
327
|
res.name.should eql("/etc/nsswitch.conf")
|
271
328
|
res.action.should eql([:create])
|
272
329
|
res.owner.should eql("root")
|
@@ -275,88 +332,88 @@ describe Chef::Recipe do
|
|
275
332
|
end
|
276
333
|
|
277
334
|
it "should raise an exception if the file cannot be found or read" do
|
278
|
-
lambda {
|
335
|
+
lambda { recipe.from_file("/tmp/monkeydiving") }.should raise_error(IOError)
|
279
336
|
end
|
280
337
|
end
|
281
338
|
|
282
339
|
describe "include_recipe" do
|
283
340
|
it "should evaluate another recipe with include_recipe" do
|
284
|
-
|
285
|
-
|
286
|
-
res =
|
341
|
+
node.should_receive(:loaded_recipe).with(:openldap, "gigantor")
|
342
|
+
run_context.include_recipe "openldap::gigantor"
|
343
|
+
res = run_context.resource_collection.resources(:cat => "blanket")
|
287
344
|
res.name.should eql("blanket")
|
288
345
|
res.pretty_kitty.should eql(false)
|
289
346
|
end
|
290
347
|
|
291
348
|
it "should load the default recipe for a cookbook if include_recipe is called without a ::" do
|
292
|
-
|
293
|
-
|
294
|
-
res =
|
349
|
+
node.should_receive(:loaded_recipe).with(:openldap, "default")
|
350
|
+
run_context.include_recipe "openldap"
|
351
|
+
res = run_context.resource_collection.resources(:cat => "blanket")
|
295
352
|
res.name.should eql("blanket")
|
296
353
|
res.pretty_kitty.should eql(true)
|
297
354
|
end
|
298
355
|
|
299
356
|
it "should store that it has seen a recipe in the run_context" do
|
300
|
-
|
301
|
-
|
302
|
-
|
357
|
+
node.should_receive(:loaded_recipe).with(:openldap, "default")
|
358
|
+
run_context.include_recipe "openldap"
|
359
|
+
run_context.loaded_recipe?("openldap").should be_true
|
303
360
|
end
|
304
361
|
|
305
362
|
it "should not include the same recipe twice" do
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
363
|
+
node.should_receive(:loaded_recipe).with(:openldap, "default").exactly(:once)
|
364
|
+
cookbook_collection[:openldap].should_receive(:load_recipe).with("default", run_context)
|
365
|
+
recipe.include_recipe "openldap"
|
366
|
+
cookbook_collection[:openldap].should_not_receive(:load_recipe).with("default", run_context)
|
367
|
+
recipe.include_recipe "openldap"
|
311
368
|
end
|
312
369
|
end
|
313
370
|
|
314
371
|
describe "tags" do
|
315
372
|
it "should set tags via tag" do
|
316
|
-
|
317
|
-
|
373
|
+
recipe.tag "foo"
|
374
|
+
node[:tags].should include("foo")
|
318
375
|
end
|
319
376
|
|
320
377
|
it "should set multiple tags via tag" do
|
321
|
-
|
322
|
-
|
323
|
-
|
378
|
+
recipe.tag "foo", "bar"
|
379
|
+
node[:tags].should include("foo")
|
380
|
+
node[:tags].should include("bar")
|
324
381
|
end
|
325
382
|
|
326
383
|
it "should not set the same tag twice via tag" do
|
327
|
-
|
328
|
-
|
329
|
-
|
384
|
+
recipe.tag "foo"
|
385
|
+
recipe.tag "foo"
|
386
|
+
node[:tags].should eql([ "foo" ])
|
330
387
|
end
|
331
388
|
|
332
389
|
it "should return the current list of tags from tag with no arguments" do
|
333
|
-
|
334
|
-
|
390
|
+
recipe.tag "foo"
|
391
|
+
recipe.tag.should eql([ "foo" ])
|
335
392
|
end
|
336
393
|
|
337
394
|
it "should return true from tagged? if node is tagged" do
|
338
|
-
|
339
|
-
|
395
|
+
recipe.tag "foo"
|
396
|
+
recipe.tagged?("foo").should be(true)
|
340
397
|
end
|
341
398
|
|
342
399
|
it "should return false from tagged? if node is not tagged" do
|
343
|
-
|
400
|
+
recipe.tagged?("foo").should be(false)
|
344
401
|
end
|
345
402
|
|
346
403
|
it "should return false from tagged? if node is not tagged" do
|
347
|
-
|
404
|
+
recipe.tagged?("foo").should be(false)
|
348
405
|
end
|
349
406
|
|
350
407
|
it "should remove a tag from the tag list via untag" do
|
351
|
-
|
352
|
-
|
353
|
-
|
408
|
+
recipe.tag "foo"
|
409
|
+
recipe.untag "foo"
|
410
|
+
node[:tags].should eql([])
|
354
411
|
end
|
355
412
|
|
356
413
|
it "should remove multiple tags from the tag list via untag" do
|
357
|
-
|
358
|
-
|
359
|
-
|
414
|
+
recipe.tag "foo", "bar"
|
415
|
+
recipe.untag "bar", "foo"
|
416
|
+
node[:tags].should eql([])
|
360
417
|
end
|
361
418
|
end
|
362
419
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.10.
|
5
|
-
prerelease:
|
4
|
+
version: 11.10.4.ohai7.0
|
5
|
+
prerelease: 8
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
8
8
|
- Adam Jacob
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-config
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 7.0.0.rc.0
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 7.0.0.rc.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: rest-client
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1742,6 +1742,7 @@ files:
|
|
1742
1742
|
- spec/unit/digester_spec.rb
|
1743
1743
|
- spec/unit/dsl/data_query_spec.rb
|
1744
1744
|
- spec/unit/dsl/platform_introspection_spec.rb
|
1745
|
+
- spec/unit/dsl/recipe_spec.rb
|
1745
1746
|
- spec/unit/dsl/regsitry_helper_spec.rb
|
1746
1747
|
- spec/unit/encrypted_data_bag_item_spec.rb
|
1747
1748
|
- spec/unit/environment_spec.rb
|
@@ -2064,9 +2065,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2064
2065
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2065
2066
|
none: false
|
2066
2067
|
requirements:
|
2067
|
-
- - ! '
|
2068
|
+
- - ! '>'
|
2068
2069
|
- !ruby/object:Gem::Version
|
2069
|
-
version:
|
2070
|
+
version: 1.3.1
|
2070
2071
|
requirements: []
|
2071
2072
|
rubyforge_project:
|
2072
2073
|
rubygems_version: 1.8.23
|