chef 13.0.118-universal-mingw32 → 13.1.31-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -27
- data/VERSION +1 -1
- data/acceptance/.bundle/config +2 -0
- data/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb +1 -1
- data/acceptance/bin/aws.rb +17 -0
- data/acceptance/bin/berks +17 -0
- data/acceptance/bin/bundler +17 -0
- data/acceptance/bin/chef-acceptance +17 -0
- data/acceptance/bin/coderay +17 -0
- data/acceptance/bin/erubis +17 -0
- data/acceptance/bin/htmldiff +17 -0
- data/acceptance/bin/httpclient +17 -0
- data/acceptance/bin/inspec +17 -0
- data/acceptance/bin/kitchen +17 -0
- data/acceptance/bin/ldiff +17 -0
- data/acceptance/bin/nokogiri +17 -0
- data/acceptance/bin/pry +17 -0
- data/acceptance/bin/rake +17 -0
- data/acceptance/bin/rspec +17 -0
- data/acceptance/bin/rwinrm +17 -0
- data/acceptance/bin/rwinrmcp +17 -0
- data/acceptance/bin/safe_yaml +17 -0
- data/acceptance/bin/thor +17 -0
- data/acceptance/fips/.kitchen/fips-unit-functional-centos-6.yml +7 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/id +1 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/Vagrantfile +11 -0
- data/acceptance/fips/.kitchen/logs/fips-integration-centos-6.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-integration-windows-2012r2.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-unit-functional-centos-6.log +80 -0
- data/acceptance/fips/.kitchen/logs/kitchen.log +4 -0
- data/chef.gemspec +1 -1
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/knife.rb +1 -1
- data/lib/chef/application/solo.rb +1 -0
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +20 -7
- data/lib/chef/cookbook_manifest.rb +8 -0
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/knife/client_key_create.rb +3 -0
- data/lib/chef/knife/client_key_delete.rb +1 -0
- data/lib/chef/knife/client_key_edit.rb +1 -0
- data/lib/chef/knife/client_key_list.rb +1 -0
- data/lib/chef/knife/client_key_show.rb +1 -0
- data/lib/chef/knife/user_key_create.rb +1 -0
- data/lib/chef/knife/user_key_delete.rb +1 -0
- data/lib/chef/knife/user_key_edit.rb +1 -0
- data/lib/chef/knife/user_key_list.rb +1 -0
- data/lib/chef/knife/user_key_show.rb +1 -0
- data/lib/chef/local_mode.rb +1 -0
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +7 -4
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/package/cab.rb +18 -13
- data/lib/chef/provider/package/msu.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +3 -5
- data/lib/chef/provider/user/aix.rb +1 -1
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/resource/breakpoint.rb +12 -0
- data/lib/chef/resource/env.rb +3 -35
- data/lib/chef/resource/route.rb +13 -107
- data/lib/chef/resource/service.rb +5 -5
- data/lib/chef/resource/user.rb +6 -4
- data/lib/chef/resource/windows_task.rb +3 -3
- data/lib/chef/run_context.rb +7 -0
- data/lib/chef/runner.rb +2 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/chocolatey_package_spec.rb +1 -8
- data/spec/functional/resource/registry_spec.rb +1 -1
- data/spec/functional/resource/user/useradd_spec.rb +1 -1
- data/spec/functional/resource/windows_task_spec.rb +459 -0
- data/spec/integration/client/client_spec.rb +32 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/platform_helpers.rb +7 -0
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
- data/spec/unit/cookbook/synchronizer_spec.rb +5 -4
- data/spec/unit/cookbook_manifest_spec.rb +17 -2
- data/spec/unit/provider/env_spec.rb +2 -2
- data/spec/unit/provider/group/dscl_spec.rb +2 -2
- data/spec/unit/provider/group/pw_spec.rb +3 -3
- data/spec/unit/provider/group/usermod_spec.rb +6 -6
- data/spec/unit/provider/group/windows_spec.rb +3 -3
- data/spec/unit/provider/group_spec.rb +4 -4
- data/spec/unit/provider/http_request_spec.rb +1 -1
- data/spec/unit/provider/package/aix_spec.rb +2 -2
- data/spec/unit/provider/package/apt_spec.rb +2 -2
- data/spec/unit/provider/package/ips_spec.rb +2 -2
- data/spec/unit/provider/package/macports_spec.rb +4 -4
- data/spec/unit/provider/package/pacman_spec.rb +2 -2
- data/spec/unit/provider/package/rubygems_spec.rb +14 -11
- data/spec/unit/provider/package/yum_spec.rb +10 -10
- data/spec/unit/provider/route_spec.rb +7 -7
- data/spec/unit/provider/service/arch_service_spec.rb +6 -6
- data/spec/unit/provider/service/init_service_spec.rb +2 -2
- data/spec/unit/provider/service/invokercd_service_spec.rb +1 -1
- data/spec/unit/provider/service/simple_service_spec.rb +1 -1
- data/spec/unit/provider/service/upstart_service_spec.rb +5 -5
- data/spec/unit/provider/service_spec.rb +1 -1
- data/spec/unit/provider/user/aix_spec.rb +97 -0
- data/spec/unit/provider/user/pw_spec.rb +5 -5
- data/spec/unit/provider/user_spec.rb +1 -1
- data/spec/unit/provider_resolver_spec.rb +11 -11
- data/spec/unit/resource/breakpoint_spec.rb +28 -11
- data/spec/unit/resource/windows_task_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +4 -0
- data/tasks/bin/run_external_test +20 -42
- data/tasks/bundle.rb +0 -8
- data/tasks/changelog.rb +5 -1
- data/tasks/dependencies.rb +4 -2
- metadata +80 -19
- data/acceptance/fips/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/fips/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/fips/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/fips/.kitchen.yml +0 -8
- data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +0 -9
- data/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb +0 -52
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +0 -7
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb +0 -56
- data/lib/chef/provider/breakpoint.rb +0 -38
- data/spec/unit/provider/breakpoint_spec.rb +0 -53
- data/tasks/bin/create-override-gemfile +0 -110
- data/tasks/gemfile_util.rb +0 -390
@@ -306,6 +306,7 @@ local_mode true
|
|
306
306
|
cookbook_path "#{path_to('cookbooks')}"
|
307
307
|
EOM
|
308
308
|
result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", :cwd => chef_dir)
|
309
|
+
result.error!
|
309
310
|
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true
|
310
311
|
end
|
311
312
|
|
@@ -315,6 +316,7 @@ local_mode true
|
|
315
316
|
cookbook_path "#{path_to('cookbooks')}"
|
316
317
|
EOM
|
317
318
|
result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
|
319
|
+
result.error!
|
318
320
|
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false
|
319
321
|
end
|
320
322
|
end
|
@@ -464,6 +466,36 @@ end
|
|
464
466
|
end
|
465
467
|
end
|
466
468
|
|
469
|
+
when_the_repository "has a cookbook that deploys a file" do
|
470
|
+
before do
|
471
|
+
file "cookbooks/x/recipes/default.rb", <<-RECIPE
|
472
|
+
cookbook_file #{path_to('tempfile.txt').inspect} do
|
473
|
+
source "my_file"
|
474
|
+
end
|
475
|
+
RECIPE
|
476
|
+
|
477
|
+
file "cookbooks/x/files/my_file", <<-FILE
|
478
|
+
this is my file
|
479
|
+
FILE
|
480
|
+
end
|
481
|
+
|
482
|
+
[true, false].each do |lazy|
|
483
|
+
context "with no_lazy_load set to #{lazy}" do
|
484
|
+
it "should create the file" do
|
485
|
+
file "config/client.rb", <<EOM
|
486
|
+
no_lazy_load #{lazy}
|
487
|
+
local_mode true
|
488
|
+
cookbook_path "#{path_to('cookbooks')}"
|
489
|
+
EOM
|
490
|
+
result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
|
491
|
+
result.error!
|
492
|
+
|
493
|
+
expect(IO.read(path_to("tempfile.txt")).strip).to eq("this is my file")
|
494
|
+
end
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
467
499
|
when_the_repository "has a cookbook with an ohai plugin" do
|
468
500
|
before do
|
469
501
|
file "cookbooks/x/recipes/default.rb", <<-RECIPE
|
data/spec/spec_helper.rb
CHANGED
@@ -182,6 +182,8 @@ RSpec.configure do |config|
|
|
182
182
|
config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION)
|
183
183
|
config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
|
184
184
|
|
185
|
+
config.filter_run_excluding :choco_installed => true unless choco_installed?
|
186
|
+
|
185
187
|
running_platform_arch = `uname -m`.strip unless windows?
|
186
188
|
|
187
189
|
config.filter_run_excluding :arch => lambda { |target_arch|
|
@@ -2,9 +2,11 @@ require "fcntl"
|
|
2
2
|
require "chef/mixin/shell_out"
|
3
3
|
require "ohai/mixin/http_helper"
|
4
4
|
require "ohai/mixin/gce_metadata"
|
5
|
+
require "chef/mixin/powershell_out"
|
5
6
|
|
6
7
|
class ShellHelpers
|
7
8
|
extend Chef::Mixin::ShellOut
|
9
|
+
extend Chef::Mixin::PowershellOut
|
8
10
|
end
|
9
11
|
|
10
12
|
# magic stolen from bundler/spec/support/less_than_proc.rb
|
@@ -231,3 +233,8 @@ def gce?
|
|
231
233
|
rescue SocketError
|
232
234
|
false
|
233
235
|
end
|
236
|
+
|
237
|
+
def choco_installed?
|
238
|
+
result = ShellHelpers.powershell_out("choco --version")
|
239
|
+
result.stderr.empty? ? true : false
|
240
|
+
end
|
@@ -75,9 +75,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should set the option for #{attribute} if the new resources #{attribute} is not nil, without homedir management (using real attributes)" do
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
@new_resource.manage_home(false)
|
79
|
+
@new_resource.non_unique(false)
|
80
|
+
@new_resource.non_unique(false)
|
81
81
|
allow(@new_resource).to receive(attribute).and_return("hola")
|
82
82
|
expect(provider.universal_options).to eql([option, "hola"])
|
83
83
|
end
|
@@ -118,6 +118,7 @@ describe Chef::CookbookSynchronizer do
|
|
118
118
|
|
119
119
|
let(:synchronizer) do
|
120
120
|
Chef::Config[:no_lazy_load] = no_lazy_load
|
121
|
+
Chef::Config[:file_cache_path] = "/file-cache"
|
121
122
|
Chef::CookbookSynchronizer.new(cookbook_manifest, events)
|
122
123
|
end
|
123
124
|
|
@@ -292,7 +293,7 @@ describe Chef::CookbookSynchronizer do
|
|
292
293
|
# Current file has fff000, want abc123
|
293
294
|
expect(Chef::CookbookVersion).to receive(:checksum_cookbook_file).
|
294
295
|
with("/file-cache/cookbooks/cookbook_a/recipes/default.rb").
|
295
|
-
and_return("fff000")
|
296
|
+
and_return("fff000").at_least(:once)
|
296
297
|
|
297
298
|
# Fetch and copy default.rb attribute file
|
298
299
|
expect(server_api).to receive(:streaming_request).
|
@@ -308,7 +309,7 @@ describe Chef::CookbookSynchronizer do
|
|
308
309
|
# Current file has fff000, want abc456
|
309
310
|
expect(Chef::CookbookVersion).to receive(:checksum_cookbook_file).
|
310
311
|
with("/file-cache/cookbooks/cookbook_a/attributes/default.rb").
|
311
|
-
and_return("fff000")
|
312
|
+
and_return("fff000").at_least(:once)
|
312
313
|
end
|
313
314
|
|
314
315
|
def setup_no_lazy_files_and_templates_chksum_mismatch_expectations
|
@@ -365,12 +366,12 @@ describe Chef::CookbookSynchronizer do
|
|
365
366
|
# Current file has abc123, want abc123
|
366
367
|
expect(Chef::CookbookVersion).to receive(:checksum_cookbook_file).
|
367
368
|
with("/file-cache/cookbooks/cookbook_a/recipes/default.rb").
|
368
|
-
and_return("abc123")
|
369
|
+
and_return("abc123").at_least(:once)
|
369
370
|
|
370
371
|
# Current file has abc456, want abc456
|
371
372
|
expect(Chef::CookbookVersion).to receive(:checksum_cookbook_file).
|
372
373
|
with("/file-cache/cookbooks/cookbook_a/attributes/default.rb").
|
373
|
-
and_return("abc456")
|
374
|
+
and_return("abc456").at_least(:once)
|
374
375
|
|
375
376
|
# :load called twice
|
376
377
|
expect(file_cache).to receive(:load).
|
@@ -114,7 +114,7 @@ describe Chef::CookbookManifest do
|
|
114
114
|
|
115
115
|
let(:match_md5) { /[0-9a-f]{32}/ }
|
116
116
|
|
117
|
-
def map_to_file_specs(paths)
|
117
|
+
def map_to_file_specs(paths, full: false)
|
118
118
|
paths.map do |path|
|
119
119
|
|
120
120
|
relative_path = Pathname.new(path).relative_path_from(Pathname.new(cookbook_root)).to_s
|
@@ -131,7 +131,11 @@ describe Chef::CookbookManifest do
|
|
131
131
|
"path" => relative_path,
|
132
132
|
"checksum" => Chef::Digester.generate_md5_checksum_for_file(path),
|
133
133
|
"specificity" => "default",
|
134
|
-
}
|
134
|
+
}.tap do |fp|
|
135
|
+
if full
|
136
|
+
fp["full_path"] = path
|
137
|
+
end
|
138
|
+
end
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
@@ -163,6 +167,17 @@ describe Chef::CookbookManifest do
|
|
163
167
|
end
|
164
168
|
end
|
165
169
|
|
170
|
+
context ".each_file" do
|
171
|
+
it "yields all the files" do
|
172
|
+
files = map_to_file_specs(all_files, full: true)
|
173
|
+
expect(cookbook_manifest.to_enum(:each_file)).to match_array(files)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "excludes certain file parts" do
|
177
|
+
files = map_to_file_specs(all_files, full: true).reject { |f| seg = f["name"].split("/")[0]; %w{ files templates }.include?(seg) }
|
178
|
+
expect(cookbook_manifest.to_enum(:each_file, excluded_parts: %w{ files templates })).to match_array(files)
|
179
|
+
end
|
180
|
+
end
|
166
181
|
end
|
167
182
|
|
168
183
|
describe "providing upstream URLs for save" do
|
@@ -183,12 +183,12 @@ describe Chef::Provider::Env do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
it "should return true if the element is not found" do
|
186
|
-
|
186
|
+
@new_resource.value("C:/baz/bin")
|
187
187
|
expect(@provider.delete_element).to eql(true)
|
188
188
|
end
|
189
189
|
|
190
190
|
it "should return false if the delim not defined" do
|
191
|
-
|
191
|
+
@new_resource.delim(nil)
|
192
192
|
expect(@provider.delete_element).to eql(false)
|
193
193
|
end
|
194
194
|
|
@@ -182,8 +182,8 @@ describe Chef::Provider::Group::Dscl do
|
|
182
182
|
|
183
183
|
describe "with existing members in the current resource and append set to false in the new resource" do
|
184
184
|
before do
|
185
|
-
|
186
|
-
|
185
|
+
@new_resource.members([])
|
186
|
+
@new_resource.append(false)
|
187
187
|
allow(@current_resource).to receive(:members).and_return(%w{all your base})
|
188
188
|
end
|
189
189
|
|
@@ -77,7 +77,7 @@ describe Chef::Provider::Group::Pw do
|
|
77
77
|
|
78
78
|
describe "with an empty members array in both the new and current resource" do
|
79
79
|
before do
|
80
|
-
|
80
|
+
@new_resource.members([])
|
81
81
|
allow(@current_resource).to receive(:members).and_return([])
|
82
82
|
end
|
83
83
|
|
@@ -88,7 +88,7 @@ describe Chef::Provider::Group::Pw do
|
|
88
88
|
|
89
89
|
describe "with an empty members array in the new resource and existing members in the current resource" do
|
90
90
|
before do
|
91
|
-
|
91
|
+
@new_resource.members([])
|
92
92
|
allow(@current_resource).to receive(:members).and_return(%w{all your base})
|
93
93
|
end
|
94
94
|
|
@@ -104,7 +104,7 @@ describe Chef::Provider::Group::Pw do
|
|
104
104
|
|
105
105
|
describe "with supplied members array in the new resource and an empty members array in the current resource" do
|
106
106
|
before do
|
107
|
-
|
107
|
+
@new_resource.members(%w{all your base})
|
108
108
|
allow(@current_resource).to receive(:members).and_return([])
|
109
109
|
end
|
110
110
|
|
@@ -34,8 +34,8 @@ describe Chef::Provider::Group::Usermod do
|
|
34
34
|
|
35
35
|
describe "with an empty members array" do
|
36
36
|
before do
|
37
|
-
|
38
|
-
|
37
|
+
@new_resource.append(true)
|
38
|
+
@new_resource.members([])
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should log an appropriate message" do
|
@@ -56,7 +56,7 @@ describe Chef::Provider::Group::Usermod do
|
|
56
56
|
}
|
57
57
|
|
58
58
|
before do
|
59
|
-
|
59
|
+
@new_resource.members(%w{all your base})
|
60
60
|
allow(File).to receive(:exist?).and_return(true)
|
61
61
|
end
|
62
62
|
|
@@ -73,8 +73,8 @@ describe Chef::Provider::Group::Usermod do
|
|
73
73
|
@provider.load_current_resource
|
74
74
|
@provider.instance_variable_set("@group_exists", true)
|
75
75
|
@provider.action = :modify
|
76
|
-
|
77
|
-
|
76
|
+
@new_resource.append(true)
|
77
|
+
@new_resource.excluded_members(["someone"])
|
78
78
|
expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "excluded_members is not supported by #{@provider}")
|
79
79
|
end
|
80
80
|
|
@@ -84,7 +84,7 @@ describe Chef::Provider::Group::Usermod do
|
|
84
84
|
current_resource.members([ ])
|
85
85
|
@provider.current_resource = current_resource
|
86
86
|
@node.automatic_attrs[:platform] = platform
|
87
|
-
|
87
|
+
@new_resource.append(true)
|
88
88
|
expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "all")
|
89
89
|
expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "your")
|
90
90
|
expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "base")
|
@@ -62,19 +62,19 @@ describe Chef::Provider::Group::Windows do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should call @net_group.local_set_members" do
|
65
|
-
|
65
|
+
@new_resource.append(false)
|
66
66
|
expect(@net_group).to receive(:local_set_members).with(@new_resource.members)
|
67
67
|
@provider.manage_group
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should call @net_group.local_add_members" do
|
71
|
-
|
71
|
+
@new_resource.append(true)
|
72
72
|
expect(@net_group).to receive(:local_add_members).with(@new_resource.members)
|
73
73
|
@provider.manage_group
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should call @net_group.local_delete_members" do
|
77
|
-
|
77
|
+
@new_resource.append(true)
|
78
78
|
allow(@provider).to receive(:lookup_account_name).with("all").and_return("all")
|
79
79
|
expect(@net_group).to receive(:local_delete_members).with(@new_resource.excluded_members)
|
80
80
|
@provider.manage_group
|
@@ -103,26 +103,26 @@ describe Chef::Provider::User do
|
|
103
103
|
|
104
104
|
it "should return false if append is true and the group member(s) already exists" do
|
105
105
|
@current_resource.members << "extra_user"
|
106
|
-
|
106
|
+
@new_resource.append(true)
|
107
107
|
expect(@provider.compare_group).to be_falsey
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should return true if append is true and the group member(s) do not already exist" do
|
111
111
|
@new_resource.members << "extra_user"
|
112
|
-
|
112
|
+
@new_resource.append(true)
|
113
113
|
expect(@provider.compare_group).to be_truthy
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should return false if append is true and excluded_members include a non existing member" do
|
117
117
|
@new_resource.excluded_members << "extra_user"
|
118
|
-
|
118
|
+
@new_resource.append(true)
|
119
119
|
expect(@provider.compare_group).to be_falsey
|
120
120
|
end
|
121
121
|
|
122
122
|
it "should return true if the append is true and excluded_members include an existing user" do
|
123
123
|
@new_resource.members.each { |m| @new_resource.excluded_members << m }
|
124
124
|
@new_resource.members.clear
|
125
|
-
|
125
|
+
@new_resource.append(true)
|
126
126
|
expect(@provider.compare_group).to be_truthy
|
127
127
|
end
|
128
128
|
|
@@ -73,7 +73,7 @@ describe Chef::Provider::HttpRequest do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should inflate a message block at runtime" do
|
76
|
-
|
76
|
+
@new_resource.message(lambda { "return" })
|
77
77
|
expect(@http).to receive(:put).with("http://www.opscode.com/", "return", {})
|
78
78
|
@provider.run_action(:put)
|
79
79
|
expect(@new_resource).to be_updated
|
@@ -163,7 +163,7 @@ describe Chef::Provider::Package::Aix do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should run installp with -eLogfile option." do
|
166
|
-
|
166
|
+
@new_resource.options("-e/tmp/installp.log")
|
167
167
|
expect(@provider).to receive(:shell_out!).with("installp", "-aYF", "-e/tmp/installp.log", "-d", "/tmp/samba.base", "samba.base", timeout: 900)
|
168
168
|
@provider.install_package("samba.base", "3.3.12.0")
|
169
169
|
end
|
@@ -176,7 +176,7 @@ describe Chef::Provider::Package::Aix do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should run installp -u -e/tmp/installp.log with options -e/tmp/installp.log" do
|
179
|
-
|
179
|
+
@new_resource.options("-e/tmp/installp.log")
|
180
180
|
expect(@provider).to receive(:shell_out!).with("installp", "-u", "-e/tmp/installp.log", "samba.base", timeout: 900)
|
181
181
|
@provider.remove_package("samba.base", "3.3.12.0")
|
182
182
|
end
|
@@ -217,8 +217,8 @@ mpg123 1.12.1-0ubuntu1
|
|
217
217
|
@new_resource = Chef::Resource::AptPackage.new("irssi", @run_context)
|
218
218
|
@provider = Chef::Provider::Package::Apt.new(@new_resource, @run_context)
|
219
219
|
|
220
|
-
|
221
|
-
|
220
|
+
@new_resource.default_release("lenny-backports")
|
221
|
+
@new_resource.provider(nil)
|
222
222
|
expect(@provider).to receive(:shell_out!).with(
|
223
223
|
"apt-cache", "-o", "APT::Default-Release=lenny-backports", "policy", "irssi",
|
224
224
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
@@ -134,7 +134,7 @@ INSTALLED
|
|
134
134
|
|
135
135
|
it "raises an error if package fails to install" do
|
136
136
|
expect(@provider).to receive(:shell_out!).with("pkg", "--no-refresh", "install", "-q", "crypto/gnupg@2.0.17", timeout: 900).and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
137
|
-
|
137
|
+
@new_resource.options("--no-refresh")
|
138
138
|
expect { @provider.install_package("crypto/gnupg", "2.0.17") }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
139
139
|
end
|
140
140
|
|
@@ -201,7 +201,7 @@ REMOTE
|
|
201
201
|
|
202
202
|
context "when accept_license is true" do
|
203
203
|
before do
|
204
|
-
|
204
|
+
@new_resource.accept_license(true)
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should run pkg install with the --accept flag" do
|
@@ -121,7 +121,7 @@ EOF
|
|
121
121
|
it "should add options to the port command when specified" do
|
122
122
|
expect(@current_resource).to receive(:version).and_return("4.1.6")
|
123
123
|
@provider.current_resource = @current_resource
|
124
|
-
|
124
|
+
@new_resource.options("-f")
|
125
125
|
expect(@provider).to receive(:shell_out!).with("port", "-f", "install", "zsh", "@4.2.7", timeout: 900)
|
126
126
|
|
127
127
|
@provider.install_package("zsh", "4.2.7")
|
@@ -140,7 +140,7 @@ EOF
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should add options to the port command when specified" do
|
143
|
-
|
143
|
+
@new_resource.options("-f")
|
144
144
|
expect(@provider).to receive(:shell_out!).with("port", "-f", "uninstall", "zsh", "@4.2.7", timeout: 900)
|
145
145
|
@provider.purge_package("zsh", "4.2.7")
|
146
146
|
end
|
@@ -158,7 +158,7 @@ EOF
|
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should add options to the port command when specified" do
|
161
|
-
|
161
|
+
@new_resource.options("-f")
|
162
162
|
expect(@provider).to receive(:shell_out!).with("port", "-f", "deactivate", "zsh", "@4.2.7", timeout: 900)
|
163
163
|
@provider.remove_package("zsh", "4.2.7")
|
164
164
|
end
|
@@ -191,7 +191,7 @@ EOF
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "should add options to the port command when specified" do
|
194
|
-
|
194
|
+
@new_resource.options("-f")
|
195
195
|
expect(@current_resource).to receive(:version).at_least(:once).and_return("4.1.6")
|
196
196
|
@provider.current_resource = @current_resource
|
197
197
|
|
@@ -157,7 +157,7 @@ PACMAN_CONF
|
|
157
157
|
|
158
158
|
it "should run pacman install with the package name and version and options if specified" do
|
159
159
|
expect(@provider).to receive(:shell_out!).with("pacman", "--sync", "--noconfirm", "--noprogressbar", "--debug", "nano", { timeout: 900 })
|
160
|
-
|
160
|
+
@new_resource.options("--debug")
|
161
161
|
|
162
162
|
@provider.install_package("nano", "1.0")
|
163
163
|
end
|
@@ -178,7 +178,7 @@ PACMAN_CONF
|
|
178
178
|
|
179
179
|
it "should run pacman remove with the package name and options if specified" do
|
180
180
|
expect(@provider).to receive(:shell_out!).with("pacman", "--remove", "--noconfirm", "--noprogressbar", "--debug", "nano", { timeout: 900 })
|
181
|
-
|
181
|
+
@new_resource.options("--debug")
|
182
182
|
|
183
183
|
@provider.remove_package("nano", "1.0")
|
184
184
|
end
|
@@ -338,7 +338,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
338
338
|
let(:target_version) { nil }
|
339
339
|
let(:gem_name) { "rspec-core" }
|
340
340
|
let(:gem_binary) { nil }
|
341
|
-
let(:bindir) { "/usr/bin
|
341
|
+
let(:bindir) { "/usr/bin" }
|
342
342
|
let(:options) { nil }
|
343
343
|
let(:source) { nil }
|
344
344
|
let(:include_default_source) { true }
|
@@ -372,6 +372,8 @@ describe Chef::Provider::Package::Rubygems do
|
|
372
372
|
allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(bindir)
|
373
373
|
# Rubygems uses this interally
|
374
374
|
allow(RbConfig::CONFIG).to receive(:[]).with("arch").and_call_original
|
375
|
+
allow(File).to receive(:executable?).and_return false
|
376
|
+
allow(File).to receive(:executable?).with("#{bindir}/gem").and_return true
|
375
377
|
end
|
376
378
|
|
377
379
|
describe "when new_resource version is nil" do
|
@@ -439,9 +441,9 @@ describe Chef::Provider::Package::Rubygems do
|
|
439
441
|
it "searches for a gem binary when running on Omnibus on Unix" do
|
440
442
|
platform_mock :unix do
|
441
443
|
allow(ENV).to receive(:[]).with("PATH").and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
|
442
|
-
allow(File).to receive(:
|
443
|
-
allow(File).to receive(:
|
444
|
-
allow(File).to receive(:
|
444
|
+
allow(File).to receive(:executable?).with("/usr/bin/gem").and_return(false)
|
445
|
+
allow(File).to receive(:executable?).with("/usr/sbin/gem").and_return(true)
|
446
|
+
allow(File).to receive(:executable?).with("/opt/chef/embedded/bin/gem").and_return(true) # should not get here
|
445
447
|
expect(provider.gem_env.gem_binary_location).to eq("/usr/sbin/gem")
|
446
448
|
end
|
447
449
|
end
|
@@ -451,13 +453,14 @@ describe Chef::Provider::Package::Rubygems do
|
|
451
453
|
|
452
454
|
it "searches for a gem binary when running on Omnibus on Windows" do
|
453
455
|
platform_mock :windows do
|
454
|
-
allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin
|
455
|
-
allow(File).to receive(:
|
456
|
-
allow(File).to receive(:
|
457
|
-
allow(File).to receive(:
|
458
|
-
allow(File).to receive(:
|
459
|
-
allow(File).to receive(:
|
460
|
-
|
456
|
+
allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin')
|
457
|
+
allow(File).to receive(:executable?).with('C:\\windows\\system32/gem').and_return(false)
|
458
|
+
allow(File).to receive(:executable?).with('C:\\windows/gem').and_return(false)
|
459
|
+
allow(File).to receive(:executable?).with('C:\\Ruby186\\bin/gem').and_return(true)
|
460
|
+
allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here
|
461
|
+
allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here
|
462
|
+
allow(File).to receive(:executable?).with("d:/opscode/chef/embedded/bin/gem").and_return(false) # should not get here
|
463
|
+
expect(provider.gem_env.gem_binary_location).to eq('C:\Ruby186\bin/gem')
|
461
464
|
end
|
462
465
|
end
|
463
466
|
end
|