chef 12.18.31-universal-mingw32 → 12.19.33-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 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -86,19 +86,17 @@ class Chef
|
|
86
86
|
private
|
87
87
|
|
88
88
|
def worker_loop
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
puts $!.backtrace
|
97
|
-
end
|
89
|
+
until @stop_thread[Thread.current]
|
90
|
+
begin
|
91
|
+
task = @tasks.pop
|
92
|
+
task.call
|
93
|
+
rescue
|
94
|
+
puts "ERROR #{$!}"
|
95
|
+
puts $!.backtrace
|
98
96
|
end
|
99
|
-
ensure
|
100
|
-
@stop_thread.delete(Thread.current)
|
101
97
|
end
|
98
|
+
ensure
|
99
|
+
@stop_thread.delete(Thread.current)
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
@@ -108,10 +108,10 @@ class Chef
|
|
108
108
|
@uploaded_cookbook_version_file = File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE)
|
109
109
|
end
|
110
110
|
|
111
|
-
if File.exists?(File.join(cookbook_path, "metadata.
|
112
|
-
@metadata_filenames << File.join(cookbook_path, "metadata.rb")
|
113
|
-
elsif File.exists?(File.join(cookbook_path, "metadata.json"))
|
111
|
+
if File.exists?(File.join(cookbook_path, "metadata.json"))
|
114
112
|
@metadata_filenames << File.join(cookbook_path, "metadata.json")
|
113
|
+
elsif File.exists?(File.join(cookbook_path, "metadata.rb"))
|
114
|
+
@metadata_filenames << File.join(cookbook_path, "metadata.rb")
|
115
115
|
elsif @uploaded_cookbook_version_file
|
116
116
|
@metadata_filenames << @uploaded_cookbook_version_file
|
117
117
|
end
|
@@ -305,40 +305,34 @@ class Chef
|
|
305
305
|
end
|
306
306
|
|
307
307
|
def apply_ruby_metadata(file)
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
raise
|
313
|
-
end
|
308
|
+
@metadata.from_file(file)
|
309
|
+
rescue Chef::Exceptions::JSON::ParseError
|
310
|
+
Chef::Log.error("Error evaluating metadata.rb for #{@inferred_cookbook_name} in " + file)
|
311
|
+
raise
|
314
312
|
end
|
315
313
|
|
316
314
|
def apply_json_metadata(file)
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
raise
|
322
|
-
end
|
315
|
+
@metadata.from_json(IO.read(file))
|
316
|
+
rescue Chef::Exceptions::JSON::ParseError
|
317
|
+
Chef::Log.error("Couldn't parse cookbook metadata JSON for #{@inferred_cookbook_name} in " + file)
|
318
|
+
raise
|
323
319
|
end
|
324
320
|
|
325
321
|
def apply_json_cookbook_version_metadata(file)
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
raise
|
341
|
-
end
|
322
|
+
data = Chef::JSONCompat.parse(IO.read(file))
|
323
|
+
@metadata.from_hash(data["metadata"])
|
324
|
+
# the JSON cookbok metadata file is only used by chef-zero.
|
325
|
+
# The Chef Server API currently does not enforce that the metadata
|
326
|
+
# have a `name` field, but that will cause an error when attempting
|
327
|
+
# to load the cookbook. To keep compatibility, we fake it by setting
|
328
|
+
# the metadata name from the cookbook version object's name.
|
329
|
+
#
|
330
|
+
# This behavior can be removed if/when Chef Server enforces that the
|
331
|
+
# metadata contains a name key.
|
332
|
+
@metadata.name(data["cookbook_name"]) unless data["metadata"].key?("name")
|
333
|
+
rescue Chef::Exceptions::JSON::ParseError
|
334
|
+
Chef::Log.error("Couldn't parse cookbook metadata JSON for #{@inferred_cookbook_name} in " + file)
|
335
|
+
raise
|
342
336
|
end
|
343
337
|
|
344
338
|
def set_frozen
|
@@ -462,7 +462,7 @@ class Chef
|
|
462
462
|
cookbook.fully_qualified_recipe_names.map do |recipe_name|
|
463
463
|
unqualified_name =
|
464
464
|
if recipe_name =~ /::default$/
|
465
|
-
|
465
|
+
name.to_s
|
466
466
|
else
|
467
467
|
recipe_name
|
468
468
|
end
|
@@ -567,29 +567,29 @@ class Chef
|
|
567
567
|
|
568
568
|
def to_hash
|
569
569
|
{
|
570
|
-
NAME =>
|
571
|
-
DESCRIPTION =>
|
572
|
-
LONG_DESCRIPTION =>
|
573
|
-
MAINTAINER =>
|
574
|
-
MAINTAINER_EMAIL =>
|
575
|
-
LICENSE =>
|
576
|
-
PLATFORMS =>
|
577
|
-
DEPENDENCIES =>
|
578
|
-
RECOMMENDATIONS =>
|
579
|
-
SUGGESTIONS =>
|
580
|
-
CONFLICTING =>
|
581
|
-
PROVIDING =>
|
582
|
-
REPLACING =>
|
583
|
-
ATTRIBUTES =>
|
584
|
-
GROUPINGS =>
|
585
|
-
RECIPES =>
|
586
|
-
VERSION =>
|
587
|
-
SOURCE_URL =>
|
588
|
-
ISSUES_URL =>
|
589
|
-
PRIVACY =>
|
590
|
-
CHEF_VERSIONS => gem_requirements_to_array(*
|
591
|
-
OHAI_VERSIONS => gem_requirements_to_array(*
|
592
|
-
GEMS =>
|
570
|
+
NAME => name,
|
571
|
+
DESCRIPTION => description,
|
572
|
+
LONG_DESCRIPTION => long_description,
|
573
|
+
MAINTAINER => maintainer,
|
574
|
+
MAINTAINER_EMAIL => maintainer_email,
|
575
|
+
LICENSE => license,
|
576
|
+
PLATFORMS => platforms,
|
577
|
+
DEPENDENCIES => dependencies,
|
578
|
+
RECOMMENDATIONS => recommendations,
|
579
|
+
SUGGESTIONS => suggestions,
|
580
|
+
CONFLICTING => conflicting,
|
581
|
+
PROVIDING => providing,
|
582
|
+
REPLACING => replacing,
|
583
|
+
ATTRIBUTES => attributes,
|
584
|
+
GROUPINGS => groupings,
|
585
|
+
RECIPES => recipes,
|
586
|
+
VERSION => version,
|
587
|
+
SOURCE_URL => source_url,
|
588
|
+
ISSUES_URL => issues_url,
|
589
|
+
PRIVACY => privacy,
|
590
|
+
CHEF_VERSIONS => gem_requirements_to_array(*chef_versions),
|
591
|
+
OHAI_VERSIONS => gem_requirements_to_array(*ohai_versions),
|
592
|
+
GEMS => gems,
|
593
593
|
}
|
594
594
|
end
|
595
595
|
|
@@ -598,7 +598,7 @@ class Chef
|
|
598
598
|
end
|
599
599
|
|
600
600
|
def self.from_hash(o)
|
601
|
-
cm =
|
601
|
+
cm = new()
|
602
602
|
cm.from_hash(o)
|
603
603
|
cm
|
604
604
|
end
|
@@ -632,7 +632,7 @@ class Chef
|
|
632
632
|
|
633
633
|
def self.from_json(string)
|
634
634
|
o = Chef::JSONCompat.from_json(string)
|
635
|
-
|
635
|
+
from_hash(o)
|
636
636
|
end
|
637
637
|
|
638
638
|
def self.validate_json(json_str)
|
@@ -110,7 +110,7 @@ class Chef
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def remove_uninteresting_ruby_files(file_list)
|
113
|
-
file_list.reject { |f| f =~ %r{#{cookbook_path}/(files|templates)/} }
|
113
|
+
file_list.reject { |f| f =~ %r{#{Regexp.quote(cookbook_path)}/(files|templates)/} }
|
114
114
|
end
|
115
115
|
|
116
116
|
def ruby_files
|
@@ -549,7 +549,7 @@ class Chef
|
|
549
549
|
end
|
550
550
|
|
551
551
|
def chef_server_rest
|
552
|
-
@chef_server_rest ||=
|
552
|
+
@chef_server_rest ||= chef_server_rest
|
553
553
|
end
|
554
554
|
|
555
555
|
def self.chef_server_rest
|
@@ -600,11 +600,11 @@ class Chef
|
|
600
600
|
end
|
601
601
|
|
602
602
|
def <=>(other)
|
603
|
-
raise Chef::Exceptions::CookbookVersionNameMismatch if
|
603
|
+
raise Chef::Exceptions::CookbookVersionNameMismatch if name != other.name
|
604
604
|
# FIXME: can we change the interface to the Metadata class such
|
605
605
|
# that metadata.version returns a Chef::Version instance instead
|
606
606
|
# of a string?
|
607
|
-
Chef::Version.new(
|
607
|
+
Chef::Version.new(version) <=> Chef::Version.new(other.version)
|
608
608
|
end
|
609
609
|
|
610
610
|
private
|
data/lib/chef/data_bag.rb
CHANGED
data/lib/chef/data_bag_item.rb
CHANGED
@@ -107,9 +107,9 @@ class Chef
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def to_hash
|
110
|
-
result =
|
110
|
+
result = raw_data.dup
|
111
111
|
result["chef_type"] = "data_bag_item"
|
112
|
-
result["data_bag"] =
|
112
|
+
result["data_bag"] = data_bag.to_s
|
113
113
|
result
|
114
114
|
end
|
115
115
|
|
@@ -207,7 +207,7 @@ class Chef
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def pretty_print(pretty_printer)
|
210
|
-
pretty_printer.pp({ "data_bag_item('#{data_bag}', '#{id}')" =>
|
210
|
+
pretty_printer.pp({ "data_bag_item('#{data_bag}', '#{id}')" => to_hash })
|
211
211
|
end
|
212
212
|
|
213
213
|
def id
|
data/lib/chef/data_collector.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Adam Leff (<adamleff@chef.io>)
|
3
3
|
# Author:: Ryan Cragun (<ryan@chef.io>)
|
4
4
|
#
|
5
|
-
# Copyright:: Copyright 2012-
|
5
|
+
# Copyright:: Copyright 2012-2017, Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -288,9 +288,9 @@ class Chef
|
|
288
288
|
# raise an exception.
|
289
289
|
def setup_http_client
|
290
290
|
if data_collector_token.nil?
|
291
|
-
Chef::ServerAPI.new(data_collector_server_url)
|
291
|
+
Chef::ServerAPI.new(data_collector_server_url, validate_utf8: false)
|
292
292
|
else
|
293
|
-
Chef::HTTP::SimpleJSON.new(data_collector_server_url)
|
293
|
+
Chef::HTTP::SimpleJSON.new(data_collector_server_url, validate_utf8: false)
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
@@ -333,7 +333,6 @@ class Chef
|
|
333
333
|
def send_to_data_collector(message)
|
334
334
|
return unless data_collector_accessible?
|
335
335
|
|
336
|
-
Chef::Log.debug("data_collector_reporter: POSTing the following message to #{data_collector_server_url}: #{Chef::JSONCompat.to_json(message)}")
|
337
336
|
http.post(nil, message, headers)
|
338
337
|
end
|
339
338
|
|
data/lib/chef/decorator.rb
CHANGED
@@ -52,7 +52,7 @@ class Chef
|
|
52
52
|
# adding the define_singleton_method call and @__defined_methods__ tracking
|
53
53
|
def method_missing(m, *args, &block)
|
54
54
|
r = true
|
55
|
-
target =
|
55
|
+
target = __getobj__ { r = false }
|
56
56
|
|
57
57
|
if r && target.respond_to?(m)
|
58
58
|
# these next 4 lines are the patched code
|
data/lib/chef/deprecated.rb
CHANGED
@@ -156,6 +156,26 @@ class Chef
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
+
class PropertyNameCollision < Base
|
160
|
+
def id
|
161
|
+
11
|
162
|
+
end
|
163
|
+
|
164
|
+
def target
|
165
|
+
"property_name_collision.html"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class LaunchdHashProperty < Base
|
170
|
+
def id
|
171
|
+
12
|
172
|
+
end
|
173
|
+
|
174
|
+
def target
|
175
|
+
"launchd_hash_property.html"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
159
179
|
class ChefPlatformMethods < Base
|
160
180
|
def id
|
161
181
|
13
|
@@ -176,6 +196,16 @@ class Chef
|
|
176
196
|
end
|
177
197
|
end
|
178
198
|
|
199
|
+
class PackageMisc < Base
|
200
|
+
def id
|
201
|
+
15
|
202
|
+
end
|
203
|
+
|
204
|
+
def target
|
205
|
+
"package_misc.html"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
179
209
|
class ResourceCloning < Base
|
180
210
|
def id
|
181
211
|
3694
|
data/lib/chef/dsl/audit.rb
CHANGED
@@ -38,8 +38,8 @@ class Chef
|
|
38
38
|
cookbook_name = self.cookbook_name
|
39
39
|
metadata = {
|
40
40
|
cookbook_name: cookbook_name,
|
41
|
-
cookbook_version:
|
42
|
-
recipe_name:
|
41
|
+
cookbook_version: run_context.cookbook_collection[cookbook_name].version,
|
42
|
+
recipe_name: recipe_name,
|
43
43
|
line_number: block.source_location[1],
|
44
44
|
}
|
45
45
|
|
@@ -287,7 +287,7 @@ class Chef
|
|
287
287
|
run_context: run_context,
|
288
288
|
cookbook_name: cookbook_name,
|
289
289
|
recipe_name: recipe_name,
|
290
|
-
enclosing_provider:
|
290
|
+
enclosing_provider: is_a?(Chef::Provider) ? self : nil
|
291
291
|
).build(&resource_attrs_block)
|
292
292
|
end
|
293
293
|
end
|
@@ -68,41 +68,39 @@ class Chef
|
|
68
68
|
private
|
69
69
|
|
70
70
|
def match_versions(node)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
key_matches << k
|
81
|
-
end
|
82
|
-
rescue Chef::Exceptions::InvalidVersionConstraint => e
|
83
|
-
Chef::Log.debug "Caught InvalidVersionConstraint. This means that a key in value_for_platform cannot be interpreted as a Chef::VersionConstraint::Platform."
|
84
|
-
Chef::Log.debug(e)
|
71
|
+
platform, version = node[:platform].to_s, node[:platform_version].to_s
|
72
|
+
return nil unless @values.key?(platform)
|
73
|
+
node_version = Chef::Version::Platform.new(version)
|
74
|
+
key_matches = []
|
75
|
+
keys = @values[platform].keys
|
76
|
+
keys.each do |k|
|
77
|
+
begin
|
78
|
+
if Chef::VersionConstraint::Platform.new(k).include?(node_version)
|
79
|
+
key_matches << k
|
85
80
|
end
|
81
|
+
rescue Chef::Exceptions::InvalidVersionConstraint => e
|
82
|
+
Chef::Log.debug "Caught InvalidVersionConstraint. This means that a key in value_for_platform cannot be interpreted as a Chef::VersionConstraint::Platform."
|
83
|
+
Chef::Log.debug(e)
|
86
84
|
end
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
when 1
|
92
|
-
return @values[platform][key_matches.first]
|
93
|
-
else
|
94
|
-
raise "Multiple matches detected for #{platform} with values #{@values}. The matches are: #{key_matches}"
|
95
|
-
end
|
96
|
-
rescue Chef::Exceptions::InvalidCookbookVersion => e
|
97
|
-
# Lets not break because someone passes a weird string like 'default' :)
|
98
|
-
Chef::Log.debug(e)
|
99
|
-
Chef::Log.debug "InvalidCookbookVersion exceptions are common and expected here: the generic constraint matcher attempted to match something which is not a constraint. Moving on to next version or constraint"
|
100
|
-
return nil
|
101
|
-
rescue Chef::Exceptions::InvalidPlatformVersion => e
|
102
|
-
Chef::Log.debug "Caught InvalidPlatformVersion, this means that Chef::Version::Platform does not know how to turn #{node_version} into an x.y.z format"
|
103
|
-
Chef::Log.debug(e)
|
85
|
+
end
|
86
|
+
return @values[platform][version] if key_matches.include?(version)
|
87
|
+
case key_matches.length
|
88
|
+
when 0
|
104
89
|
return nil
|
90
|
+
when 1
|
91
|
+
return @values[platform][key_matches.first]
|
92
|
+
else
|
93
|
+
raise "Multiple matches detected for #{platform} with values #{@values}. The matches are: #{key_matches}"
|
105
94
|
end
|
95
|
+
rescue Chef::Exceptions::InvalidCookbookVersion => e
|
96
|
+
# Lets not break because someone passes a weird string like 'default' :)
|
97
|
+
Chef::Log.debug(e)
|
98
|
+
Chef::Log.debug "InvalidCookbookVersion exceptions are common and expected here: the generic constraint matcher attempted to match something which is not a constraint. Moving on to next version or constraint"
|
99
|
+
return nil
|
100
|
+
rescue Chef::Exceptions::InvalidPlatformVersion => e
|
101
|
+
Chef::Log.debug "Caught InvalidPlatformVersion, this means that Chef::Version::Platform does not know how to turn #{node_version} into an x.y.z format"
|
102
|
+
Chef::Log.debug(e)
|
103
|
+
return nil
|
106
104
|
end
|
107
105
|
|
108
106
|
def set(platforms, value)
|
@@ -30,7 +30,7 @@ class Chef
|
|
30
30
|
# Note that we will silently miss any other platform-specific reboot notices besides Windows+Ubuntu.
|
31
31
|
def reboot_pending?
|
32
32
|
# don't break when used as a mixin in contexts without #node (e.g. specs).
|
33
|
-
if
|
33
|
+
if respond_to?(:node, true) && node.run_context.reboot_requested?
|
34
34
|
true
|
35
35
|
elsif platform?("windows")
|
36
36
|
# PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated
|
data/lib/chef/dsl/resources.rb
CHANGED
@@ -33,19 +33,17 @@ class Chef
|
|
33
33
|
include Chef::DSL::ChefProvisioning
|
34
34
|
|
35
35
|
def self.add_resource_dsl(dsl_name)
|
36
|
-
|
37
|
-
module_eval(<<-EOM, __FILE__, __LINE__ + 1)
|
36
|
+
module_eval(<<-EOM, __FILE__, __LINE__ + 1)
|
38
37
|
def #{dsl_name}(*args, &block)
|
39
38
|
Chef.deprecated(:internal_api, "Cannot create resource #{dsl_name} with more than one argument. All arguments except the name (\#{args[0].inspect}) will be ignored. This will cause an error in Chef 13. Arguments: \#{args}") if args.size > 1
|
40
39
|
declare_resource(#{dsl_name.inspect}, args[0], caller[0], &block)
|
41
40
|
end
|
42
41
|
EOM
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
42
|
+
rescue SyntaxError
|
43
|
+
# Handle the case where dsl_name has spaces, etc.
|
44
|
+
define_method(dsl_name.to_sym) do |*args, &block|
|
45
|
+
Chef.deprecated(:internal_api, "Cannot create resource #{dsl_name} with more than one argument. All arguments except the name (#{args[0].inspect}) will be ignored. This will cause an error in Chef 13. Arguments: #{args}") if args.size > 1
|
46
|
+
declare_resource(dsl_name, args[0], caller[0], &block)
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|