chef 15.4.45-universal-mingw32 → 15.5.9-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 -3
- data/Rakefile +5 -3
- data/chef.gemspec +2 -1
- data/ext/win32-eventlog/Rakefile +9 -1
- data/ext/win32-eventlog/{chef-log.man → chef-log.man.erb} +4 -4
- data/lib/chef/application.rb +2 -2
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/knife.rb +1 -0
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/chef_class.rb +1 -6
- data/lib/chef/chef_fs.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +7 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +4 -3
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +3 -3
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -3
- data/lib/chef/chef_fs/knife.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +2 -2
- data/lib/chef/client.rb +4 -5
- data/lib/chef/config.rb +3 -2
- data/lib/chef/cookbook/chefignore.rb +16 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/syntax_check.rb +5 -3
- data/lib/chef/cookbook_loader.rb +3 -3
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/data_collector.rb +2 -2
- data/lib/chef/data_collector/run_end_message.rb +1 -0
- data/lib/chef/deprecated.rb +4 -0
- data/lib/chef/dsl/core.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +9 -18
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/file_content_management/deploy.rb +3 -3
- data/lib/chef/file_content_management/deploy/mv_windows.rb +2 -2
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +2 -2
- data/lib/chef/http.rb +1 -1
- data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
- data/lib/chef/knife.rb +4 -3
- data/lib/chef/knife/config_get.rb +2 -1
- data/lib/chef/knife/configure.rb +1 -1
- data/lib/chef/knife/cookbook_metadata_from_file.rb +6 -0
- data/lib/chef/knife/core/generic_presenter.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/ssh.rb +6 -0
- data/lib/chef/local_mode.rb +1 -1
- data/lib/chef/mash.rb +21 -232
- data/lib/chef/mixin/file_class.rb +2 -2
- data/lib/chef/mixin/lazy_module_include.rb +1 -1
- data/lib/chef/mixin/path_sanity.rb +3 -39
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +4 -5
- data/lib/chef/mixin/template.rb +1 -1
- data/lib/chef/mixin/user_context.rb +3 -3
- data/lib/chef/mixin/which.rb +10 -38
- data/lib/chef/mixin/windows_architecture_helper.rb +6 -6
- data/lib/chef/mixin/windows_env_helper.rb +5 -5
- data/lib/chef/node/attribute.rb +2 -2
- data/lib/chef/node_map.rb +17 -4
- data/lib/chef/platform/query_helpers.rb +4 -2
- data/lib/chef/platform/rebooter.rb +1 -1
- data/lib/chef/platform/service_helpers.rb +14 -85
- data/lib/chef/provider.rb +2 -0
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/ifconfig/redhat.rb +1 -1
- data/lib/chef/provider/link.rb +3 -3
- data/lib/chef/provider/mount/solaris.rb +1 -1
- data/lib/chef/provider/package/yum.rb +1 -1
- data/lib/chef/provider/registry_key.rb +1 -1
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file/fetcher.rb +2 -2
- data/lib/chef/provider/remote_file/local_file.rb +1 -1
- data/lib/chef/provider/script.rb +3 -3
- data/lib/chef/provider/service.rb +5 -2
- data/lib/chef/provider/service/arch.rb +1 -1
- data/lib/chef/provider/service/debian.rb +4 -4
- data/lib/chef/provider/service/init.rb +1 -1
- data/lib/chef/provider/service/insserv.rb +4 -4
- data/lib/chef/provider/service/invokercd.rb +4 -4
- data/lib/chef/provider/service/redhat.rb +4 -4
- data/lib/chef/provider/service/systemd.rb +19 -3
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/subversion.rb +1 -1
- data/lib/chef/provider/systemd_unit.rb +26 -2
- data/lib/chef/provider/windows_path.rb +3 -3
- data/lib/chef/provider/windows_task.rb +4 -4
- data/lib/chef/resource.rb +1 -0
- data/lib/chef/resource/bash.rb +2 -0
- data/lib/chef/resource/batch.rb +2 -0
- data/lib/chef/resource/breakpoint.rb +3 -1
- data/lib/chef/resource/build_essential.rb +3 -3
- data/lib/chef/resource/chef_sleep.rb +70 -0
- data/lib/chef/resource/cookbook_file.rb +2 -1
- data/lib/chef/resource/csh.rb +2 -0
- data/lib/chef/resource/directory.rb +2 -0
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +1 -1
- data/lib/chef/resource/execute.rb +2 -0
- data/lib/chef/resource/file.rb +2 -1
- data/lib/chef/resource/git.rb +2 -0
- data/lib/chef/resource/group.rb +1 -1
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/http_request.rb +2 -0
- data/lib/chef/resource/ifconfig.rb +3 -1
- data/lib/chef/resource/ksh.rb +2 -0
- data/lib/chef/resource/link.rb +4 -2
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/log.rb +2 -0
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/perl.rb +2 -0
- data/lib/chef/resource/python.rb +2 -0
- data/lib/chef/resource/reboot.rb +2 -0
- data/lib/chef/resource/registry_key.rb +2 -0
- data/lib/chef/resource/remote_directory.rb +3 -2
- data/lib/chef/resource/remote_file.rb +1 -0
- data/lib/chef/resource/ruby.rb +2 -0
- data/lib/chef/resource/ruby_block.rb +2 -0
- data/lib/chef/resource/scm.rb +2 -0
- data/lib/chef/resource/script.rb +2 -0
- data/lib/chef/resource/service.rb +9 -1
- data/lib/chef/resource/solaris_package.rb +1 -1
- data/lib/chef/resource/subversion.rb +2 -0
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/systemd_unit.rb +1 -0
- data/lib/chef/resource/template.rb +2 -0
- data/lib/chef/resource/user.rb +2 -0
- data/lib/chef/resource/user/aix_user.rb +2 -0
- data/lib/chef/resource/user/linux_user.rb +2 -0
- data/lib/chef/resource/user/pw_user.rb +2 -0
- data/lib/chef/resource/user/solaris_user.rb +2 -0
- data/lib/chef/resource/user/windows_user.rb +2 -0
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +1 -0
- data/lib/chef/resource/windows_ad_join.rb +1 -1
- data/lib/chef/resource/windows_env.rb +1 -1
- data/lib/chef/resource/windows_feature.rb +2 -2
- data/lib/chef/resource/windows_feature_powershell.rb +1 -1
- data/lib/chef/resource/windows_firewall_rule.rb +11 -6
- data/lib/chef/resource/windows_script.rb +3 -1
- data/lib/chef/resource/yum_package.rb +1 -1
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_context.rb +1 -1
- data/lib/chef/run_lock.rb +5 -5
- data/lib/chef/search/query.rb +0 -3
- data/lib/chef/train_transport.rb +3 -1
- data/lib/chef/util/powershell/ps_credential.rb +2 -2
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/logon_session.rb +2 -2
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/eventlog.rb +2 -2
- data/spec/data/cookbooks/starter/chefignore +8 -0
- data/spec/data/cookbooks/starter/files/sample.txt +1 -0
- data/spec/data/cookbooks/starter/metadata.rb +2 -0
- data/spec/data/cookbooks/starter/recipes/default.rb +4 -0
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +1 -1
- data/spec/functional/mixin/user_context_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +1 -1
- data/spec/functional/resource/cookbook_file_spec.rb +2 -2
- data/spec/functional/resource/template_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +1 -1
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/functional/win32/sid_spec.rb +2 -2
- data/spec/functional/win32/version_info_spec.rb +1 -1
- data/spec/functional/win32/versions_spec.rb +1 -1
- data/spec/integration/knife/config_get_profile_spec.rb +2 -2
- data/spec/integration/knife/config_get_spec.rb +9 -2
- data/spec/integration/knife/config_list_profiles_spec.rb +2 -2
- data/spec/integration/knife/config_use_profile_spec.rb +2 -2
- data/spec/integration/knife/list_spec.rb +2 -2
- data/spec/integration/solo/solo_spec.rb +1 -1
- data/spec/support/matchers/leak.rb +1 -1
- data/spec/support/mock/platform.rb +1 -1
- data/spec/support/platform_helpers.rb +2 -0
- data/spec/support/shared/integration/integration_helper.rb +1 -1
- data/spec/support/shared/integration/knife_support.rb +1 -1
- data/spec/support/shared/unit/provider/file.rb +4 -4
- data/spec/unit/application/client_spec.rb +2 -2
- data/spec/unit/application/knife_spec.rb +17 -0
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/chef_fs/file_pattern_spec.rb +2 -2
- data/spec/unit/chef_fs/path_util_spec.rb +3 -3
- data/spec/unit/client_spec.rb +2 -2
- data/spec/unit/cookbook/chefignore_spec.rb +31 -11
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +1 -1
- data/spec/unit/cookbook/syntax_check_spec.rb +2 -2
- data/spec/unit/cookbook_loader_spec.rb +2 -2
- data/spec/unit/cookbook_uploader_spec.rb +6 -1
- data/spec/unit/data_bag_spec.rb +2 -2
- data/spec/unit/data_collector_spec.rb +7 -0
- data/spec/unit/dsl/platform_introspection_spec.rb +31 -1
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +1 -1
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +7 -0
- data/spec/unit/knife/cookbook_show_spec.rb +1 -1
- data/spec/unit/knife/core/gem_glob_loader_spec.rb +1 -1
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +1 -1
- data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -1
- data/spec/unit/knife/core/ui_spec.rb +2 -2
- data/spec/unit/knife/data_bag_from_file_spec.rb +2 -2
- data/spec/unit/knife/environment_from_file_spec.rb +2 -2
- data/spec/unit/knife/ssh_spec.rb +27 -17
- data/spec/unit/knife/status_spec.rb +1 -1
- data/spec/unit/knife/supermarket_install_spec.rb +1 -1
- data/spec/unit/mixin/path_sanity_spec.rb +3 -3
- data/spec/unit/mixin/shell_out_spec.rb +2 -3
- data/spec/unit/mixin/template_spec.rb +4 -4
- data/spec/unit/mixin/user_context_spec.rb +3 -3
- data/spec/unit/node_map_spec.rb +12 -12
- data/spec/unit/platform/query_helpers_spec.rb +9 -9
- data/spec/unit/provider/execute_spec.rb +1 -1
- data/spec/unit/provider/link_spec.rb +5 -5
- data/spec/unit/provider/package/openbsd_spec.rb +1 -1
- data/spec/unit/provider/package/smartos_spec.rb +1 -1
- data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
- data/spec/unit/provider/package/windows_spec.rb +2 -2
- data/spec/unit/provider/remote_file/fetcher_spec.rb +2 -2
- data/spec/unit/provider/remote_file/local_file_spec.rb +1 -1
- data/spec/unit/provider/remote_file/network_file_spec.rb +1 -1
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/systemd_service_spec.rb +26 -2
- data/spec/unit/provider/subversion_spec.rb +3 -3
- data/spec/unit/provider/systemd_unit_spec.rb +53 -4
- data/spec/unit/provider/user/dscl_spec.rb +1 -1
- data/spec/unit/provider_resolver_spec.rb +41 -61
- data/spec/unit/resource/chef_sleep_spec.rb +30 -0
- data/spec/unit/resource/cookbook_file_spec.rb +3 -3
- data/spec/unit/resource/remote_file_spec.rb +3 -3
- data/spec/unit/resource/windows_firewall_rule_spec.rb +69 -12
- data/spec/unit/role_spec.rb +2 -2
- data/spec/unit/shell_spec.rb +1 -1
- data/spec/unit/util/selinux_spec.rb +2 -2
- data/spec/unit/win32/error_spec.rb +1 -1
- data/spec/unit/win32/link_spec.rb +1 -1
- data/spec/unit/win32/security_spec.rb +1 -1
- data/spec/unit/windows_service_spec.rb +1 -1
- data/tasks/docs.rb +10 -2
- data/tasks/rspec.rb +8 -6
- metadata +33 -9
- data/lib/chef/mixin/train_helpers.rb +0 -60
- data/spec/unit/mash_spec.rb +0 -51
@@ -68,11 +68,11 @@ describe Chef::Resource::CookbookFile do
|
|
68
68
|
let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base)) }
|
69
69
|
|
70
70
|
before do
|
71
|
-
FileUtils.mkdir_p(windows_non_temp_dir) if
|
71
|
+
FileUtils.mkdir_p(windows_non_temp_dir) if ChefUtils.windows?
|
72
72
|
end
|
73
73
|
|
74
74
|
after do
|
75
|
-
FileUtils.rm_r(windows_non_temp_dir) if
|
75
|
+
FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.exists?(windows_non_temp_dir)
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -203,7 +203,7 @@ describe Chef::Resource::Template do
|
|
203
203
|
it "output should contain platform's line endings" do
|
204
204
|
resource.run_action(:create)
|
205
205
|
binread(path).each_line do |line|
|
206
|
-
expect(line).to end_with(
|
206
|
+
expect(line).to end_with(ChefUtils.windows? ? "\r\n" : "\n")
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
@@ -17,12 +17,12 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "spec_helper"
|
20
|
-
if
|
20
|
+
if ChefUtils.windows?
|
21
21
|
require "chef/win32/security"
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "Chef::ReservedNames::Win32::SID", :windows_only do
|
25
|
-
if
|
25
|
+
if ChefUtils.windows?
|
26
26
|
SID ||= Chef::ReservedNames::Win32::Security::SID
|
27
27
|
end
|
28
28
|
|
@@ -50,7 +50,7 @@ describe "knife config get-profile", :workstation do
|
|
50
50
|
ENV["KNIFE_HOME"] = old_knife_home
|
51
51
|
ENV["HOME"] = old_home
|
52
52
|
Dir.chdir(old_wd)
|
53
|
-
ENV[
|
53
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
54
54
|
ChefConfig::PathHelper.per_tool_home_environment = nil
|
55
55
|
end
|
56
56
|
end
|
@@ -60,7 +60,7 @@ describe "knife config get-profile", :workstation do
|
|
60
60
|
# because it has to run after the before set in the "with a chef repo" shared context.
|
61
61
|
directory("repo")
|
62
62
|
Dir.chdir(path_to("repo"))
|
63
|
-
ENV[
|
63
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
64
64
|
ENV["HOME"] = path_to(".")
|
65
65
|
end
|
66
66
|
|
@@ -54,7 +54,7 @@ describe "knife config get", :workstation do
|
|
54
54
|
ENV["KNIFE_HOME"] = old_knife_home
|
55
55
|
ENV["HOME"] = old_home
|
56
56
|
Dir.chdir(old_wd)
|
57
|
-
ENV[
|
57
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
58
58
|
ChefConfig::PathHelper.per_tool_home_environment = nil
|
59
59
|
end
|
60
60
|
end
|
@@ -64,7 +64,7 @@ describe "knife config get", :workstation do
|
|
64
64
|
# because it has to run after the before set in the "with a chef repo" shared context.
|
65
65
|
directory("repo")
|
66
66
|
Dir.chdir(path_to("repo"))
|
67
|
-
ENV[
|
67
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
68
68
|
ENV["HOME"] = path_to(".")
|
69
69
|
end
|
70
70
|
|
@@ -110,6 +110,13 @@ describe "knife config get", :workstation do
|
|
110
110
|
it { is_expected.to match(/^node_name:\s+one$/) }
|
111
111
|
end
|
112
112
|
|
113
|
+
context "with a config dot d files" do
|
114
|
+
before { file(".chef/config.d/abc.rb", "node_name 'one'\n") }
|
115
|
+
|
116
|
+
it { is_expected.to match(%r{^Loading from .d/ configuration file .*/#{File.basename(path_to("."))}/.chef/config.d/abc.rb$}) }
|
117
|
+
it { is_expected.to match(/^node_name:\s+one$/) }
|
118
|
+
end
|
119
|
+
|
113
120
|
context "with a credentials file and CHEF_HOME" do
|
114
121
|
before do
|
115
122
|
file(".chef/credentials", "[default]\nclient_name = \"three\"\n")
|
@@ -44,7 +44,7 @@ describe "knife config list-profiles", :workstation do
|
|
44
44
|
ensure
|
45
45
|
ENV["HOME"] = old_home
|
46
46
|
Dir.chdir(old_wd)
|
47
|
-
ENV[
|
47
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -53,7 +53,7 @@ describe "knife config list-profiles", :workstation do
|
|
53
53
|
# because it has to run after the before set in the "with a chef repo" shared context.
|
54
54
|
directory("repo")
|
55
55
|
Dir.chdir(path_to("repo"))
|
56
|
-
ENV[
|
56
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
57
57
|
ENV["HOME"] = path_to(".")
|
58
58
|
end
|
59
59
|
|
@@ -51,7 +51,7 @@ describe "knife config use-profile", :workstation do
|
|
51
51
|
ENV["KNIFE_HOME"] = old_knife_home
|
52
52
|
ENV["HOME"] = old_home
|
53
53
|
Dir.chdir(old_wd)
|
54
|
-
ENV[
|
54
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
55
55
|
ChefConfig::PathHelper.per_tool_home_environment = nil
|
56
56
|
end
|
57
57
|
end
|
@@ -61,7 +61,7 @@ describe "knife config use-profile", :workstation do
|
|
61
61
|
# because it has to run after the before set in the "with a chef repo" shared context.
|
62
62
|
directory("repo")
|
63
63
|
Dir.chdir(path_to("repo"))
|
64
|
-
ENV[
|
64
|
+
ENV[ChefUtils.windows? ? "CD" : "PWD"] = Dir.pwd
|
65
65
|
ENV["HOME"] = path_to(".")
|
66
66
|
end
|
67
67
|
|
@@ -466,7 +466,7 @@ describe "knife list", :workstation do
|
|
466
466
|
end
|
467
467
|
end
|
468
468
|
|
469
|
-
when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", skip: (
|
469
|
+
when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", skip: (ChefUtils.windows?) do
|
470
470
|
before do
|
471
471
|
directory "cookbooks"
|
472
472
|
symlink "symlinked", "cookbooks"
|
@@ -503,7 +503,7 @@ describe "knife list", :workstation do
|
|
503
503
|
end
|
504
504
|
end
|
505
505
|
|
506
|
-
when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", skip: (
|
506
|
+
when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", skip: (ChefUtils.windows?) do
|
507
507
|
before do
|
508
508
|
directory "real_cookbooks"
|
509
509
|
symlink "cookbooks", "real_cookbooks"
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# testing code that mixes in platform specific modules like +Chef::Mixin::Securable+
|
7
7
|
# or +Chef::FileAccessControl+
|
8
8
|
def platform_mock(platform = :unix)
|
9
|
-
allow(
|
9
|
+
allow(ChefUtils).to receive(:windows?).and_return(platform == :windows ? true : false)
|
10
10
|
ENV["SYSTEMDRIVE"] = (platform == :windows ? "C:" : nil)
|
11
11
|
|
12
12
|
if platform == :windows
|
@@ -35,6 +35,8 @@ def ruby_32bit?
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def windows?
|
38
|
+
# NOTE this deliberately does not use ChefUtils.windows? because otherwise it would
|
39
|
+
# pick up the node out of tests, while this tests the hosts running the specs.
|
38
40
|
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
|
39
41
|
end
|
40
42
|
|
@@ -128,7 +128,7 @@ module IntegrationSupport
|
|
128
128
|
# TODO: "force" actually means "silence all exceptions". this
|
129
129
|
# silences a weird permissions error on Windows that we should track
|
130
130
|
# down, but for now there's no reason for it to blow up our CI.
|
131
|
-
FileUtils.remove_entry_secure(@repository_dir, force =
|
131
|
+
FileUtils.remove_entry_secure(@repository_dir, force = ChefUtils.windows?)
|
132
132
|
ensure
|
133
133
|
@repository_dir = nil
|
134
134
|
end
|
@@ -181,7 +181,7 @@ module KnifeSupport
|
|
181
181
|
expect(stderr_actual).to eq(expected[:stderr])
|
182
182
|
end
|
183
183
|
stdout_actual = @stdout
|
184
|
-
if
|
184
|
+
if ChefUtils.windows?
|
185
185
|
stderr_actual = stderr_actual.gsub("\r\n", "\n")
|
186
186
|
stdout_actual = stdout_actual.gsub("\r\n", "\n")
|
187
187
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Lamont Granquist (<lamont@chef.io>)
|
3
|
-
# Copyright:: Copyright 2013-
|
3
|
+
# Copyright:: Copyright 2013-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -256,7 +256,7 @@ shared_examples_for Chef::Provider::File do
|
|
256
256
|
context "examining file security metadata on Unix with a file that exists" do
|
257
257
|
before do
|
258
258
|
# fake that we're on unix even if we're on windows
|
259
|
-
allow(
|
259
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
260
260
|
# mock up the filesystem to behave like unix
|
261
261
|
setup_normal_file
|
262
262
|
stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)
|
@@ -332,7 +332,7 @@ shared_examples_for Chef::Provider::File do
|
|
332
332
|
context "examining file security metadata on Unix with a file that does not exist" do
|
333
333
|
before do
|
334
334
|
# fake that we're on unix even if we're on windows
|
335
|
-
allow(
|
335
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
336
336
|
setup_missing_file
|
337
337
|
end
|
338
338
|
|
@@ -381,7 +381,7 @@ shared_examples_for Chef::Provider::File do
|
|
381
381
|
|
382
382
|
before do
|
383
383
|
# fake that we're on unix even if we're on windows
|
384
|
-
allow(
|
384
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
385
385
|
# mock up the filesystem to behave like unix
|
386
386
|
setup_normal_file
|
387
387
|
stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)
|
@@ -323,7 +323,7 @@ describe Chef::Application::Client, "reconfigure" do
|
|
323
323
|
|
324
324
|
it "should terminate with message when interval is given" do
|
325
325
|
Chef::Config[:interval] = 600
|
326
|
-
allow(
|
326
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
327
327
|
expect(Chef::Application).to receive(:fatal!).with(
|
328
328
|
/Unforked .* interval runs are disabled by default\.
|
329
329
|
Configuration settings:
|
@@ -336,7 +336,7 @@ Enable .* interval runs by setting `:client_fork = true` in your config file or
|
|
336
336
|
context "when interval is given on windows" do
|
337
337
|
before do
|
338
338
|
Chef::Config[:interval] = 600
|
339
|
-
allow(
|
339
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
340
340
|
end
|
341
341
|
|
342
342
|
it "should terminate" do
|
@@ -77,6 +77,23 @@ describe Chef::Application::Knife do
|
|
77
77
|
expect(Chef::Config[:color]).to be_truthy
|
78
78
|
end
|
79
79
|
|
80
|
+
context "validate --format option" do
|
81
|
+
it "should set the default format summary" do
|
82
|
+
with_argv(*%w{noop knife command}) do
|
83
|
+
expect(@knife).to receive(:exit).with(0)
|
84
|
+
@knife.run
|
85
|
+
expect(@knife.default_config[:format]).to eq("summary")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should raise the error for invalid value" do
|
90
|
+
with_argv(*%w{noop knife command -F abc}) do
|
91
|
+
expect(STDOUT).to receive(:puts).at_least(2).times
|
92
|
+
expect { @knife.run }.to raise_error(SystemExit) { |e| expect(e.status).to eq(2) }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
80
97
|
context "when given fips flags" do
|
81
98
|
context "when Chef::Config[:fips]=false" do
|
82
99
|
before do
|
@@ -277,7 +277,7 @@ describe Chef::Application do
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
if
|
280
|
+
if ChefUtils.windows?
|
281
281
|
it_behaves_like "sets log_location", :win_evt, Chef::Log::WinEvt
|
282
282
|
it_behaves_like "sets log_location", "win_evt", Chef::Log::WinEvt
|
283
283
|
else
|
@@ -157,7 +157,7 @@ describe Chef::ChefFS::FilePattern do
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
context 'with simple pattern "a\*\b"', skip: (
|
160
|
+
context 'with simple pattern "a\*\b"', skip: (ChefUtils.windows?) do
|
161
161
|
let(:pattern) { Chef::ChefFS::FilePattern.new('a\*\b') }
|
162
162
|
it "match?" do
|
163
163
|
expect(pattern.match?("a*b")).to be_truthy
|
@@ -264,7 +264,7 @@ describe Chef::ChefFS::FilePattern do
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', skip: (
|
267
|
+
context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', skip: (ChefUtils.windows?) do
|
268
268
|
let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d[a-z][0-9]f/ghi") }
|
269
269
|
it "match?" do
|
270
270
|
expect(pattern.match?("/abc/de1f/ghi")).to be_truthy
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kartik Null Cating-Subramanian (<ksubramanian@chef.io>)
|
3
|
-
# Copyright:: Copyright 2015-
|
3
|
+
# Copyright:: Copyright 2015-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -81,7 +81,7 @@ describe Chef::ChefFS::PathUtils do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "handles root correctly" do
|
84
|
-
if
|
84
|
+
if ChefUtils.windows?
|
85
85
|
expect(Chef::ChefFS::PathUtils.realest_path("C:/")).to eq("C:/")
|
86
86
|
else
|
87
87
|
expect(Chef::ChefFS::PathUtils.realest_path("/")).to eq("/")
|
@@ -91,7 +91,7 @@ describe Chef::ChefFS::PathUtils do
|
|
91
91
|
|
92
92
|
context "invoking descendant_path" do
|
93
93
|
it "handles paths with various casing on windows" do
|
94
|
-
allow(
|
94
|
+
allow(ChefUtils).to receive(:windows?) { true }
|
95
95
|
expect(Chef::ChefFS::PathUtils.descendant_path("C:/ab/b/c", "C:/AB/B")).to eq("c")
|
96
96
|
expect(Chef::ChefFS::PathUtils.descendant_path("C:/ab/b/c", "c:/ab/B")).to eq("c")
|
97
97
|
end
|
data/spec/unit/client_spec.rb
CHANGED
@@ -670,7 +670,7 @@ describe Chef::Client do
|
|
670
670
|
describe "windows_admin_check" do
|
671
671
|
context "platform is not windows" do
|
672
672
|
before do
|
673
|
-
allow(
|
673
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
674
674
|
end
|
675
675
|
|
676
676
|
it "shouldn't be called" do
|
@@ -681,7 +681,7 @@ describe Chef::Client do
|
|
681
681
|
|
682
682
|
context "platform is windows" do
|
683
683
|
before do
|
684
|
-
allow(
|
684
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
685
685
|
end
|
686
686
|
|
687
687
|
it "should be called" do
|
@@ -18,32 +18,52 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Chef::Cookbook::Chefignore do
|
21
|
-
|
22
|
-
@chefignore = Chef::Cookbook::Chefignore.new(File.join(CHEF_SPEC_DATA, "cookbooks"))
|
23
|
-
end
|
21
|
+
let(:chefignore) { described_class.new(File.join(CHEF_SPEC_DATA, "cookbooks")) }
|
24
22
|
|
25
23
|
it "loads the globs in the chefignore file" do
|
26
|
-
expect(
|
24
|
+
expect(chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored})
|
27
25
|
end
|
28
26
|
|
29
27
|
it "removes items from an array that match the ignores" do
|
30
28
|
file_list = %w{ recipes/ignoreme.rb recipes/dontignoreme.rb }
|
31
|
-
expect(
|
29
|
+
expect(chefignore.remove_ignores_from(file_list)).to eq(%w{recipes/dontignoreme.rb})
|
32
30
|
end
|
33
31
|
|
34
32
|
it "determines if a file is ignored" do
|
35
|
-
expect(
|
36
|
-
expect(
|
37
|
-
expect(
|
33
|
+
expect(chefignore.ignored?("ignored")).to be_truthy
|
34
|
+
expect(chefignore.ignored?("recipes/ignoreme.rb")).to be_truthy
|
35
|
+
expect(chefignore.ignored?("recipes/dontignoreme.rb")).to be_falsey
|
38
36
|
end
|
39
37
|
|
40
38
|
context "when using the single cookbook pattern" do
|
41
|
-
|
42
|
-
|
39
|
+
let(:chefignore) { described_class.new(File.join(CHEF_SPEC_DATA, "cookbooks/starter")) }
|
40
|
+
|
41
|
+
it "loads the globs in the chefignore file" do
|
42
|
+
expect(chefignore.ignores).to match_array(%w{recipes/default.rb ignored})
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when cookbook has it's own chefignore" do
|
47
|
+
let(:chefignore) { described_class.new(File.join(CHEF_SPEC_DATA, "cookbooks/starter")) }
|
48
|
+
|
49
|
+
it "loads the globs in the chefignore file" do
|
50
|
+
expect(chefignore.ignores).to match_array(%w{recipes/default.rb ignored})
|
43
51
|
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "when cookbook don't have own chefignore" do
|
55
|
+
let(:chefignore) { described_class.new(File.join(CHEF_SPEC_DATA, "cookbooks/apache2")) }
|
56
|
+
|
57
|
+
it "loads the globs in the chefignore file of cookbooks dir" do
|
58
|
+
expect(chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored})
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "when using the single cookbook pattern" do
|
63
|
+
let(:chefignore) { described_class.new(File.join(CHEF_SPEC_DATA, "standalone_cookbook")) }
|
44
64
|
|
45
65
|
it "loads the globs in the chefignore file" do
|
46
|
-
expect(
|
66
|
+
expect(chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored vendor/bundle/*})
|
47
67
|
end
|
48
68
|
end
|
49
69
|
end
|