chef 12.4.3-universal-mingw32 → 12.5.1-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +21 -25
- data/Gemfile +46 -0
- data/README.md +4 -4
- data/Rakefile +4 -110
- data/bin/chef-service-manager +3 -1
- data/distro/common/html/knife_cookbook_site.html +18 -18
- data/distro/common/man/man1/knife-cookbook-site.1 +11 -11
- data/lib/chef.rb +1 -1
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/apply.rb +19 -1
- data/lib/chef/application/client.rb +11 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/application/windows_service_manager.rb +19 -12
- data/lib/chef/chef_class.rb +46 -0
- data/lib/chef/chef_fs/config.rb +22 -24
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +3 -1
- data/lib/chef/chef_fs/file_pattern.rb +4 -15
- data/lib/chef/chef_fs/file_system/acl_dir.rb +3 -4
- data/lib/chef/chef_fs/file_system/acls_dir.rb +5 -1
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +0 -5
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +5 -2
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +2 -9
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_entry.rb +2 -9
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbooks_dir.rb +10 -17
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -12
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +15 -11
- data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +8 -2
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +4 -4
- data/lib/chef/chef_fs/file_system/cookbooks_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -11
- data/lib/chef/chef_fs/file_system/data_bags_dir.rb +3 -5
- data/lib/chef/chef_fs/file_system/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/file_system_entry.rb +7 -4
- data/lib/chef/chef_fs/file_system/memory_dir.rb +2 -3
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +15 -0
- data/lib/chef/chef_fs/file_system/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/organization_members_entry.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +4 -9
- data/lib/chef/chef_fs/knife.rb +35 -7
- data/lib/chef/chef_fs/path_utils.rb +65 -34
- data/lib/chef/client.rb +2 -3
- data/lib/chef/config.rb +34 -2
- data/lib/chef/{mixin/wstring.rb → constants.rb} +9 -13
- data/lib/chef/cookbook/metadata.rb +25 -3
- data/lib/chef/cookbook/synchronizer.rb +1 -1
- data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/delayed_evaluator.rb +21 -0
- data/lib/chef/deprecation/mixin/template.rb +1 -2
- data/lib/chef/deprecation/provider/cookbook_file.rb +1 -1
- data/lib/chef/deprecation/provider/file.rb +1 -1
- data/lib/chef/deprecation/provider/remote_directory.rb +52 -0
- data/lib/chef/deprecation/provider/remote_file.rb +1 -2
- data/lib/chef/deprecation/provider/template.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +3 -4
- data/lib/chef/dsl/reboot_pending.rb +3 -2
- data/lib/chef/dsl/recipe.rb +26 -7
- data/lib/chef/dsl/resources.rb +2 -2
- data/lib/chef/event_dispatch/base.rb +51 -22
- data/lib/chef/event_dispatch/dispatcher.rb +21 -6
- data/lib/chef/event_dispatch/dsl.rb +64 -0
- data/lib/chef/exceptions.rb +28 -1
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/base.rb +3 -0
- data/lib/chef/formatters/doc.rb +56 -6
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +36 -0
- data/lib/chef/formatters/minimal.rb +2 -2
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +3 -1
- data/lib/chef/http/http_request.rb +1 -1
- data/lib/chef/knife.rb +35 -55
- data/lib/chef/knife/bootstrap.rb +41 -0
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -0
- data/lib/chef/knife/bootstrap/client_builder.rb +16 -0
- data/lib/chef/knife/bootstrap/templates/README.md +3 -4
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +1 -1
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +6 -6
- data/lib/chef/knife/cookbook_site_unshare.rb +2 -2
- data/lib/chef/knife/core/bootstrap_context.rb +12 -4
- data/lib/chef/knife/core/custom_manifest_loader.rb +69 -0
- data/lib/chef/knife/core/gem_glob_loader.rb +138 -0
- data/lib/chef/knife/core/hashed_command_loader.rb +80 -0
- data/lib/chef/knife/core/node_presenter.rb +24 -1
- data/lib/chef/knife/core/object_loader.rb +1 -0
- data/lib/chef/knife/core/subcommand_loader.rb +131 -146
- data/lib/chef/knife/node_run_list_remove.rb +12 -1
- data/lib/chef/knife/null.rb +10 -0
- data/lib/chef/knife/rehash.rb +62 -0
- data/lib/chef/knife/search.rb +3 -3
- data/lib/chef/knife/ssh.rb +52 -30
- data/lib/chef/knife/ssl_check.rb +3 -2
- data/lib/chef/knife/user_edit.rb +1 -2
- data/lib/chef/local_mode.rb +5 -0
- data/lib/chef/log.rb +5 -1
- data/lib/chef/mixin/deprecation.rb +8 -8
- data/lib/chef/mixin/params_validate.rb +362 -135
- data/lib/chef/mixin/template.rb +48 -0
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/mixin/wide_string.rb +72 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +15 -39
- data/lib/chef/mixin/windows_env_helper.rb +4 -1
- data/lib/chef/monkey_patches/webrick-utils.rb +51 -0
- data/lib/chef/monkey_patches/win32/registry.rb +72 -0
- data/lib/chef/node.rb +116 -3
- data/lib/chef/node_map.rb +2 -2
- data/lib/chef/platform/handler_map.rb +0 -5
- data/lib/chef/platform/provider_mapping.rb +5 -6
- data/lib/chef/platform/query_helpers.rb +46 -4
- data/lib/chef/platform/rebooter.rb +1 -1
- data/lib/chef/platform/service_helpers.rb +30 -32
- data/lib/chef/policy_builder.rb +1 -8
- data/lib/chef/policy_builder/dynamic.rb +186 -0
- data/lib/chef/policy_builder/expand_node_object.rb +30 -15
- data/lib/chef/policy_builder/policyfile.rb +155 -18
- data/lib/chef/property.rb +568 -0
- data/lib/chef/provider.rb +222 -13
- data/lib/chef/provider/batch.rb +8 -0
- data/lib/chef/provider/deploy.rb +5 -7
- data/lib/chef/provider/directory.rb +14 -2
- data/lib/chef/provider/dsc_resource.rb +5 -9
- data/lib/chef/provider/group/pw.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +2 -2
- data/lib/chef/provider/lwrp_base.rb +1 -75
- data/lib/chef/provider/mount.rb +7 -3
- data/lib/chef/provider/package.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +5 -11
- data/lib/chef/provider/package/rpm.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +1 -1
- data/lib/chef/provider/package/windows/msi.rb +2 -2
- data/lib/chef/provider/package/yum.rb +17 -5
- data/lib/chef/provider/powershell_script.rb +59 -23
- data/lib/chef/provider/registry_key.rb +5 -5
- data/lib/chef/provider/remote_directory.rb +190 -102
- data/lib/chef/provider/service.rb +12 -2
- data/lib/chef/provider/service/aix.rb +1 -1
- data/lib/chef/provider/service/debian.rb +3 -5
- data/lib/chef/provider/service/freebsd.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +3 -3
- data/lib/chef/provider/service/init.rb +3 -3
- data/lib/chef/provider/service/insserv.rb +2 -4
- data/lib/chef/provider/service/invokercd.rb +2 -4
- data/lib/chef/provider/service/macosx.rb +5 -1
- data/lib/chef/provider/service/openbsd.rb +2 -1
- data/lib/chef/provider/service/redhat.rb +52 -16
- data/lib/chef/provider/service/simple.rb +2 -2
- data/lib/chef/provider/service/systemd.rb +3 -5
- data/lib/chef/provider/service/upstart.rb +4 -6
- data/lib/chef/provider/subversion.rb +13 -7
- data/lib/chef/provider/template/content.rb +16 -6
- data/lib/chef/provider/user/solaris.rb +32 -4
- data/lib/chef/provider/windows_script.rb +3 -5
- data/lib/chef/provider_resolver.rb +2 -2
- data/lib/chef/recipe.rb +1 -8
- data/lib/chef/resource.rb +563 -90
- data/lib/chef/resource/action_class.rb +83 -0
- data/lib/chef/resource/chef_gem.rb +3 -3
- data/lib/chef/resource/deploy.rb +8 -2
- data/lib/chef/resource/dsc_script.rb +2 -0
- data/lib/chef/resource/file/verification.rb +7 -1
- data/lib/chef/resource/lwrp_base.rb +1 -7
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/service.rb +10 -2
- data/lib/chef/resource/subversion.rb +5 -0
- data/lib/chef/resource/windows_script.rb +6 -2
- data/lib/chef/resource/yum_package.rb +10 -1
- data/lib/chef/resource_resolver.rb +3 -3
- data/lib/chef/run_context.rb +402 -83
- data/lib/chef/run_list/versioned_recipe_list.rb +15 -0
- data/lib/chef/run_lock.rb +30 -21
- data/lib/chef/util/powershell/ps_credential.rb +4 -0
- data/lib/chef/util/windows.rb +0 -32
- data/lib/chef/util/windows/net_group.rb +85 -106
- data/lib/chef/util/windows/net_use.rb +35 -71
- data/lib/chef/util/windows/net_user.rb +0 -1
- data/lib/chef/util/windows/volume.rb +19 -19
- data/lib/chef/version.rb +3 -3
- data/lib/chef/win32/api.rb +1 -0
- data/lib/chef/win32/api/file.rb +20 -0
- data/lib/chef/win32/api/net.rb +163 -43
- data/lib/chef/win32/api/registry.rb +51 -0
- data/lib/chef/win32/api/system.rb +23 -0
- data/lib/chef/win32/api/unicode.rb +0 -43
- data/lib/chef/win32/crypto.rb +2 -1
- data/lib/chef/win32/file.rb +28 -3
- data/lib/chef/win32/mutex.rb +1 -2
- data/lib/chef/win32/net.rb +162 -8
- data/lib/chef/win32/process.rb +13 -0
- data/lib/chef/win32/registry.rb +35 -30
- data/lib/chef/win32/security.rb +1 -1
- data/lib/chef/win32/security/token.rb +1 -1
- data/lib/chef/win32/system.rb +62 -0
- data/lib/chef/win32/unicode.rb +7 -2
- data/lib/chef/win32/version.rb +0 -4
- data/lib/chef/workstation_config_loader.rb +3 -158
- data/spec/data/cookbooks/openldap/templates/default/helpers.erb +14 -0
- data/spec/data/cookbooks/openldap/templates/default/nested_openldap_partials.erb +1 -0
- data/spec/data/cookbooks/openldap/templates/default/nested_partial.erb +1 -0
- data/spec/data/dsc_lcm.pfx +0 -0
- data/spec/data/run_context/cookbooks/include/recipes/default.rb +24 -0
- data/spec/data/run_context/cookbooks/include/recipes/includee.rb +3 -0
- data/spec/functional/dsl/reboot_pending_spec.rb +33 -43
- data/spec/functional/knife/cookbook_delete_spec.rb +17 -7
- data/spec/functional/knife/ssh_spec.rb +16 -0
- data/spec/functional/rebooter_spec.rb +1 -1
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +2 -0
- data/spec/functional/resource/dsc_script_spec.rb +91 -2
- data/spec/functional/resource/group_spec.rb +67 -44
- data/spec/functional/resource/{powershell_spec.rb → powershell_script_spec.rb} +107 -18
- data/spec/functional/resource/windows_service_spec.rb +1 -1
- data/spec/functional/run_lock_spec.rb +368 -189
- data/spec/functional/win32/{registry_helper_spec.rb → registry_spec.rb} +16 -23
- data/spec/functional/win32/service_manager_spec.rb +2 -2
- data/spec/integration/client/client_spec.rb +51 -0
- data/spec/integration/knife/chef_repo_path_spec.rb +13 -11
- data/spec/integration/knife/download_spec.rb +4 -0
- data/spec/integration/knife/list_spec.rb +8 -0
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -16
- data/spec/integration/recipes/remote_directory.rb +74 -0
- data/spec/integration/recipes/resource_action_spec.rb +363 -0
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +423 -0
- data/spec/integration/recipes/resource_load_spec.rb +206 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/platform_helpers.rb +13 -0
- data/spec/support/shared/context/win32.rb +34 -0
- data/spec/support/shared/functional/win32_service.rb +2 -1
- data/spec/support/shared/functional/windows_script.rb +63 -26
- data/spec/support/shared/unit/mock_shellout.rb +46 -0
- data/spec/support/shared/unit/provider/file.rb +10 -4
- data/spec/unit/application/client_spec.rb +16 -3
- data/spec/unit/application/knife_spec.rb +2 -2
- data/spec/unit/application/solo_spec.rb +4 -3
- data/spec/unit/chef_class_spec.rb +23 -4
- data/spec/unit/chef_fs/path_util_spec.rb +108 -0
- data/spec/unit/client_spec.rb +6 -1
- data/spec/unit/config_spec.rb +31 -0
- data/spec/unit/cookbook/metadata_spec.rb +23 -3
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/deprecation_spec.rb +3 -6
- data/spec/unit/dsl/reboot_pending_spec.rb +12 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +65 -3
- data/spec/unit/event_dispatch/dsl_spec.rb +83 -0
- data/spec/unit/formatters/doc_spec.rb +32 -0
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +26 -0
- data/spec/unit/json_compat_spec.rb +4 -3
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +27 -0
- data/spec/unit/knife/bootstrap_spec.rb +55 -3
- data/spec/unit/knife/cookbook_site_share_spec.rb +3 -3
- data/spec/unit/knife/core/bootstrap_context_spec.rb +21 -4
- data/spec/unit/knife/core/custom_manifest_loader_spec.rb +41 -0
- data/spec/unit/knife/core/gem_glob_loader_spec.rb +210 -0
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +93 -0
- data/spec/unit/knife/core/subcommand_loader_spec.rb +16 -192
- data/spec/unit/knife/node_run_list_remove_spec.rb +17 -0
- data/spec/unit/knife/ssl_check_spec.rb +4 -0
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +10 -10
- data/spec/unit/mixin/params_validate_spec.rb +4 -2
- data/spec/unit/mixin/template_spec.rb +5 -1
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +13 -8
- data/spec/unit/node_spec.rb +220 -0
- data/spec/unit/platform/query_helpers_spec.rb +146 -3
- data/spec/unit/policy_builder/dynamic_spec.rb +275 -0
- data/spec/unit/policy_builder/expand_node_object_spec.rb +37 -38
- data/spec/unit/policy_builder/policyfile_spec.rb +260 -46
- data/spec/unit/property/state_spec.rb +506 -0
- data/spec/unit/property/validation_spec.rb +663 -0
- data/spec/unit/property_spec.rb +1094 -0
- data/spec/unit/provider/deploy_spec.rb +5 -5
- data/spec/unit/provider/directory_spec.rb +35 -0
- data/spec/unit/provider/dsc_resource_spec.rb +3 -10
- data/spec/unit/provider/ifconfig_spec.rb +22 -2
- data/spec/unit/provider/mount/aix_spec.rb +2 -1
- data/spec/unit/provider/mount/mount_spec.rb +6 -0
- data/spec/unit/provider/mount/windows_spec.rb +14 -0
- data/spec/unit/provider/mount_spec.rb +12 -1
- data/spec/unit/provider/package/dpkg_spec.rb +8 -1
- data/spec/unit/provider/package/rpm_spec.rb +18 -1
- data/spec/unit/provider/package/rubygems_spec.rb +18 -0
- data/spec/unit/provider/package/yum_spec.rb +97 -24
- data/spec/unit/provider/powershell_script_spec.rb +106 -0
- data/spec/unit/provider/registry_key_spec.rb +12 -0
- data/spec/unit/provider/remote_directory_spec.rb +1 -2
- data/spec/unit/provider/service/aix_service_spec.rb +3 -3
- data/spec/unit/provider/service/gentoo_service_spec.rb +4 -4
- data/spec/unit/provider/service/macosx_spec.rb +4 -4
- data/spec/unit/provider/service/openbsd_service_spec.rb +10 -8
- data/spec/unit/provider/service/redhat_spec.rb +88 -8
- data/spec/unit/provider/service/upstart_service_spec.rb +11 -7
- data/spec/unit/provider/service/windows_spec.rb +211 -200
- data/spec/unit/provider/subversion_spec.rb +50 -31
- data/spec/unit/provider/template/content_spec.rb +93 -2
- data/spec/unit/provider/user/solaris_spec.rb +66 -9
- data/spec/unit/provider_resolver_spec.rb +707 -650
- data/spec/unit/provider_spec.rb +1 -3
- data/spec/unit/recipe_spec.rb +0 -4
- data/spec/unit/resource/deploy_spec.rb +7 -1
- data/spec/unit/resource/dsc_script_spec.rb +4 -0
- data/spec/unit/resource/file/verification_spec.rb +33 -5
- data/spec/unit/resource/{powershell_spec.rb → powershell_script_spec.rb} +17 -13
- data/spec/unit/resource/service_spec.rb +4 -4
- data/spec/unit/resource/subversion_spec.rb +4 -0
- data/spec/unit/resource/yum_package_spec.rb +10 -1
- data/spec/unit/resource_spec.rb +2 -2
- data/spec/unit/run_context/child_run_context_spec.rb +133 -0
- data/spec/unit/run_context_spec.rb +7 -0
- data/spec/unit/run_list/versioned_recipe_list_spec.rb +5 -0
- data/spec/unit/win32/registry_spec.rb +394 -0
- data/tasks/external_tests.rb +47 -23
- data/tasks/maintainers.rb +155 -14
- metadata +64 -53
- data/lib/chef/knife/bootstrap/templates/archlinux-gems.erb +0 -76
- data/lib/chef/knife/bootstrap/templates/chef-aix.erb +0 -72
- data/spec/unit/provider/powershell_spec.rb +0 -80
- data/spec/unit/registry_helper_spec.rb +0 -376
- data/spec/unit/workstation_config_loader_spec.rb +0 -283
@@ -23,31 +23,31 @@ class Chef
|
|
23
23
|
module ChefFS
|
24
24
|
class PathUtils
|
25
25
|
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
26
|
+
# A Chef-FS path is a path in a chef-repository that can be used to address
|
27
|
+
# both files on a local file-system as well as objects on a chef server.
|
28
|
+
# These paths are stricter than file-system paths allowed on various OSes.
|
29
|
+
# Absolute Chef-FS paths begin with "/" (on windows, "\" is acceptable as well).
|
30
|
+
# "/" is used as the path element separator (on windows, "\" is acceptable as well).
|
31
|
+
# No directory/path element may contain a literal "\" character. Any such characters
|
32
|
+
# encountered are either dealt with as separators (on windows) or as escape
|
33
|
+
# characters (on POSIX systems). Relative Chef-FS paths may use ".." or "." but
|
34
|
+
# may never use these to back-out of the root of a Chef-FS path. Any such extraneous
|
35
|
+
# ".."s are ignored.
|
36
|
+
# Chef-FS paths are case sensitive (since the paths on the server are).
|
37
|
+
# On OSes with case insensitive paths, you may be unable to locally deal with two
|
38
|
+
# objects whose server paths only differ by case. OTOH, the case of path segments
|
39
|
+
# that are outside the Chef-FS root (such as when looking at a file-system absolute
|
40
|
+
# path to discover the Chef-FS root path) are handled in accordance to the rules
|
41
|
+
# of the local file-system and OS.
|
42
42
|
|
43
43
|
def self.join(*parts)
|
44
44
|
return "" if parts.length == 0
|
45
45
|
# Determine if it started with a slash
|
46
46
|
absolute = parts[0].length == 0 || parts[0].length > 0 && parts[0] =~ /^#{regexp_path_separator}/
|
47
47
|
# Remove leading and trailing slashes from each part so that the join will work (and the slash at the end will go away)
|
48
|
-
parts = parts.map { |part| part.gsub(
|
48
|
+
parts = parts.map { |part| part.gsub(/^#{regexp_path_separator}+|#{regexp_path_separator}+$/, '') }
|
49
49
|
# Don't join empty bits
|
50
|
-
result = parts.select { |part| part !=
|
50
|
+
result = parts.select { |part| part != '' }.join('/')
|
51
51
|
# Put the / back on
|
52
52
|
absolute ? "/#{result}" : result
|
53
53
|
end
|
@@ -60,36 +60,67 @@ class Chef
|
|
60
60
|
Chef::ChefFS::windows? ? '[\/\\\\]' : '/'
|
61
61
|
end
|
62
62
|
|
63
|
+
# Given a server path, determines if it is absolute.
|
64
|
+
def self.is_absolute?(path)
|
65
|
+
!!(path =~ /^#{regexp_path_separator}/)
|
66
|
+
end
|
63
67
|
# Given a path which may only be partly real (i.e. /x/y/z when only /x exists,
|
64
68
|
# or /x/y/*/blah when /x/y/z/blah exists), call File.realpath on the biggest
|
65
|
-
# part that actually exists.
|
69
|
+
# part that actually exists. The paths operated on here are not Chef-FS paths.
|
70
|
+
# These are OS paths that may contain symlinks but may not also fully exist.
|
66
71
|
#
|
67
72
|
# If /x is a symlink to /blarghle, and has no subdirectories, then:
|
68
73
|
# PathUtils.realest_path('/x/y/z') == '/blarghle/y/z'
|
69
74
|
# PathUtils.realest_path('/x/*/z') == '/blarghle/*/z'
|
70
75
|
# PathUtils.realest_path('/*/y/z') == '/*/y/z'
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
#
|
77
|
+
# TODO: Move this to wherever util/path_helper is these days.
|
78
|
+
def self.realest_path(path, cwd = Dir.pwd)
|
79
|
+
path = File.expand_path(path, cwd)
|
80
|
+
parent_path = File.dirname(path)
|
81
|
+
suffix = []
|
82
|
+
|
83
|
+
# File.dirname happens to return the path as its own dirname if you're
|
84
|
+
# at the root (such as at \\foo\bar, C:\ or /)
|
85
|
+
until parent_path == path do
|
86
|
+
# This can occur if a path such as "C:" is given. Ruby gives the parent as "C:."
|
87
|
+
# for reasons only it knows.
|
88
|
+
raise ArgumentError "Invalid path segment #{path}" if parent_path.length > path.length
|
89
|
+
begin
|
90
|
+
path = File.realpath(path)
|
91
|
+
break
|
92
|
+
rescue Errno::ENOENT
|
93
|
+
suffix << File.basename(path)
|
94
|
+
path = parent_path
|
95
|
+
parent_path = File.dirname(path)
|
81
96
|
end
|
82
97
|
end
|
98
|
+
File.join(path, *suffix.reverse)
|
83
99
|
end
|
84
100
|
|
85
|
-
|
86
|
-
|
87
|
-
|
101
|
+
# Compares two path fragments according to the case-sentitivity of the host platform.
|
102
|
+
def self.os_path_eq?(left, right)
|
103
|
+
Chef::ChefFS::windows? ? left.casecmp(right) == 0 : left == right
|
88
104
|
end
|
89
105
|
|
90
|
-
|
91
|
-
|
106
|
+
# Given two general OS-dependent file paths, determines the relative path of the
|
107
|
+
# child with respect to the ancestor. Both child and ancestor must exist and be
|
108
|
+
# fully resolved - this is strictly a lexical comparison. No trailing slashes
|
109
|
+
# and other shenanigans are allowed.
|
110
|
+
#
|
111
|
+
# TODO: Move this to util/path_helper.
|
112
|
+
def self.descendant_path(path, ancestor)
|
113
|
+
candidate_fragment = path[0, ancestor.length]
|
114
|
+
return nil unless PathUtils.os_path_eq?(candidate_fragment, ancestor)
|
115
|
+
if ancestor.length == path.length
|
116
|
+
''
|
117
|
+
elsif path[ancestor.length,1] =~ /#{PathUtils.regexp_path_separator}/
|
118
|
+
path[ancestor.length+1..-1]
|
119
|
+
else
|
120
|
+
nil
|
121
|
+
end
|
92
122
|
end
|
123
|
+
|
93
124
|
end
|
94
125
|
end
|
95
126
|
end
|
data/lib/chef/client.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: Christopher Walters (<cw@opscode.com>)
|
4
4
|
# Author:: Christopher Brown (<cb@opscode.com>)
|
5
5
|
# Author:: Tim Hinderliter (<tim@opscode.com>)
|
6
|
-
# Copyright:: Copyright (c) 2008-
|
6
|
+
# Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
|
7
7
|
# License:: Apache License, Version 2.0
|
8
8
|
#
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -302,7 +302,6 @@ class Chef
|
|
302
302
|
@run_status = nil
|
303
303
|
run_context = nil
|
304
304
|
runlock.release
|
305
|
-
GC.start
|
306
305
|
end
|
307
306
|
|
308
307
|
# Raise audit, converge, and other errors here so that we exit
|
@@ -497,7 +496,7 @@ class Chef
|
|
497
496
|
# @api private
|
498
497
|
#
|
499
498
|
def policy_builder
|
500
|
-
@policy_builder ||= Chef::PolicyBuilder.
|
499
|
+
@policy_builder ||= Chef::PolicyBuilder::Dynamic.new(node_name, ohai.data, json_attribs, override_runlist, events)
|
501
500
|
end
|
502
501
|
|
503
502
|
#
|
data/lib/chef/config.rb
CHANGED
@@ -28,9 +28,21 @@ require 'chef-config/logger'
|
|
28
28
|
ChefConfig.logger = Chef::Log
|
29
29
|
|
30
30
|
require 'chef-config/config'
|
31
|
-
|
32
31
|
require 'chef/platform/query_helpers'
|
33
32
|
|
33
|
+
# Ohai::Config defines its own log_level and log_location. When loaded, it will
|
34
|
+
# override the default ChefConfig::Config values. We save them here before
|
35
|
+
# loading ohai/config so that we can override them again inside Chef::Config.
|
36
|
+
#
|
37
|
+
# REMOVEME once these configurables are removed from the top level of Ohai.
|
38
|
+
LOG_LEVEL = ChefConfig::Config[:log_level] unless defined? LOG_LEVEL
|
39
|
+
LOG_LOCATION = ChefConfig::Config[:log_location] unless defined? LOG_LOCATION
|
40
|
+
|
41
|
+
# Load the ohai config into the chef config. We can't have an empty ohai
|
42
|
+
# configuration context because `ohai.plugins_path << some_path` won't work,
|
43
|
+
# and providing default ohai config values here isn't DRY.
|
44
|
+
require 'ohai/config'
|
45
|
+
|
34
46
|
class Chef
|
35
47
|
Config = ChefConfig::Config
|
36
48
|
|
@@ -43,11 +55,31 @@ class Chef
|
|
43
55
|
|
44
56
|
default :event_loggers do
|
45
57
|
evt_loggers = []
|
46
|
-
if ChefConfig.windows?
|
58
|
+
if ChefConfig.windows? && !(Chef::Platform.windows_server_2003? ||
|
59
|
+
Chef::Platform.windows_nano_server?)
|
47
60
|
evt_loggers << :win_evt
|
48
61
|
end
|
49
62
|
evt_loggers
|
50
63
|
end
|
51
64
|
|
65
|
+
# Override the default values that were set by Ohai.
|
66
|
+
#
|
67
|
+
# REMOVEME once these configurables are removed from the top level of Ohai.
|
68
|
+
default :log_level, LOG_LEVEL
|
69
|
+
default :log_location, LOG_LOCATION
|
70
|
+
|
71
|
+
# Ohai::Config[:log_level] is deprecated and warns when set. Unfortunately,
|
72
|
+
# there is no way to distinguish between setting log_level and setting
|
73
|
+
# Ohai::Config[:log_level]. Since log_level and log_location are used by
|
74
|
+
# chef-client and other tools (e.g., knife), we will mute the warnings here
|
75
|
+
# by redefining the config_attr_writer to not warn for these options.
|
76
|
+
#
|
77
|
+
# REMOVEME once the warnings for these configurables are removed from Ohai.
|
78
|
+
[ :log_level, :log_location ].each do |option|
|
79
|
+
config_attr_writer option do |value|
|
80
|
+
value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
52
84
|
end
|
53
85
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author::
|
3
|
-
# Copyright:: Copyright 2015
|
2
|
+
# Author:: John Keiser <jkeiser@chef.io>
|
3
|
+
# Copyright:: Copyright (c) 2015 Opscode, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -14,18 +14,14 @@
|
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
|
-
#
|
18
17
|
|
19
18
|
class Chef
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
str.to_wstring
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
19
|
+
NOT_PASSED = Object.new
|
20
|
+
def NOT_PASSED.to_s
|
21
|
+
"NOT_PASSED"
|
22
|
+
end
|
23
|
+
def NOT_PASSED.inspect
|
24
|
+
to_s
|
30
25
|
end
|
26
|
+
NOT_PASSED.freeze
|
31
27
|
end
|
@@ -54,12 +54,13 @@ class Chef
|
|
54
54
|
VERSION = 'version'.freeze
|
55
55
|
SOURCE_URL = 'source_url'.freeze
|
56
56
|
ISSUES_URL = 'issues_url'.freeze
|
57
|
+
PRIVACY = 'privacy'.freeze
|
57
58
|
|
58
59
|
COMPARISON_FIELDS = [ :name, :description, :long_description, :maintainer,
|
59
60
|
:maintainer_email, :license, :platforms, :dependencies,
|
60
61
|
:recommendations, :suggestions, :conflicting, :providing,
|
61
62
|
:replacing, :attributes, :groupings, :recipes, :version,
|
62
|
-
:source_url, :issues_url ]
|
63
|
+
:source_url, :issues_url, :privacy ]
|
63
64
|
|
64
65
|
VERSION_CONSTRAINTS = {:depends => DEPENDENCIES,
|
65
66
|
:recommends => RECOMMENDATIONS,
|
@@ -116,6 +117,7 @@ class Chef
|
|
116
117
|
@version = Version.new("0.0.0")
|
117
118
|
@source_url = ''
|
118
119
|
@issues_url = ''
|
120
|
+
@privacy = false
|
119
121
|
|
120
122
|
@errors = []
|
121
123
|
end
|
@@ -454,7 +456,8 @@ class Chef
|
|
454
456
|
:recipes => { :kind_of => [ Array ], :default => [] },
|
455
457
|
:default => { :kind_of => [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] },
|
456
458
|
:source_url => { :kind_of => String },
|
457
|
-
:issues_url => { :kind_of => String }
|
459
|
+
:issues_url => { :kind_of => String },
|
460
|
+
:privacy => { :kind_of => [ TrueClass, FalseClass ] }
|
458
461
|
}
|
459
462
|
)
|
460
463
|
options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil?
|
@@ -498,7 +501,8 @@ class Chef
|
|
498
501
|
RECIPES => self.recipes,
|
499
502
|
VERSION => self.version,
|
500
503
|
SOURCE_URL => self.source_url,
|
501
|
-
ISSUES_URL => self.issues_url
|
504
|
+
ISSUES_URL => self.issues_url,
|
505
|
+
PRIVACY => self.privacy
|
502
506
|
}
|
503
507
|
end
|
504
508
|
|
@@ -532,6 +536,7 @@ class Chef
|
|
532
536
|
@version = o[VERSION] if o.has_key?(VERSION)
|
533
537
|
@source_url = o[SOURCE_URL] if o.has_key?(SOURCE_URL)
|
534
538
|
@issues_url = o[ISSUES_URL] if o.has_key?(ISSUES_URL)
|
539
|
+
@privacy = o[PRIVACY] if o.has_key?(PRIVACY)
|
535
540
|
self
|
536
541
|
end
|
537
542
|
|
@@ -590,6 +595,23 @@ class Chef
|
|
590
595
|
)
|
591
596
|
end
|
592
597
|
|
598
|
+
#
|
599
|
+
# Sets the cookbook's privacy flag, or returns it.
|
600
|
+
#
|
601
|
+
# === Parameters
|
602
|
+
# privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not
|
603
|
+
#
|
604
|
+
# === Returns
|
605
|
+
# privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not
|
606
|
+
#
|
607
|
+
def privacy(arg=nil)
|
608
|
+
set_or_return(
|
609
|
+
:privacy,
|
610
|
+
arg,
|
611
|
+
:kind_of => [ TrueClass, FalseClass ]
|
612
|
+
)
|
613
|
+
end
|
614
|
+
|
593
615
|
private
|
594
616
|
|
595
617
|
def run_validation
|
@@ -131,7 +131,7 @@ class Chef
|
|
131
131
|
files_remaining_by_cookbook[file.cookbook] -= 1
|
132
132
|
|
133
133
|
if files_remaining_by_cookbook[file.cookbook] == 0
|
134
|
-
@events.synchronized_cookbook(file.cookbook.name)
|
134
|
+
@events.synchronized_cookbook(file.cookbook.name, file.cookbook)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -26,7 +26,7 @@ require 'openssl'
|
|
26
26
|
class Chef
|
27
27
|
# == Chef::CookbookSiteStreamingUploader
|
28
28
|
# A streaming multipart HTTP upload implementation. Used to upload cookbooks
|
29
|
-
# (in tarball form) to
|
29
|
+
# (in tarball form) to https://supermarket.chef.io
|
30
30
|
#
|
31
31
|
# inspired by http://stanislavvitvitskiy.blogspot.com/2008/12/multipart-post-in-ruby.html
|
32
32
|
class CookbookSiteStreamingUploader
|
@@ -51,12 +51,12 @@ class Chef
|
|
51
51
|
attr_accessor :metadata_filenames
|
52
52
|
|
53
53
|
def status=(new_status)
|
54
|
-
Chef
|
54
|
+
Chef.log_deprecation("Deprecated method `status' called. This method will be removed.")
|
55
55
|
@status = new_status
|
56
56
|
end
|
57
57
|
|
58
58
|
def status
|
59
|
-
Chef
|
59
|
+
Chef.log_deprecation("Deprecated method `status' called. This method will be removed.")
|
60
60
|
@status
|
61
61
|
end
|
62
62
|
|
@@ -480,7 +480,7 @@ class Chef
|
|
480
480
|
# @deprecated This method was used by the Ruby Chef Server and is no longer
|
481
481
|
# needed. There is no replacement.
|
482
482
|
def generate_manifest_with_urls(&url_generator)
|
483
|
-
Chef
|
483
|
+
Chef.log_deprecation("Deprecated method #generate_manifest_with_urls.")
|
484
484
|
|
485
485
|
rendered_manifest = manifest.dup
|
486
486
|
COOKBOOK_SEGMENTS.each do |segment|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser <jkeiser@chef.io>
|
3
|
+
# Copyright:: Copyright (c) 2015 Opscode, 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
|
+
class Chef
|
19
|
+
class DelayedEvaluator < Proc
|
20
|
+
end
|
21
|
+
end
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
# == Deprecation::Provider::Mixin::Template
|
26
26
|
# This module contains the deprecated functions of
|
27
27
|
# Chef::Mixin::Template. These functions are refactored to different
|
28
|
-
# components. They are frozen and will be removed in Chef
|
28
|
+
# components. They are frozen and will be removed in Chef 13.
|
29
29
|
#
|
30
30
|
|
31
31
|
module Template
|
@@ -46,4 +46,3 @@ class Chef
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
# == Deprecation::Provider::CookbookFile
|
25
25
|
# This module contains the deprecated functions of
|
26
26
|
# Chef::Provider::CookbookFile. These functions are refactored to
|
27
|
-
# different components. They are frozen and will be removed in Chef
|
27
|
+
# different components. They are frozen and will be removed in Chef 13.
|
28
28
|
#
|
29
29
|
module CookbookFile
|
30
30
|
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
# == Deprecation::Provider::File
|
26
26
|
# This module contains the deprecated functions of
|
27
27
|
# Chef::Provider::File. These functions are refactored to different
|
28
|
-
# components. They are frozen and will be removed in Chef
|
28
|
+
# components. They are frozen and will be removed in Chef 13.
|
29
29
|
#
|
30
30
|
module File
|
31
31
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Serdar Sutay (<serdar@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2015 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
|
+
class Chef
|
20
|
+
module Deprecation
|
21
|
+
module Provider
|
22
|
+
module RemoteDirectory
|
23
|
+
|
24
|
+
def directory_root_in_cookbook_cache
|
25
|
+
Chef.log_deprecation "the Chef::Provider::RemoteDirectory#directory_root_in_cookbook_cache method is deprecated"
|
26
|
+
|
27
|
+
@directory_root_in_cookbook_cache ||=
|
28
|
+
begin
|
29
|
+
cookbook = run_context.cookbook_collection[resource_cookbook]
|
30
|
+
cookbook.preferred_filename_on_disk_location(node, :files, source, path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# List all excluding . and ..
|
35
|
+
def ls(path)
|
36
|
+
files = Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), '**', '*'),
|
37
|
+
::File::FNM_DOTMATCH)
|
38
|
+
|
39
|
+
# Remove current directory and previous directory
|
40
|
+
files = files.reject do |name|
|
41
|
+
basename = Pathname.new(name).basename().to_s
|
42
|
+
['.', '..'].include?(basename)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Clean all the paths... this is required because of the join
|
46
|
+
files.map {|f| Chef::Util::PathHelper.cleanpath(f)}
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|