chef 15.12.22-universal-mingw32 → 15.16.4-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 +10 -10
- data/Rakefile +11 -17
- data/chef-universal-mingw32.gemspec +4 -4
- data/chef.gemspec +22 -4
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/deprecated.rb +4 -0
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife/bootstrap.rb +3 -3
- data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +20 -1
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mixin/openssl_helper.rb +26 -3
- data/lib/chef/mixin/template.rb +1 -0
- data/lib/chef/node_map.rb +5 -2
- data/lib/chef/provider/mount/solaris.rb +0 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +5 -0
- data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
- data/lib/chef/provider/package/yum/yum_helper.py +4 -0
- data/lib/chef/provider/package/zypper.rb +0 -1
- data/lib/chef/provider/service/arch.rb +2 -2
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +1 -1
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +1 -1
- data/lib/chef/provider/zypper_repository.rb +1 -1
- data/lib/chef/resource.rb +2 -0
- data/lib/chef/resource/cron_access.rb +2 -2
- data/lib/chef/resource/cron_d.rb +2 -1
- data/lib/chef/resource/homebrew_cask.rb +3 -3
- data/lib/chef/resource/hostname.rb +18 -18
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +7 -0
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sudo.rb +2 -2
- data/lib/chef/resource/windows_feature_powershell.rb +6 -2
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shell.rb +32 -1
- data/lib/chef/shell/shell_session.rb +2 -0
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/version_string.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/resource/aix_service_spec.rb +0 -1
- data/spec/functional/resource/aixinit_service_spec.rb +7 -8
- data/spec/functional/resource/apt_package_spec.rb +0 -1
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/cron_spec.rb +0 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/insserv_spec.rb +4 -5
- data/spec/functional/resource/link_spec.rb +17 -17
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +1 -1
- data/spec/functional/resource/user/mac_user_spec.rb +1 -1
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/run_lock_spec.rb +2 -1
- data/spec/functional/shell_spec.rb +5 -5
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/recipes/accumulator_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
- data/spec/integration/recipes/lwrp_spec.rb +1 -1
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/notifying_block_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
- data/spec/integration/recipes/resource_load_spec.rb +1 -0
- data/spec/integration/recipes/unified_mode_spec.rb +1 -1
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- data/spec/support/platform_helpers.rb +12 -42
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +2 -2
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/knife_support.rb +2 -5
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
- data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
- data/spec/unit/knife/bootstrap_spec.rb +14 -14
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +5 -3
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mixin/securable_spec.rb +0 -1
- data/spec/unit/property_spec.rb +5 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
- data/spec/unit/provider/package/rubygems_spec.rb +5 -10
- data/spec/unit/provider/package/windows_spec.rb +30 -53
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider/service/windows_spec.rb +2 -6
- data/spec/unit/provider/systemd_unit_spec.rb +28 -24
- data/spec/unit/provider_spec.rb +1 -0
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/resource/windows_package_spec.rb +1 -0
- data/spec/unit/role_spec.rb +11 -11
- data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
- data/spec/unit/win32/security_spec.rb +4 -3
- metadata +48 -29
@@ -39,7 +39,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
|
|
39
39
|
# mytest rpm package works in centos, redhat and in suse without any dependency issues.
|
40
40
|
else
|
41
41
|
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(0)
|
42
|
-
::File.
|
42
|
+
::File.exist?("/opt/mytest/mytest.sh") # The mytest rpm package contains the mytest.sh file
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -48,7 +48,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
|
|
48
48
|
expect(shell_out("rpm -qa | grep dummy").exitstatus).to eq(1)
|
49
49
|
else
|
50
50
|
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(1)
|
51
|
-
!::File.
|
51
|
+
!::File.exist?("/opt/mytest/mytest.sh")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -390,7 +390,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
390
390
|
end
|
391
391
|
|
392
392
|
after do
|
393
|
-
if File.
|
393
|
+
if File.exist?(out_path)
|
394
394
|
File.delete(out_path)
|
395
395
|
end
|
396
396
|
end
|
@@ -405,7 +405,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
405
405
|
expect(no_of_certificates).to eq(1)
|
406
406
|
end
|
407
407
|
it "Stores Certificate content at given path" do
|
408
|
-
expect(File.
|
408
|
+
expect(File.exist?(out_path)).to be_truthy
|
409
409
|
end
|
410
410
|
it "Does not converge while fetching" do
|
411
411
|
expect(win_certificate).not_to be_updated_by_last_action
|
@@ -425,7 +425,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
425
425
|
expect(stdout.string.strip).to be_empty
|
426
426
|
end
|
427
427
|
it "Does not store certificate content at given path" do
|
428
|
-
expect(File.
|
428
|
+
expect(File.exist?(out_path)).to be_falsy
|
429
429
|
end
|
430
430
|
it "Does not converge while fetching" do
|
431
431
|
expect(win_certificate).not_to be_updated_by_last_action
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Dheeraj Singh Dubey (<ddubey@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 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
|
+
|
21
|
+
describe Chef::Resource::WindowsFont, :windows_only do
|
22
|
+
let(:resource_name) { "Playmaker.ttf" }
|
23
|
+
let(:resource_source) { "https://www.wfonts.com/download/data/2020/05/06/playmaker/Playmaker.ttf" }
|
24
|
+
|
25
|
+
let(:run_context) do
|
26
|
+
node = Chef::Node.new
|
27
|
+
node.default[:platform] = ohai[:platform]
|
28
|
+
node.default[:platform_version] = ohai[:platform_version]
|
29
|
+
node.default[:os] = ohai[:os]
|
30
|
+
events = Chef::EventDispatch::Dispatcher.new
|
31
|
+
Chef::RunContext.new(node, {}, events)
|
32
|
+
end
|
33
|
+
|
34
|
+
subject do
|
35
|
+
resource = Chef::Resource::WindowsFont.new(resource_name, run_context)
|
36
|
+
resource.source resource_source
|
37
|
+
resource
|
38
|
+
end
|
39
|
+
|
40
|
+
it "installs font on first install" do
|
41
|
+
subject.run_action(:install)
|
42
|
+
expect(subject).to be_updated_by_last_action
|
43
|
+
end
|
44
|
+
|
45
|
+
it "does not install font when already installed" do
|
46
|
+
subject.run_action(:install)
|
47
|
+
expect(subject).not_to be_updated_by_last_action
|
48
|
+
end
|
49
|
+
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require File.expand_path("
|
18
|
+
require File.expand_path("../spec_helper", __dir__)
|
19
19
|
require "chef/client"
|
20
20
|
|
21
21
|
describe Chef::RunLock do
|
@@ -435,6 +435,7 @@ describe Chef::RunLock do
|
|
435
435
|
|
436
436
|
class TestRunLock < Chef::RunLock
|
437
437
|
attr_accessor :client_process
|
438
|
+
|
438
439
|
def create_lock
|
439
440
|
super
|
440
441
|
client_process.fire_event("created lock")
|
@@ -98,13 +98,13 @@ describe Shell do
|
|
98
98
|
[output, e.status]
|
99
99
|
end
|
100
100
|
|
101
|
-
it "boots correctly with -lauto" do
|
101
|
+
it "boots correctly with -lauto", :executables do
|
102
102
|
output, exitstatus = run_chef_shell_with("-lauto")
|
103
103
|
expect(output).to include("done")
|
104
104
|
expect(exitstatus).to eq(0)
|
105
105
|
end
|
106
106
|
|
107
|
-
it "sets the log_level from the command line" do
|
107
|
+
it "sets the log_level from the command line", :executables do
|
108
108
|
output, exitstatus = run_chef_shell_with("-lfatal") do |out, keyboard|
|
109
109
|
show_log_level_code = %q[puts "===#{Chef::Log.level}==="]
|
110
110
|
keyboard.puts(show_log_level_code)
|
@@ -115,13 +115,13 @@ describe Shell do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
context "on solo mode" do
|
118
|
-
it "starts correctly" do
|
118
|
+
it "starts correctly", :executables do
|
119
119
|
output, exitstatus = run_chef_shell_with("--solo")
|
120
120
|
expect(output).to include("done")
|
121
121
|
expect(exitstatus).to eq(0)
|
122
122
|
end
|
123
123
|
|
124
|
-
it "should be able to use the API" do
|
124
|
+
it "should be able to use the API", :executables do
|
125
125
|
output, exitstatus = run_chef_shell_with("-s") do |out, keyboard|
|
126
126
|
simple_api_get = "api.get('data')"
|
127
127
|
keyboard.puts(simple_api_get)
|
@@ -132,7 +132,7 @@ describe Shell do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
it "sets the override_runlist from the command line" do
|
135
|
+
it "sets the override_runlist from the command line", :executables do
|
136
136
|
output, exitstatus = run_chef_shell_with("-o 'override::foo,override::bar'") do |out, keyboard|
|
137
137
|
show_recipes_code = %q[puts "#{node["recipes"].inspect}"]
|
138
138
|
keyboard.puts(show_recipes_code)
|
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef/json_compat"
|
20
|
-
require File.expand_path("
|
20
|
+
require File.expand_path("../../../spec_helper", __dir__)
|
21
21
|
|
22
22
|
describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
|
23
23
|
before(:all) do
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require File.expand_path("
|
18
|
+
require File.expand_path("../spec_helper", __dir__)
|
19
19
|
require "chef/mixin/shell_out"
|
20
20
|
require "chef/version"
|
21
21
|
require "ohai/version"
|
@@ -125,7 +125,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
|
|
125
125
|
it "start should start the service", :volatile do
|
126
126
|
service_manager.run(["-a", "start"])
|
127
127
|
expect(test_service_state).to eq("running")
|
128
|
-
expect(File.
|
128
|
+
expect(File.exist?(test_service_file)).to be_truthy
|
129
129
|
end
|
130
130
|
|
131
131
|
it "stop should not affect the service" do
|
@@ -6,7 +6,7 @@ describe "Accumulators" do
|
|
6
6
|
include IntegrationSupport
|
7
7
|
include Chef::Mixin::ShellOut
|
8
8
|
|
9
|
-
let(:chef_dir) { File.expand_path("
|
9
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
10
10
|
|
11
11
|
# Invoke `chef-client` as `ruby PATH/TO/chef-client`. This ensures the
|
12
12
|
# following constraints are satisfied:
|
@@ -6,7 +6,7 @@ describe "LWRPs with inline resources" do
|
|
6
6
|
include IntegrationSupport
|
7
7
|
include Chef::Mixin::ShellOut
|
8
8
|
|
9
|
-
let(:chef_dir) { File.expand_path("
|
9
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
10
10
|
|
11
11
|
# Invoke `chef-client` as `ruby PATH/TO/chef-client`. This ensures the
|
12
12
|
# following constraints are satisfied:
|
@@ -59,7 +59,7 @@ describe "LWRPs with inline resources" do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
after { File.delete(LwrpShadowedPropertyTest::PATH) if File.
|
62
|
+
after { File.delete(LwrpShadowedPropertyTest::PATH) if File.exist?(LwrpShadowedPropertyTest::PATH) }
|
63
63
|
|
64
64
|
# https://github.com/chef/chef/issues/4334
|
65
65
|
it "does not warn spuriously" do
|
@@ -6,7 +6,7 @@ describe "LWRPs" do
|
|
6
6
|
include IntegrationSupport
|
7
7
|
include Chef::Mixin::ShellOut
|
8
8
|
|
9
|
-
let(:chef_dir) { File.expand_path("
|
9
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
10
10
|
|
11
11
|
# Invoke `chef-client` as `ruby PATH/TO/chef-client`. This ensures the
|
12
12
|
# following constraints are satisfied:
|
@@ -6,7 +6,7 @@ describe "notifications" do
|
|
6
6
|
include IntegrationSupport
|
7
7
|
include Chef::Mixin::ShellOut
|
8
8
|
|
9
|
-
let(:chef_dir) { File.expand_path("
|
9
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
10
10
|
let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
|
11
11
|
|
12
12
|
when_the_repository "notifies a nameless resource" do
|
@@ -23,7 +23,7 @@ describe "notifying_block" do
|
|
23
23
|
include IntegrationSupport
|
24
24
|
include Chef::Mixin::ShellOut
|
25
25
|
|
26
|
-
let(:chef_dir) { File.expand_path("
|
26
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
27
27
|
let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
|
28
28
|
|
29
29
|
when_the_repository "notifying_block test one" do
|
@@ -1319,7 +1319,7 @@ describe "Recipe DSL methods" do
|
|
1319
1319
|
|
1320
1320
|
it "utf-8 dsl names work" do
|
1321
1321
|
recipe = converge do
|
1322
|
-
Straße("blah") {}
|
1322
|
+
Straße("blah") {} # rubocop: disable Naming/AsciiIdentifiers
|
1323
1323
|
end
|
1324
1324
|
expect(recipe.logged_warnings).to eq ""
|
1325
1325
|
expect(BaseThingy.created_resource).to eq(UTF8Thingy)
|
@@ -6,6 +6,7 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
6
6
|
module Namer
|
7
7
|
extend self
|
8
8
|
attr_accessor :current_index
|
9
|
+
|
9
10
|
def incrementing_value
|
10
11
|
@incrementing_value += 1
|
11
12
|
@incrementing_value
|
@@ -30,6 +31,7 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
30
31
|
property :state2, default: "default_state2"
|
31
32
|
property :sensitive1, default: "default_dontprintme", sensitive: true
|
32
33
|
attr_accessor :converged
|
34
|
+
|
33
35
|
def initialize(*args)
|
34
36
|
super
|
35
37
|
@converged = 0
|
@@ -6,7 +6,7 @@ describe "Unified Mode" do
|
|
6
6
|
include IntegrationSupport
|
7
7
|
include Chef::Mixin::ShellOut
|
8
8
|
|
9
|
-
let(:chef_dir) { File.expand_path("
|
9
|
+
let(:chef_dir) { File.expand_path("../../../bin", __dir__) }
|
10
10
|
|
11
11
|
let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
|
12
12
|
|
data/spec/scripts/ssl-serve.rb
CHANGED
@@ -12,7 +12,7 @@ require "webrick/https"
|
|
12
12
|
|
13
13
|
$ssl = true
|
14
14
|
|
15
|
-
CHEF_SPEC_DATA = File.expand_path("
|
15
|
+
CHEF_SPEC_DATA = File.expand_path("../data", __dir__)
|
16
16
|
cert_text = File.read(File.expand_path("ssl/chef-rspec.cert", CHEF_SPEC_DATA))
|
17
17
|
cert = OpenSSL::X509::Certificate.new(cert_text)
|
18
18
|
key_text = File.read(File.expand_path("ssl/chef-rspec.key", CHEF_SPEC_DATA))
|
data/spec/spec_helper.rb
CHANGED
@@ -24,10 +24,10 @@ module Shell
|
|
24
24
|
IRB = nil unless defined? IRB
|
25
25
|
end
|
26
26
|
|
27
|
-
$LOAD_PATH.unshift File.expand_path("
|
28
|
-
$LOAD_PATH.unshift File.expand_path("
|
29
|
-
$LOAD_PATH.unshift File.expand_path("
|
30
|
-
$LOAD_PATH.unshift File.expand_path("
|
27
|
+
$LOAD_PATH.unshift File.expand_path("..", __dir__)
|
28
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
29
|
+
$LOAD_PATH.unshift File.expand_path("../chef-config/lib", __dir__)
|
30
|
+
$LOAD_PATH.unshift File.expand_path("../chef-utils/lib", __dir__)
|
31
31
|
$LOAD_PATH.unshift File.dirname(__FILE__)
|
32
32
|
|
33
33
|
require "rubygems"
|
@@ -69,7 +69,7 @@ end
|
|
69
69
|
|
70
70
|
# If you want to load anything into the testing environment
|
71
71
|
# without versioning it, add it to spec/support/local_gems.rb
|
72
|
-
require "spec/support/local_gems.rb" if File.
|
72
|
+
require "spec/support/local_gems.rb" if File.exist?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
|
73
73
|
|
74
74
|
# Explicitly require spec helpers that need to load first
|
75
75
|
require "spec/support/platform_helpers"
|
@@ -124,6 +124,7 @@ RSpec.configure do |config|
|
|
124
124
|
end
|
125
125
|
config.mock_with :rspec do |c|
|
126
126
|
c.syntax = :expect
|
127
|
+
c.allow_message_expectations_on_nil = false
|
127
128
|
end
|
128
129
|
|
129
130
|
# Only run these tests on platforms that are also chef workstations
|
@@ -138,9 +139,10 @@ RSpec.configure do |config|
|
|
138
139
|
|
139
140
|
config.filter_run_excluding windows_only: true unless windows?
|
140
141
|
config.filter_run_excluding not_supported_on_windows: true if windows?
|
141
|
-
config.filter_run_excluding not_supported_on_macos: true if
|
142
|
-
config.filter_run_excluding macos_only: true unless
|
143
|
-
config.filter_run_excluding
|
142
|
+
config.filter_run_excluding not_supported_on_macos: true if macos?
|
143
|
+
config.filter_run_excluding macos_only: true unless macos?
|
144
|
+
config.filter_run_excluding macos_1013: true unless macos_1013?
|
145
|
+
config.filter_run_excluding macos_gte_1014: true unless macos_gte_1014?
|
144
146
|
config.filter_run_excluding not_supported_on_aix: true if aix?
|
145
147
|
config.filter_run_excluding not_supported_on_solaris: true if solaris?
|
146
148
|
config.filter_run_excluding not_supported_on_gce: true if gce?
|
@@ -3,7 +3,6 @@ require "chef/mixin/shell_out"
|
|
3
3
|
require "ohai/mixin/http_helper"
|
4
4
|
require "ohai/mixin/gce_metadata"
|
5
5
|
require "chef/mixin/powershell_out"
|
6
|
-
require "chef/version_class"
|
7
6
|
|
8
7
|
class ShellHelpers
|
9
8
|
extend Chef::Mixin::ShellOut
|
@@ -100,39 +99,12 @@ def windows_user_right?(right)
|
|
100
99
|
Chef::ReservedNames::Win32::Security.get_account_right(ENV["USERNAME"]).include?(right)
|
101
100
|
end
|
102
101
|
|
103
|
-
def
|
104
|
-
|
105
|
-
result = ShellHelpers.shell_out("/usr/bin/sw_vers")
|
106
|
-
result.stdout.each_line do |line|
|
107
|
-
if line =~ /^ProductVersion:\s10.6.*$/
|
108
|
-
return true
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
false
|
114
|
-
end
|
115
|
-
|
116
|
-
def mac_osx_1014?
|
117
|
-
if mac_osx?
|
118
|
-
ver = Chef::Version.new(ohai[:platform_version])
|
119
|
-
return ver.major == 10 && ver.minor == 14
|
120
|
-
end
|
121
|
-
|
122
|
-
false
|
102
|
+
def macos_1013?
|
103
|
+
macos? && Gem::Requirement.new("~> 10.13.0").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
|
123
104
|
end
|
124
105
|
|
125
|
-
def
|
126
|
-
|
127
|
-
result = ShellHelpers.shell_out("/usr/bin/sw_vers")
|
128
|
-
result.stdout.each_line do |line|
|
129
|
-
if line =~ /^ProductName:\sMac OS X.*$/
|
130
|
-
return true
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
false
|
106
|
+
def macos_gte_1014?
|
107
|
+
macos? && Gem::Requirement.new(">= 10.14").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
|
136
108
|
end
|
137
109
|
|
138
110
|
# detects if the hardware is 64-bit (evaluates to true in "WOW64" mode in a 32-bit app on a 64-bit system)
|
@@ -145,26 +117,24 @@ def windows32?
|
|
145
117
|
windows? && !windows64?
|
146
118
|
end
|
147
119
|
|
148
|
-
# def jruby?
|
149
|
-
|
150
120
|
def unix?
|
151
121
|
!windows?
|
152
122
|
end
|
153
123
|
|
154
124
|
def linux?
|
155
|
-
|
125
|
+
RUBY_PLATFORM.match?(/linux/)
|
156
126
|
end
|
157
127
|
|
158
|
-
def
|
159
|
-
|
128
|
+
def macos?
|
129
|
+
RUBY_PLATFORM.match?(/darwin/)
|
160
130
|
end
|
161
131
|
|
162
132
|
def solaris?
|
163
|
-
|
133
|
+
RUBY_PLATFORM.match?(/solaris/)
|
164
134
|
end
|
165
135
|
|
166
136
|
def freebsd?
|
167
|
-
|
137
|
+
RUBY_PLATFORM.match?(/freebsd/)
|
168
138
|
end
|
169
139
|
|
170
140
|
def intel_64bit?
|
@@ -200,7 +170,7 @@ def debian_family?
|
|
200
170
|
end
|
201
171
|
|
202
172
|
def aix?
|
203
|
-
|
173
|
+
RUBY_PLATFORM.match?(/aix/)
|
204
174
|
end
|
205
175
|
|
206
176
|
def wpar?
|
@@ -236,8 +206,8 @@ def selinux_enabled?
|
|
236
206
|
end
|
237
207
|
|
238
208
|
def suse?
|
239
|
-
::File.
|
240
|
-
( ::File.
|
209
|
+
::File.exist?("/etc/SuSE-release") ||
|
210
|
+
( ::File.exist?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
|
241
211
|
end
|
242
212
|
|
243
213
|
def root?
|