chef 11.12.0.alpha.1-x86-mingw32 → 11.12.0.rc.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/api_client/registration.rb +46 -9
- data/lib/chef/application.rb +1 -0
- data/lib/chef/application/client.rb +25 -24
- data/lib/chef/client.rb +34 -0
- data/lib/chef/config.rb +11 -0
- data/lib/chef/cookbook/chefignore.rb +10 -2
- data/lib/chef/cookbook/metadata.rb +31 -3
- data/lib/chef/cookbook/synchronizer.rb +2 -2
- data/lib/chef/cookbook/syntax_check.rb +4 -4
- data/lib/chef/encrypted_data_bag_item.rb +37 -1
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +42 -0
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +122 -0
- data/lib/chef/http.rb +0 -1
- data/lib/chef/http/decompressor.rb +7 -4
- data/lib/chef/http/simple.rb +5 -0
- data/lib/chef/http/validate_content_length.rb +28 -12
- data/lib/chef/knife.rb +1 -0
- data/lib/chef/knife/client_bulk_delete.rb +48 -9
- data/lib/chef/knife/client_delete.rb +4 -4
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +17 -7
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/ui.rb +42 -5
- data/lib/chef/knife/node_run_list_add.rb +31 -2
- data/lib/chef/knife/ssh.rb +44 -31
- data/lib/chef/knife/ssl_check.rb +213 -0
- data/lib/chef/knife/ssl_fetch.rb +145 -0
- data/lib/chef/mixin/deep_merge.rb +13 -5
- data/lib/chef/mixin/shell_out.rb +9 -3
- data/lib/chef/node.rb +23 -4
- data/lib/chef/node/immutable_collections.rb +32 -0
- data/lib/chef/platform/provider_mapping.rb +21 -18
- data/lib/chef/platform/query_helpers.rb +10 -2
- data/lib/chef/policy_builder/expand_node_object.rb +3 -6
- data/lib/chef/provider/cron.rb +25 -3
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +2 -1
- data/lib/chef/provider/package/windows.rb +80 -0
- data/lib/chef/provider/package/windows/msi.rb +69 -0
- data/lib/chef/provider/powershell_script.rb +19 -6
- data/lib/chef/provider/service/solaris.rb +11 -7
- data/lib/chef/resource.rb +18 -5
- data/lib/chef/resource/conditional.rb +20 -7
- data/lib/chef/resource/cron.rb +18 -2
- data/lib/chef/resource/execute.rb +0 -2
- data/lib/chef/resource/powershell_script.rb +23 -1
- data/lib/chef/resource/script.rb +25 -0
- data/lib/chef/resource/subversion.rb +4 -0
- data/lib/chef/resource/windows_package.rb +79 -0
- data/lib/chef/resource/windows_script.rb +0 -5
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/rest.rb +6 -1
- data/lib/chef/run_context.rb +22 -2
- data/lib/chef/run_context/cookbook_compiler.rb +12 -0
- data/lib/chef/util/editor.rb +92 -0
- data/lib/chef/util/file_edit.rb +22 -54
- data/lib/chef/version.rb +2 -2
- data/lib/chef/win32/api/installer.rb +166 -0
- data/lib/chef/win32/version.rb +8 -0
- data/spec/data/standalone_cookbook/Gemfile +1 -0
- data/spec/data/standalone_cookbook/chefignore +9 -0
- data/spec/data/standalone_cookbook/recipes/default.rb +3 -0
- data/spec/data/standalone_cookbook/vendor/bundle/ruby/2.0.0/gems/multi_json-1.9.0/lib/multi_json.rb +1 -0
- data/spec/functional/resource/powershell_spec.rb +262 -1
- data/spec/functional/win32/versions_spec.rb +3 -3
- data/spec/integration/knife/chefignore_spec.rb +1 -2
- data/spec/integration/knife/raw_spec.rb +8 -13
- data/spec/integration/knife/redirection_spec.rb +6 -14
- data/spec/integration/solo/solo_spec.rb +19 -0
- data/spec/support/shared/functional/windows_script.rb +1 -1
- data/spec/support/shared/integration/app_server_support.rb +42 -0
- data/spec/support/shared/integration/integration_helper.rb +1 -0
- data/spec/support/shared/unit/script_resource.rb +38 -0
- data/spec/unit/api_client/registration_spec.rb +109 -38
- data/spec/unit/application/client_spec.rb +48 -1
- data/spec/unit/cookbook/chefignore_spec.rb +10 -0
- data/spec/unit/cookbook/metadata_spec.rb +45 -1
- data/spec/unit/cookbook/syntax_check_spec.rb +28 -0
- data/spec/unit/cookbook_spec.rb +0 -10
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +56 -0
- data/spec/unit/http/simple_spec.rb +32 -0
- data/spec/unit/http/validate_content_length_spec.rb +187 -0
- data/spec/unit/knife/bootstrap_spec.rb +13 -4
- data/spec/unit/knife/client_bulk_delete_spec.rb +123 -38
- data/spec/unit/knife/client_delete_spec.rb +4 -4
- data/spec/unit/knife/cookbook_upload_spec.rb +181 -88
- data/spec/unit/knife/core/bootstrap_context_spec.rb +11 -1
- data/spec/unit/knife/core/ui_spec.rb +109 -38
- data/spec/unit/knife/node_run_list_add_spec.rb +24 -1
- data/spec/unit/knife/ssh_spec.rb +17 -6
- data/spec/unit/knife/ssl_check_spec.rb +187 -0
- data/spec/unit/knife/ssl_fetch_spec.rb +151 -0
- data/spec/unit/mixin/deep_merge_spec.rb +17 -0
- data/spec/unit/node/immutable_collections_spec.rb +55 -0
- data/spec/unit/node_spec.rb +9 -0
- data/spec/unit/platform/query_helpers_spec.rb +32 -0
- data/spec/unit/platform_spec.rb +193 -175
- data/spec/unit/policy_builder/expand_node_object_spec.rb +1 -1
- data/spec/unit/provider/cron_spec.rb +175 -1
- data/spec/unit/provider/mount/mount_spec.rb +33 -3
- data/spec/unit/provider/package/dpkg_spec.rb +4 -0
- data/spec/unit/provider/package/windows/msi_spec.rb +60 -0
- data/spec/unit/provider/package/windows_spec.rb +80 -0
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +35 -10
- data/spec/unit/pure_application_spec.rb +32 -0
- data/spec/unit/recipe_spec.rb +4 -0
- data/spec/unit/resource/conditional_spec.rb +13 -12
- data/spec/unit/resource/cron_spec.rb +7 -2
- data/spec/unit/resource/powershell_spec.rb +85 -2
- data/spec/unit/resource/subversion_spec.rb +5 -0
- data/spec/unit/resource/windows_package_spec.rb +74 -0
- data/spec/unit/resource_spec.rb +23 -1
- data/spec/unit/rest_spec.rb +15 -0
- data/spec/unit/run_context/cookbook_compiler_spec.rb +12 -0
- data/spec/unit/run_context_spec.rb +7 -0
- data/spec/unit/util/editor_spec.rb +152 -0
- data/spec/unit/util/file_edit_spec.rb +37 -1
- metadata +41 -30
data/spec/unit/resource_spec.rb
CHANGED
@@ -344,7 +344,7 @@ describe Chef::Resource do
|
|
344
344
|
expected_keys = [ :allowed_actions, :params, :provider, :updated,
|
345
345
|
:updated_by_last_action, :before, :supports,
|
346
346
|
:noop, :ignore_failure, :name, :source_line,
|
347
|
-
:action, :retries, :retry_delay, :elapsed_time]
|
347
|
+
:action, :retries, :retry_delay, :elapsed_time, :guard_interpreter]
|
348
348
|
(hash.keys - expected_keys).should == []
|
349
349
|
(expected_keys - hash.keys).should == []
|
350
350
|
hash[:name].should eql("funk")
|
@@ -526,6 +526,28 @@ describe Chef::Resource do
|
|
526
526
|
snitch_var2.should be_false
|
527
527
|
end
|
528
528
|
|
529
|
+
describe "guard_interpreter attribute" do
|
530
|
+
let(:resource) { @resource }
|
531
|
+
|
532
|
+
it "should be set to :default by default" do
|
533
|
+
resource.guard_interpreter.should == :default
|
534
|
+
end
|
535
|
+
|
536
|
+
it "if set to :default should return :default when read" do
|
537
|
+
resource.guard_interpreter(:default)
|
538
|
+
resource.guard_interpreter.should == :default
|
539
|
+
end
|
540
|
+
|
541
|
+
it "should raise Chef::Exceptions::ValidationFailed on an attempt to set the guard_interpreter attribute to something other than a Symbol" do
|
542
|
+
expect { resource.guard_interpreter('command_dot_com') }.to raise_error(Chef::Exceptions::ValidationFailed)
|
543
|
+
end
|
544
|
+
|
545
|
+
it "should not raise an exception when setting the guard interpreter attribute to a Symbol" do
|
546
|
+
Chef::GuardInterpreter::ResourceGuardInterpreter.stub(:new).and_return(nil)
|
547
|
+
expect { resource.guard_interpreter(:command_dot_com) }.not_to raise_error
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
529
551
|
end
|
530
552
|
|
531
553
|
describe "should_skip?" do
|
data/spec/unit/rest_spec.rb
CHANGED
@@ -76,6 +76,21 @@ describe Chef::REST do
|
|
76
76
|
Chef::Log.init(log_stringio)
|
77
77
|
end
|
78
78
|
|
79
|
+
it "should have content length validation middleware after compressor middleware" do
|
80
|
+
middlewares = rest.instance_variable_get(:@middlewares)
|
81
|
+
content_length = middlewares.find_index { |e| e.is_a? Chef::HTTP::ValidateContentLength }
|
82
|
+
decompressor = middlewares.find_index { |e| e.is_a? Chef::HTTP::Decompressor }
|
83
|
+
|
84
|
+
content_length.should_not be_nil
|
85
|
+
decompressor.should_not be_nil
|
86
|
+
(decompressor < content_length).should be_true
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should allow the options hash to be frozen" do
|
90
|
+
options = {}.freeze
|
91
|
+
# should not raise any exception
|
92
|
+
Chef::REST.new(base_url, nil, nil, options)
|
93
|
+
end
|
79
94
|
|
80
95
|
describe "calling an HTTP verb on a path or absolute URL" do
|
81
96
|
it "adds a relative URL to the base url it was initialized with" do
|
@@ -170,5 +170,17 @@ describe Chef::RunContext::CookbookCompiler do
|
|
170
170
|
:"circular-dep1",
|
171
171
|
:"test-with-circular-deps"]
|
172
172
|
end
|
173
|
+
|
174
|
+
it "determines if a cookbook is in the list of cookbooks reachable by dependency" do
|
175
|
+
node.run_list("test-with-deps::default", "test-with-deps::server")
|
176
|
+
compiler.cookbook_order.should == [:dependency1, :dependency2, :"test-with-deps"]
|
177
|
+
compiler.unreachable_cookbook?(:dependency1).should be_false
|
178
|
+
compiler.unreachable_cookbook?(:dependency2).should be_false
|
179
|
+
compiler.unreachable_cookbook?(:'test-with-deps').should be_false
|
180
|
+
compiler.unreachable_cookbook?(:'circular-dep1').should be_true
|
181
|
+
compiler.unreachable_cookbook?(:'circular-dep2').should be_true
|
182
|
+
end
|
183
|
+
|
184
|
+
|
173
185
|
end
|
174
186
|
end
|
@@ -79,6 +79,13 @@ describe Chef::RunContext do
|
|
79
79
|
@node.include_attribute("test::george")
|
80
80
|
end
|
81
81
|
|
82
|
+
it "raises an error when attempting to include_recipe from a cookbook not reachable by run list or dependencies" do
|
83
|
+
@node.should_receive(:loaded_recipe).with(:ancient, "aliens")
|
84
|
+
lambda do
|
85
|
+
@run_context.include_recipe("ancient::aliens")
|
86
|
+
# In CHEF-5120, this becomes a Chef::Exceptions::MissingCookbookDependency error:
|
87
|
+
end.should raise_error(Chef::Exceptions::CookbookNotFound)
|
88
|
+
end
|
82
89
|
|
83
90
|
end
|
84
91
|
|
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'chef/util/editor'
|
3
|
+
|
4
|
+
describe Chef::Util::Editor do
|
5
|
+
describe '#initialize' do
|
6
|
+
it 'takes an Enumerable of lines' do
|
7
|
+
editor = described_class.new(File.open(__FILE__))
|
8
|
+
expect(editor.lines).to be == IO.readlines(__FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'makes a copy of an Array' do
|
12
|
+
array = Array.new
|
13
|
+
editor = described_class.new(array)
|
14
|
+
expect(editor.lines).to_not be(array)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
subject(:editor) { described_class.new(input_lines) }
|
19
|
+
let(:input_lines) { ['one', 'two', 'two', 'three'] }
|
20
|
+
|
21
|
+
describe '#append_line_after' do
|
22
|
+
context 'when there is no match' do
|
23
|
+
subject(:execute) { editor.append_line_after('missing', 'new') }
|
24
|
+
|
25
|
+
it('returns the number of added lines') { should be == 0 }
|
26
|
+
it 'does not add any lines' do
|
27
|
+
expect { execute }.to_not change { editor.lines }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when there is a match' do
|
32
|
+
subject(:execute) { editor.append_line_after('two', 'new') }
|
33
|
+
|
34
|
+
it('returns the number of added lines') { should be == 2 }
|
35
|
+
it 'adds a line after each match' do
|
36
|
+
execute
|
37
|
+
expect(editor.lines).to be == ['one', 'two', 'new', 'two', 'new', 'three']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'matches a Regexp' do
|
42
|
+
expect(editor.append_line_after(/^ee/, 'new')).to be == 0
|
43
|
+
expect(editor.append_line_after(/ee$/, 'new')).to be == 1
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#append_line_if_missing' do
|
48
|
+
context 'when there is no match' do
|
49
|
+
subject(:execute) { editor.append_line_if_missing('missing', 'new') }
|
50
|
+
|
51
|
+
it('returns the number of added lines') { should be == 1 }
|
52
|
+
it 'adds a line to the end' do
|
53
|
+
execute
|
54
|
+
expect(editor.lines).to be == ['one', 'two', 'two', 'three', 'new']
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when there is a match' do
|
59
|
+
subject(:execute) { editor.append_line_if_missing('one', 'new') }
|
60
|
+
|
61
|
+
it('returns the number of added lines') { should be == 0 }
|
62
|
+
it 'does not add any lines' do
|
63
|
+
expect { execute }.to_not change { editor.lines }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'matches a Regexp' do
|
68
|
+
expect(editor.append_line_if_missing(/ee$/, 'new')).to be == 0
|
69
|
+
expect(editor.append_line_if_missing(/^ee/, 'new')).to be == 1
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#remove_lines' do
|
74
|
+
context 'when there is no match' do
|
75
|
+
subject(:execute) { editor.remove_lines('missing') }
|
76
|
+
|
77
|
+
it('returns the number of removed lines') { should be == 0 }
|
78
|
+
it 'does not remove any lines' do
|
79
|
+
expect { execute }.to_not change { editor.lines }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'when there is a match' do
|
84
|
+
subject(:execute) { editor.remove_lines('two') }
|
85
|
+
|
86
|
+
it('returns the number of removed lines') { should be == 2 }
|
87
|
+
it 'removes the matching lines' do
|
88
|
+
execute
|
89
|
+
expect(editor.lines).to be == ['one', 'three']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'matches a Regexp' do
|
94
|
+
expect(editor.remove_lines(/^ee/)).to be == 0
|
95
|
+
expect(editor.remove_lines(/ee$/)).to be == 1
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '#replace' do
|
100
|
+
context 'when there is no match' do
|
101
|
+
subject(:execute) { editor.replace('missing', 'new') }
|
102
|
+
|
103
|
+
it('returns the number of changed lines') { should be == 0 }
|
104
|
+
it 'does not change any lines' do
|
105
|
+
expect { execute }.to_not change { editor.lines }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when there is a match' do
|
110
|
+
subject(:execute) { editor.replace('two', 'new') }
|
111
|
+
|
112
|
+
it('returns the number of changed lines') { should be == 2 }
|
113
|
+
it 'replaces the matching portions' do
|
114
|
+
execute
|
115
|
+
expect(editor.lines).to be == ['one', 'new', 'new', 'three']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'matches a Regexp' do
|
120
|
+
expect(editor.replace(/^ee/, 'new')).to be == 0
|
121
|
+
expect(editor.replace(/ee$/, 'new')).to be == 1
|
122
|
+
expect(editor.lines).to be == ['one', 'two', 'two', 'thrnew']
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#replace_lines' do
|
127
|
+
context 'when there is no match' do
|
128
|
+
subject(:execute) { editor.replace_lines('missing', 'new') }
|
129
|
+
|
130
|
+
it('returns the number of changed lines') { should be == 0 }
|
131
|
+
it 'does not change any lines' do
|
132
|
+
expect { execute }.to_not change { editor.lines }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'when there is a match' do
|
137
|
+
subject(:execute) { editor.replace_lines('two', 'new') }
|
138
|
+
|
139
|
+
it('returns the number of replaced lines') { should be == 2 }
|
140
|
+
it 'replaces the matching line' do
|
141
|
+
execute
|
142
|
+
expect(editor.lines).to be == ['one', 'new', 'new', 'three']
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'matches a Regexp' do
|
147
|
+
expect(editor.replace_lines(/^ee/, 'new')).to be == 0
|
148
|
+
expect(editor.replace_lines(/ee$/, 'new')).to be == 1
|
149
|
+
expect(editor.lines).to be == ['one', 'two', 'two', 'new']
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'spec_helper'
|
20
|
+
require 'tempfile'
|
20
21
|
|
21
22
|
describe Chef::Util::FileEdit do
|
22
23
|
|
@@ -80,6 +81,17 @@ new line inserted
|
|
80
81
|
EOF
|
81
82
|
end
|
82
83
|
|
84
|
+
let(:append_twice) do
|
85
|
+
<<-EOF
|
86
|
+
127.0.0.1 localhost
|
87
|
+
255.255.255.255 broadcasthost
|
88
|
+
::1 localhost
|
89
|
+
fe80::1%lo0 localhost
|
90
|
+
once
|
91
|
+
twice
|
92
|
+
EOF
|
93
|
+
end
|
94
|
+
|
83
95
|
let(:target_file) do
|
84
96
|
f = Tempfile.open('file_edit_spec')
|
85
97
|
f.write(starting_content)
|
@@ -104,7 +116,7 @@ new line inserted
|
|
104
116
|
|
105
117
|
# CHEF-5018: people have monkey patched this and it has accidentally been broken
|
106
118
|
it "should read the contents into memory as an array" do
|
107
|
-
expect(fedit.send(:
|
119
|
+
expect(fedit.send(:editor).lines).to be_instance_of(Array)
|
108
120
|
end
|
109
121
|
end
|
110
122
|
|
@@ -123,18 +135,21 @@ new line inserted
|
|
123
135
|
describe "search_file_replace" do
|
124
136
|
it "should accept regex passed in as a string (not Regexp object) and replace the match if there is one" do
|
125
137
|
fedit.search_file_replace("localhost", "replacement")
|
138
|
+
fedit.unwritten_changes?.should be_true
|
126
139
|
fedit.write_file
|
127
140
|
expect(edited_file_contents).to eq(localhost_replaced)
|
128
141
|
end
|
129
142
|
|
130
143
|
it "should accept regex passed in as a Regexp object and replace the match if there is one" do
|
131
144
|
fedit.search_file_replace(/localhost/, "replacement")
|
145
|
+
fedit.unwritten_changes?.should be_true
|
132
146
|
fedit.write_file
|
133
147
|
expect(edited_file_contents).to eq(localhost_replaced)
|
134
148
|
end
|
135
149
|
|
136
150
|
it "should do nothing if there isn't a match" do
|
137
151
|
fedit.search_file_replace(/pattern/, "replacement")
|
152
|
+
fedit.unwritten_changes?.should be_false
|
138
153
|
fedit.write_file
|
139
154
|
expect(edited_file_contents).to eq(starting_content)
|
140
155
|
end
|
@@ -143,6 +158,7 @@ new line inserted
|
|
143
158
|
describe "search_file_replace_line" do
|
144
159
|
it "should search for match and replace the whole line" do
|
145
160
|
fedit.search_file_replace_line(/localhost/, "replacement line")
|
161
|
+
fedit.unwritten_changes?.should be_true
|
146
162
|
fedit.write_file
|
147
163
|
expect(edited_file_contents).to eq(localhost_line_replaced)
|
148
164
|
end
|
@@ -151,6 +167,7 @@ new line inserted
|
|
151
167
|
describe "search_file_delete" do
|
152
168
|
it "should search for match and delete the match" do
|
153
169
|
fedit.search_file_delete(/localhost/)
|
170
|
+
fedit.unwritten_changes?.should be_true
|
154
171
|
fedit.write_file
|
155
172
|
expect(edited_file_contents).to eq(localhost_deleted)
|
156
173
|
end
|
@@ -159,6 +176,7 @@ new line inserted
|
|
159
176
|
describe "search_file_delete_line" do
|
160
177
|
it "should search for match and delete the matching line" do
|
161
178
|
fedit.search_file_delete_line(/localhost/)
|
179
|
+
fedit.unwritten_changes?.should be_true
|
162
180
|
fedit.write_file
|
163
181
|
expect(edited_file_contents).to eq(localhost_line_deleted)
|
164
182
|
end
|
@@ -167,6 +185,7 @@ new line inserted
|
|
167
185
|
describe "insert_line_after_match" do
|
168
186
|
it "should search for match and insert the given line after the matching line" do
|
169
187
|
fedit.insert_line_after_match(/localhost/, "new line inserted")
|
188
|
+
fedit.unwritten_changes?.should be_true
|
170
189
|
fedit.write_file
|
171
190
|
expect(edited_file_contents).to eq(append_after_all_localhost)
|
172
191
|
end
|
@@ -175,14 +194,31 @@ new line inserted
|
|
175
194
|
describe "insert_line_if_no_match" do
|
176
195
|
it "should search for match and insert the given line if no line match" do
|
177
196
|
fedit.insert_line_if_no_match(/pattern/, "new line inserted")
|
197
|
+
fedit.unwritten_changes?.should be_true
|
178
198
|
fedit.write_file
|
179
199
|
expect(edited_file_contents).to eq(append_after_content)
|
180
200
|
end
|
181
201
|
|
182
202
|
it "should do nothing if there is a match" do
|
183
203
|
fedit.insert_line_if_no_match(/localhost/, "replacement")
|
204
|
+
fedit.unwritten_changes?.should be_false
|
184
205
|
fedit.write_file
|
185
206
|
expect(edited_file_contents).to eq(starting_content)
|
186
207
|
end
|
208
|
+
|
209
|
+
it "should work more than once" do
|
210
|
+
fedit.insert_line_if_no_match(/missing/, "once")
|
211
|
+
fedit.insert_line_if_no_match(/missing/, "twice")
|
212
|
+
fedit.write_file
|
213
|
+
expect(edited_file_contents).to eq(append_twice)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe "file_edited" do
|
218
|
+
it "should return true if a file got edited" do
|
219
|
+
fedit.insert_line_if_no_match(/pattern/, "new line inserted")
|
220
|
+
fedit.write_file
|
221
|
+
expect(fedit.file_edited?).to be_true
|
222
|
+
end
|
187
223
|
end
|
188
224
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.12.0.
|
4
|
+
version: 11.12.0.rc.1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-config
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: mixlib-shellout
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.4.0.rc.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.4.0.rc.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ohai
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 7.0.0.rc.
|
89
|
+
version: 7.0.0.rc.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 7.0.0.rc.
|
96
|
+
version: 7.0.0.rc.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rest-client
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,34 +250,20 @@ dependencies:
|
|
250
250
|
requirements:
|
251
251
|
- - "~>"
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: '
|
253
|
+
version: '2.0'
|
254
254
|
- - ">="
|
255
255
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
256
|
+
version: 2.0.2
|
257
257
|
type: :runtime
|
258
258
|
prerelease: false
|
259
259
|
version_requirements: !ruby/object:Gem::Requirement
|
260
260
|
requirements:
|
261
261
|
- - "~>"
|
262
262
|
- !ruby/object:Gem::Version
|
263
|
-
version: '
|
263
|
+
version: '2.0'
|
264
264
|
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
267
|
-
- !ruby/object:Gem::Dependency
|
268
|
-
name: puma
|
269
|
-
requirement: !ruby/object:Gem::Requirement
|
270
|
-
requirements:
|
271
|
-
- - "~>"
|
272
|
-
- !ruby/object:Gem::Version
|
273
|
-
version: '1.6'
|
274
|
-
type: :runtime
|
275
|
-
prerelease: false
|
276
|
-
version_requirements: !ruby/object:Gem::Requirement
|
277
|
-
requirements:
|
278
|
-
- - "~>"
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version: '1.6'
|
266
|
+
version: 2.0.2
|
281
267
|
- !ruby/object:Gem::Dependency
|
282
268
|
name: pry
|
283
269
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,16 +282,16 @@ dependencies:
|
|
296
282
|
name: rake
|
297
283
|
requirement: !ruby/object:Gem::Requirement
|
298
284
|
requirements:
|
299
|
-
- - "
|
285
|
+
- - "~>"
|
300
286
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
287
|
+
version: 10.1.0
|
302
288
|
type: :development
|
303
289
|
prerelease: false
|
304
290
|
version_requirements: !ruby/object:Gem::Requirement
|
305
291
|
requirements:
|
306
|
-
- - "
|
292
|
+
- - "~>"
|
307
293
|
- !ruby/object:Gem::Version
|
308
|
-
version:
|
294
|
+
version: 10.1.0
|
309
295
|
- !ruby/object:Gem::Dependency
|
310
296
|
name: rack
|
311
297
|
requirement: !ruby/object:Gem::Requirement
|
@@ -897,6 +883,8 @@ files:
|
|
897
883
|
- lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
|
898
884
|
- lib/chef/formatters/error_mapper.rb
|
899
885
|
- lib/chef/formatters/minimal.rb
|
886
|
+
- lib/chef/guard_interpreter/default_guard_interpreter.rb
|
887
|
+
- lib/chef/guard_interpreter/resource_guard_interpreter.rb
|
900
888
|
- lib/chef/handler.rb
|
901
889
|
- lib/chef/handler/error_report.rb
|
902
890
|
- lib/chef/handler/json_file.rb
|
@@ -1007,6 +995,8 @@ files:
|
|
1007
995
|
- lib/chef/knife/search.rb
|
1008
996
|
- lib/chef/knife/show.rb
|
1009
997
|
- lib/chef/knife/ssh.rb
|
998
|
+
- lib/chef/knife/ssl_check.rb
|
999
|
+
- lib/chef/knife/ssl_fetch.rb
|
1010
1000
|
- lib/chef/knife/status.rb
|
1011
1001
|
- lib/chef/knife/tag_create.rb
|
1012
1002
|
- lib/chef/knife/tag_delete.rb
|
@@ -1127,6 +1117,8 @@ files:
|
|
1127
1117
|
- lib/chef/provider/package/rubygems.rb
|
1128
1118
|
- lib/chef/provider/package/smartos.rb
|
1129
1119
|
- lib/chef/provider/package/solaris.rb
|
1120
|
+
- lib/chef/provider/package/windows.rb
|
1121
|
+
- lib/chef/provider/package/windows/msi.rb
|
1130
1122
|
- lib/chef/provider/package/yum-dump.py
|
1131
1123
|
- lib/chef/provider/package/yum.rb
|
1132
1124
|
- lib/chef/provider/package/zypper.rb
|
@@ -1233,6 +1225,7 @@ files:
|
|
1233
1225
|
- lib/chef/resource/timestamped_deploy.rb
|
1234
1226
|
- lib/chef/resource/user.rb
|
1235
1227
|
- lib/chef/resource/whyrun_safe_ruby_block.rb
|
1228
|
+
- lib/chef/resource/windows_package.rb
|
1236
1229
|
- lib/chef/resource/windows_script.rb
|
1237
1230
|
- lib/chef/resource/yum_package.rb
|
1238
1231
|
- lib/chef/resource_collection.rb
|
@@ -1269,6 +1262,7 @@ files:
|
|
1269
1262
|
- lib/chef/user.rb
|
1270
1263
|
- lib/chef/util/backup.rb
|
1271
1264
|
- lib/chef/util/diff.rb
|
1265
|
+
- lib/chef/util/editor.rb
|
1272
1266
|
- lib/chef/util/file_edit.rb
|
1273
1267
|
- lib/chef/util/selinux.rb
|
1274
1268
|
- lib/chef/util/windows.rb
|
@@ -1284,6 +1278,7 @@ files:
|
|
1284
1278
|
- lib/chef/win32/api.rb
|
1285
1279
|
- lib/chef/win32/api/error.rb
|
1286
1280
|
- lib/chef/win32/api/file.rb
|
1281
|
+
- lib/chef/win32/api/installer.rb
|
1287
1282
|
- lib/chef/win32/api/memory.rb
|
1288
1283
|
- lib/chef/win32/api/process.rb
|
1289
1284
|
- lib/chef/win32/api/psapi.rb
|
@@ -1543,6 +1538,10 @@ files:
|
|
1543
1538
|
- spec/data/ssl/key.pem
|
1544
1539
|
- spec/data/ssl/private_key.pem
|
1545
1540
|
- spec/data/ssl/private_key_with_whitespace.pem
|
1541
|
+
- spec/data/standalone_cookbook/Gemfile
|
1542
|
+
- spec/data/standalone_cookbook/chefignore
|
1543
|
+
- spec/data/standalone_cookbook/recipes/default.rb
|
1544
|
+
- spec/data/standalone_cookbook/vendor/bundle/ruby/2.0.0/gems/multi_json-1.9.0/lib/multi_json.rb
|
1546
1545
|
- spec/data/templates/seattle.txt
|
1547
1546
|
- spec/data/trusted_certs/example.crt
|
1548
1547
|
- spec/data/trusted_certs/intermediate.pem
|
@@ -1638,6 +1637,7 @@ files:
|
|
1638
1637
|
- spec/support/shared/functional/securable_resource.rb
|
1639
1638
|
- spec/support/shared/functional/securable_resource_with_reporting.rb
|
1640
1639
|
- spec/support/shared/functional/windows_script.rb
|
1640
|
+
- spec/support/shared/integration/app_server_support.rb
|
1641
1641
|
- spec/support/shared/integration/integration_helper.rb
|
1642
1642
|
- spec/support/shared/integration/knife_support.rb
|
1643
1643
|
- spec/support/shared/unit/api_error_inspector.rb
|
@@ -1701,9 +1701,12 @@ files:
|
|
1701
1701
|
- spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb
|
1702
1702
|
- spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
|
1703
1703
|
- spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb
|
1704
|
+
- spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
|
1704
1705
|
- spec/unit/handler/json_file_spec.rb
|
1705
1706
|
- spec/unit/handler_spec.rb
|
1707
|
+
- spec/unit/http/simple_spec.rb
|
1706
1708
|
- spec/unit/http/ssl_policies_spec.rb
|
1709
|
+
- spec/unit/http/validate_content_length_spec.rb
|
1707
1710
|
- spec/unit/http_spec.rb
|
1708
1711
|
- spec/unit/json_compat_spec.rb
|
1709
1712
|
- spec/unit/knife/bootstrap_spec.rb
|
@@ -1765,6 +1768,8 @@ files:
|
|
1765
1768
|
- spec/unit/knife/role_from_file_spec.rb
|
1766
1769
|
- spec/unit/knife/role_list_spec.rb
|
1767
1770
|
- spec/unit/knife/ssh_spec.rb
|
1771
|
+
- spec/unit/knife/ssl_check_spec.rb
|
1772
|
+
- spec/unit/knife/ssl_fetch_spec.rb
|
1768
1773
|
- spec/unit/knife/status_spec.rb
|
1769
1774
|
- spec/unit/knife/tag_create_spec.rb
|
1770
1775
|
- spec/unit/knife/tag_delete_spec.rb
|
@@ -1798,6 +1803,7 @@ files:
|
|
1798
1803
|
- spec/unit/node/attribute_spec.rb
|
1799
1804
|
- spec/unit/node/immutable_collections_spec.rb
|
1800
1805
|
- spec/unit/node_spec.rb
|
1806
|
+
- spec/unit/platform/query_helpers_spec.rb
|
1801
1807
|
- spec/unit/platform_spec.rb
|
1802
1808
|
- spec/unit/policy_builder/expand_node_object_spec.rb
|
1803
1809
|
- spec/unit/policy_builder/policyfile_spec.rb
|
@@ -1851,6 +1857,8 @@ files:
|
|
1851
1857
|
- spec/unit/provider/package/rubygems_spec.rb
|
1852
1858
|
- spec/unit/provider/package/smartos_spec.rb
|
1853
1859
|
- spec/unit/provider/package/solaris_spec.rb
|
1860
|
+
- spec/unit/provider/package/windows/msi_spec.rb
|
1861
|
+
- spec/unit/provider/package/windows_spec.rb
|
1854
1862
|
- spec/unit/provider/package/yum_spec.rb
|
1855
1863
|
- spec/unit/provider/package/zypper_spec.rb
|
1856
1864
|
- spec/unit/provider/package_spec.rb
|
@@ -1893,6 +1901,7 @@ files:
|
|
1893
1901
|
- spec/unit/provider/user_spec.rb
|
1894
1902
|
- spec/unit/provider/whyrun_safe_ruby_block_spec.rb
|
1895
1903
|
- spec/unit/provider_spec.rb
|
1904
|
+
- spec/unit/pure_application_spec.rb
|
1896
1905
|
- spec/unit/recipe_spec.rb
|
1897
1906
|
- spec/unit/registry_helper_spec.rb
|
1898
1907
|
- spec/unit/resource/apt_package_spec.rb
|
@@ -1949,6 +1958,7 @@ files:
|
|
1949
1958
|
- spec/unit/resource/template_spec.rb
|
1950
1959
|
- spec/unit/resource/timestamped_deploy_spec.rb
|
1951
1960
|
- spec/unit/resource/user_spec.rb
|
1961
|
+
- spec/unit/resource/windows_package_spec.rb
|
1952
1962
|
- spec/unit/resource/yum_package_spec.rb
|
1953
1963
|
- spec/unit/resource_collection/stepable_iterator_spec.rb
|
1954
1964
|
- spec/unit/resource_collection_spec.rb
|
@@ -1978,6 +1988,7 @@ files:
|
|
1978
1988
|
- spec/unit/user_spec.rb
|
1979
1989
|
- spec/unit/util/backup_spec.rb
|
1980
1990
|
- spec/unit/util/diff_spec.rb
|
1991
|
+
- spec/unit/util/editor_spec.rb
|
1981
1992
|
- spec/unit/util/file_edit_spec.rb
|
1982
1993
|
- spec/unit/util/selinux_spec.rb
|
1983
1994
|
- spec/unit/version/platform_spec.rb
|