chef 15.4.45 → 15.5.9
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/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 +32 -8
- data/lib/chef/mixin/train_helpers.rb +0 -60
- data/spec/unit/mash_spec.rb +0 -51
data/spec/unit/role_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-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");
|
@@ -21,7 +21,7 @@ require "chef/role"
|
|
21
21
|
|
22
22
|
describe Chef::Role do
|
23
23
|
before(:each) do
|
24
|
-
allow(
|
24
|
+
allow(ChefUtils).to receive(:windows?) { false }
|
25
25
|
@role = Chef::Role.new
|
26
26
|
@role.name("ops_master")
|
27
27
|
end
|
data/spec/unit/shell_spec.rb
CHANGED
@@ -42,7 +42,7 @@ describe Shell do
|
|
42
42
|
before do
|
43
43
|
Shell.irb_conf = {}
|
44
44
|
allow(Shell::ShellSession.instance).to receive(:reset!)
|
45
|
-
allow(
|
45
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
46
46
|
allow(Chef::Util::PathHelper).to receive(:home).and_return("/home/foo")
|
47
47
|
end
|
48
48
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
3
|
-
# Copyright:: Copyright 2013-
|
3
|
+
# Copyright:: Copyright 2013-2019, 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");
|
@@ -41,7 +41,7 @@ describe Chef::Util::Selinux do
|
|
41
41
|
it "each part of ENV['PATH'] should be checked" do
|
42
42
|
expected_paths = ENV["PATH"].split(File::PATH_SEPARATOR) + [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
|
43
43
|
|
44
|
-
expected_paths.each do |bin_path|
|
44
|
+
expected_paths.uniq.each do |bin_path|
|
45
45
|
selinux_path = File.join(bin_path, "selinuxenabled")
|
46
46
|
expect(File).to receive(:executable?).with(selinux_path).and_return(false)
|
47
47
|
end
|
data/tasks/docs.rb
CHANGED
@@ -24,7 +24,9 @@ namespace :docs_site do
|
|
24
24
|
return nil if default.nil? || default == "" || default == "lazy default"
|
25
25
|
|
26
26
|
if default.is_a?(String)
|
27
|
-
|
27
|
+
|
28
|
+
# .inspect wraps the value in quotes which we want for strings, but not sentences or symbols as strings
|
29
|
+
return default.inspect unless default[0] == ":" || default.end_with?('.')
|
28
30
|
end
|
29
31
|
default
|
30
32
|
end
|
@@ -101,7 +103,13 @@ namespace :docs_site do
|
|
101
103
|
def bolded_description(name, description)
|
102
104
|
return nil if description.nil? # handle resources missing descriptions
|
103
105
|
|
104
|
-
|
106
|
+
# we only want to bold occurences of the resource name in the first 5 words so treat it as an array
|
107
|
+
desc_array = description.split(" ")
|
108
|
+
|
109
|
+
desc_array = desc_array[0..4].map! { |x| name == x ? "**#{x}**" : x } + desc_array[5..-1]
|
110
|
+
|
111
|
+
# strip out notes and return just the description
|
112
|
+
desc_array.join(" ").split("Note: ").first.strip
|
105
113
|
end
|
106
114
|
|
107
115
|
def note_text(description)
|
data/tasks/rspec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -25,12 +25,14 @@ CHEF_ROOT = File.join(File.dirname(__FILE__), "..")
|
|
25
25
|
begin
|
26
26
|
require "rspec/core/rake_task"
|
27
27
|
|
28
|
-
desc "Run specs for Chef's Components
|
28
|
+
desc "Run specs for Chef's Components"
|
29
29
|
task :component_specs do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
%w{chef-utils chef-config}.each do |gem|
|
31
|
+
Dir.chdir(gem) do
|
32
|
+
Bundler.with_clean_env do
|
33
|
+
sh("bundle install")
|
34
|
+
sh("bundle exec rake spec")
|
35
|
+
end
|
34
36
|
end
|
35
37
|
end
|
36
38
|
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: 15.
|
4
|
+
version: 15.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 15.
|
19
|
+
version: 15.5.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 15.
|
26
|
+
version: 15.5.9
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: chef-utils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 15.5.9
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 15.5.9
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: train-core
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,16 +130,22 @@ dependencies:
|
|
116
130
|
name: mixlib-authentication
|
117
131
|
requirement: !ruby/object:Gem::Requirement
|
118
132
|
requirements:
|
119
|
-
- - "
|
133
|
+
- - ">="
|
120
134
|
- !ruby/object:Gem::Version
|
121
135
|
version: '2.1'
|
136
|
+
- - "<"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4'
|
122
139
|
type: :runtime
|
123
140
|
prerelease: false
|
124
141
|
version_requirements: !ruby/object:Gem::Requirement
|
125
142
|
requirements:
|
126
|
-
- - "
|
143
|
+
- - ">="
|
127
144
|
- !ruby/object:Gem::Version
|
128
145
|
version: '2.1'
|
146
|
+
- - "<"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '4'
|
129
149
|
- !ruby/object:Gem::Dependency
|
130
150
|
name: mixlib-shellout
|
131
151
|
requirement: !ruby/object:Gem::Requirement
|
@@ -935,7 +955,6 @@ files:
|
|
935
955
|
- lib/chef/mixin/shell_out.rb
|
936
956
|
- lib/chef/mixin/subclass_directive.rb
|
937
957
|
- lib/chef/mixin/template.rb
|
938
|
-
- lib/chef/mixin/train_helpers.rb
|
939
958
|
- lib/chef/mixin/unformatter.rb
|
940
959
|
- lib/chef/mixin/uris.rb
|
941
960
|
- lib/chef/mixin/user_context.rb
|
@@ -1153,6 +1172,7 @@ files:
|
|
1153
1172
|
- lib/chef/resource/cab_package.rb
|
1154
1173
|
- lib/chef/resource/chef_gem.rb
|
1155
1174
|
- lib/chef/resource/chef_handler.rb
|
1175
|
+
- lib/chef/resource/chef_sleep.rb
|
1156
1176
|
- lib/chef/resource/chocolatey_config.rb
|
1157
1177
|
- lib/chef/resource/chocolatey_feature.rb
|
1158
1178
|
- lib/chef/resource/chocolatey_package.rb
|
@@ -1547,6 +1567,10 @@ files:
|
|
1547
1567
|
- spec/data/cookbooks/preseed/metadata.rb
|
1548
1568
|
- spec/data/cookbooks/preseed/templates/default/preseed-template-variables.seed
|
1549
1569
|
- spec/data/cookbooks/preseed/templates/default/preseed-template.seed
|
1570
|
+
- spec/data/cookbooks/starter/chefignore
|
1571
|
+
- spec/data/cookbooks/starter/files/sample.txt
|
1572
|
+
- spec/data/cookbooks/starter/metadata.rb
|
1573
|
+
- spec/data/cookbooks/starter/recipes/default.rb
|
1550
1574
|
- spec/data/cookbooks/supports-platform-constraints/metadata.rb
|
1551
1575
|
- spec/data/cookbooks/wget/files/default/wget.response
|
1552
1576
|
- spec/data/definitions/test.rb
|
@@ -2220,7 +2244,6 @@ files:
|
|
2220
2244
|
- spec/unit/log/winevt_spec.rb
|
2221
2245
|
- spec/unit/log_spec.rb
|
2222
2246
|
- spec/unit/lwrp_spec.rb
|
2223
|
-
- spec/unit/mash_spec.rb
|
2224
2247
|
- spec/unit/mixin/api_version_request_handling_spec.rb
|
2225
2248
|
- spec/unit/mixin/checksum_spec.rb
|
2226
2249
|
- spec/unit/mixin/convert_to_class_name_spec.rb
|
@@ -2403,6 +2426,7 @@ files:
|
|
2403
2426
|
- spec/unit/resource/cab_package_spec.rb
|
2404
2427
|
- spec/unit/resource/chef_gem_spec.rb
|
2405
2428
|
- spec/unit/resource/chef_handler_spec.rb
|
2429
|
+
- spec/unit/resource/chef_sleep_spec.rb
|
2406
2430
|
- spec/unit/resource/chocolatey_config_spec.rb
|
2407
2431
|
- spec/unit/resource/chocolatey_feature_spec.rb
|
2408
2432
|
- spec/unit/resource/chocolatey_package_spec.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Author:: Lamont Granquist <lamont@chef.io>
|
3
|
-
# Copyright:: Copyright 2019, 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
|
-
require "stringio" unless defined?(StringIO)
|
19
|
-
|
20
|
-
class Chef
|
21
|
-
module Mixin
|
22
|
-
module TrainHelpers
|
23
|
-
|
24
|
-
#
|
25
|
-
# FIXME: generally these helpers all use the pattern of checking for target_mode?
|
26
|
-
# and then if it is we use train. That approach should likely be flipped so that
|
27
|
-
# even when we're running without target mode we still use inspec in its local
|
28
|
-
# mode.
|
29
|
-
#
|
30
|
-
|
31
|
-
# Train wrapper around File.exist? to make it local mode aware.
|
32
|
-
#
|
33
|
-
# @param filename filename to check
|
34
|
-
# @return [Boolean] if it exists
|
35
|
-
#
|
36
|
-
def file_exist?(filename)
|
37
|
-
if Chef::Config.target_mode?
|
38
|
-
Chef.run_context.transport_connection.file(filename).exist?
|
39
|
-
else
|
40
|
-
File.exist?(filename)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# XXX: modifications to the StringIO won't get written back
|
45
|
-
# FIXME: this is very experimental and may be a bad idea and may break at any time
|
46
|
-
# @api private
|
47
|
-
#
|
48
|
-
def file_open(*args, &block)
|
49
|
-
if Chef::Config.target_mode?
|
50
|
-
content = Chef.run_context.transport_connection.file(args[0]).content
|
51
|
-
string_io = StringIO.new content
|
52
|
-
yield string_io if block_given?
|
53
|
-
string_io
|
54
|
-
else
|
55
|
-
File.open(*args, &block)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/spec/unit/mash_spec.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
|
-
# Copyright:: Copyright 2011-2016, Chef Software Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
require "chef/mash"
|
21
|
-
|
22
|
-
describe Mash do
|
23
|
-
it "should duplicate a simple key/value mash to a new mash" do
|
24
|
-
data = { x: "one", y: "two", z: "three" }
|
25
|
-
@orig = Mash.new(data)
|
26
|
-
@copy = @orig.dup
|
27
|
-
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
|
28
|
-
@copy[:x] = "four"
|
29
|
-
expect(@orig[:x]).to eq("one")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should duplicate a mash with an array to a new mash" do
|
33
|
-
data = { x: "one", y: "two", z: [1, 2, 3] }
|
34
|
-
@orig = Mash.new(data)
|
35
|
-
@copy = @orig.dup
|
36
|
-
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
|
37
|
-
@copy[:z] << 4
|
38
|
-
expect(@orig[:z]).to eq([1, 2, 3])
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should duplicate a nested mash to a new mash" do
|
42
|
-
data = { x: "one", y: "two", z: Mash.new({ a: [1, 2, 3] }) }
|
43
|
-
@orig = Mash.new(data)
|
44
|
-
@copy = @orig.dup
|
45
|
-
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
|
46
|
-
@copy[:z][:a] << 4
|
47
|
-
expect(@orig[:z][:a]).to eq([1, 2, 3])
|
48
|
-
end
|
49
|
-
|
50
|
-
# add more!
|
51
|
-
end
|