chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +48 -95
- data/Gemfile +6 -1
- data/README.md +9 -11
- data/VERSION +1 -1
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
- data/acceptance/Gemfile +4 -7
- data/acceptance/Gemfile.lock +59 -92
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
- data/chef.gemspec +3 -2
- data/lib/chef/application/client.rb +4 -4
- data/lib/chef/application/solo.rb +2 -2
- data/lib/chef/chef_fs/command_line.rb +36 -34
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +139 -137
- data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
- data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +3 -3
- data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +6 -6
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/formatters/base.rb +2 -2
- data/lib/chef/formatters/doc.rb +2 -2
- data/lib/chef/http.rb +48 -18
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/basic_client.rb +11 -2
- data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
- data/lib/chef/key.rb +55 -56
- data/lib/chef/knife.rb +70 -61
- data/lib/chef/knife/client_delete.rb +2 -2
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +19 -21
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/mixin/command/unix.rb +2 -2
- data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
- data/lib/chef/mixin/properties.rb +3 -0
- data/lib/chef/mixin/securable.rb +2 -2
- data/lib/chef/mixin/shell_out.rb +30 -0
- data/lib/chef/mixin/uris.rb +2 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
- data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
- data/lib/chef/monologger.rb +1 -1
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node/attribute.rb +3 -3
- data/lib/chef/platform/provider_mapping.rb +5 -2
- data/lib/chef/property.rb +14 -3
- data/lib/chef/provider/apt_repository.rb +3 -7
- data/lib/chef/provider/apt_update.rb +4 -6
- data/lib/chef/provider/cron.rb +1 -2
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/group/usermod.rb +1 -1
- data/lib/chef/provider/link.rb +10 -3
- data/lib/chef/provider/osx_profile.rb +10 -10
- data/lib/chef/provider/package.rb +2 -12
- data/lib/chef/provider/package/rubygems.rb +17 -16
- data/lib/chef/provider/package/windows.rb +2 -0
- data/lib/chef/provider/package/windows/exe.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
- data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/remote_file/ftp.rb +2 -2
- data/lib/chef/provider/remote_file/sftp.rb +2 -2
- data/lib/chef/provider/service/debian.rb +2 -2
- data/lib/chef/provider/service/simple.rb +4 -3
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +8 -5
- data/lib/chef/provider/support/yum_repo.erb +125 -0
- data/lib/chef/provider/systemd_unit.rb +11 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user.rb +20 -16
- data/lib/chef/provider/user/aix.rb +5 -2
- data/lib/chef/provider/user/dscl.rb +1 -0
- data/lib/chef/provider/user/linux.rb +128 -0
- data/lib/chef/provider/user/pw.rb +2 -1
- data/lib/chef/provider/user/solaris.rb +3 -2
- data/lib/chef/provider/user/useradd.rb +5 -4
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/provider/windows_script.rb +5 -2
- data/lib/chef/provider/yum_repository.rb +121 -0
- data/lib/chef/providers.rb +4 -2
- data/lib/chef/resource.rb +7 -9
- data/lib/chef/resource/conditional.rb +9 -1
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/user.rb +3 -3
- data/lib/chef/resource/user/aix_user.rb +31 -0
- data/lib/chef/resource/user/dscl_user.rb +31 -0
- data/lib/chef/resource/user/linux_user.rb +51 -0
- data/lib/chef/resource/user/pw_user.rb +31 -0
- data/lib/chef/resource/user/solaris_user.rb +31 -0
- data/lib/chef/resource/user/windows_user.rb +31 -0
- data/lib/chef/resource/yum_package.rb +13 -12
- data/lib/chef/resource/yum_repository.rb +76 -0
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
- data/lib/chef/resource_reporter.rb +5 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +5 -3
- data/lib/chef/run_context/cookbook_compiler.rb +3 -2
- data/lib/chef/run_list.rb +2 -2
- data/lib/chef/search/query.rb +11 -8
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +5 -2
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +2 -2
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/spec/functional/assets/testchefsubsys +2 -3
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
- data/spec/functional/http/simple_spec.rb +2 -2
- data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
- data/spec/functional/knife/exec_spec.rb +6 -6
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/notifications_spec.rb +2 -2
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +5 -5
- data/spec/functional/resource/bash_spec.rb +2 -2
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dpkg_package_spec.rb +2 -2
- data/spec/functional/resource/dsc_resource_spec.rb +5 -5
- data/spec/functional/resource/dsc_script_spec.rb +27 -22
- data/spec/functional/resource/env_spec.rb +4 -4
- data/spec/functional/resource/execute_spec.rb +4 -4
- data/spec/functional/resource/group_spec.rb +20 -8
- data/spec/functional/resource/link_spec.rb +34 -0
- data/spec/functional/resource/ohai_spec.rb +6 -6
- data/spec/functional/resource/reboot_spec.rb +2 -2
- data/spec/functional/resource/remote_file_spec.rb +16 -7
- data/spec/functional/resource/user/dscl_spec.rb +3 -3
- data/spec/functional/resource/user/useradd_spec.rb +32 -26
- data/spec/functional/resource/windows_service_spec.rb +15 -15
- data/spec/functional/rest_spec.rb +2 -2
- data/spec/functional/run_lock_spec.rb +9 -9
- data/spec/functional/tiny_server_spec.rb +9 -8
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +8 -8
- data/spec/integration/client/client_spec.rb +6 -4
- data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
- data/spec/integration/recipes/noop_resource_spec.rb +4 -4
- data/spec/integration/recipes/provider_choice.rb +3 -3
- data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
- data/spec/integration/recipes/resource_action_spec.rb +50 -54
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
- data/spec/integration/recipes/resource_load_spec.rb +24 -24
- data/spec/integration/solo/solo_spec.rb +21 -30
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/stress/win32/security_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +22 -0
- data/spec/support/platform_helpers.rb +5 -1
- data/spec/support/shared/context/client.rb +3 -2
- data/spec/support/shared/functional/file_resource.rb +5 -4
- data/spec/support/shared/functional/http.rb +16 -16
- data/spec/support/shared/functional/securable_resource.rb +5 -5
- data/spec/support/shared/functional/win32_service.rb +5 -7
- data/spec/support/shared/integration/app_server_support.rb +1 -3
- data/spec/support/shared/integration/knife_support.rb +0 -2
- data/spec/support/shared/shared_examples.rb +2 -2
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/support/shared/unit/application_dot_d.rb +9 -6
- data/spec/support/shared/unit/provider/file.rb +2 -2
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
- data/spec/support/shared/unit/script_resource.rb +4 -4
- data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
- data/spec/tiny_server.rb +51 -66
- data/spec/unit/api_client_v1_spec.rb +2 -2
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
- data/spec/unit/audit/audit_reporter_spec.rb +32 -23
- data/spec/unit/audit/control_group_data_spec.rb +19 -14
- data/spec/unit/chef_class_spec.rb +1 -1
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
- data/spec/unit/chef_fs/diff_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system_spec.rb +2 -2
- data/spec/unit/chef_fs/parallelizer.rb +5 -7
- data/spec/unit/cookbook/metadata_spec.rb +98 -98
- data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
- data/spec/unit/cookbook_loader_spec.rb +24 -24
- data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/data_bag_item_spec.rb +18 -18
- data/spec/unit/data_bag_spec.rb +2 -2
- data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
- data/spec/unit/data_collector/messages_spec.rb +2 -2
- data/spec/unit/data_collector_spec.rb +19 -19
- data/spec/unit/dsl/audit_spec.rb +3 -3
- data/spec/unit/dsl/data_query_spec.rb +3 -2
- data/spec/unit/dsl/declare_resource_spec.rb +10 -10
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
- data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
- data/spec/unit/environment_spec.rb +6 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
- data/spec/unit/file_access_control_spec.rb +3 -3
- data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
- data/spec/unit/http/basic_client_spec.rb +20 -0
- data/spec/unit/http/validate_content_length_spec.rb +8 -8
- data/spec/unit/http_spec.rb +14 -0
- data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
- data/spec/unit/knife/bootstrap_spec.rb +8 -6
- data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
- data/spec/unit/knife/client_edit_spec.rb +2 -2
- data/spec/unit/knife/configure_client_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
- data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
- data/spec/unit/knife/core/node_editor_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +2 -2
- data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
- data/spec/unit/knife/data_bag_show_spec.rb +3 -2
- data/spec/unit/knife/key_create_spec.rb +14 -14
- data/spec/unit/knife/key_delete_spec.rb +2 -2
- data/spec/unit/knife/key_edit_spec.rb +16 -16
- data/spec/unit/knife/key_list_spec.rb +6 -6
- data/spec/unit/knife/key_show_spec.rb +4 -4
- data/spec/unit/knife/status_spec.rb +3 -2
- data/spec/unit/knife/user_create_spec.rb +4 -4
- data/spec/unit/knife_spec.rb +7 -6
- data/spec/unit/lwrp_spec.rb +6 -6
- data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +17 -14
- data/spec/unit/mixin/deprecation_spec.rb +1 -1
- data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
- data/spec/unit/mixin/params_validate_spec.rb +53 -52
- data/spec/unit/mixin/powershell_out_spec.rb +2 -2
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
- data/spec/unit/mixin/shell_out_spec.rb +1 -1
- data/spec/unit/mixin/xml_escape_spec.rb +3 -3
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/platform/query_helpers_spec.rb +3 -3
- data/spec/unit/property_spec.rb +4 -4
- data/spec/unit/provider/cookbook_file_spec.rb +4 -4
- data/spec/unit/provider/cron/unix_spec.rb +4 -4
- data/spec/unit/provider/cron_spec.rb +2 -2
- data/spec/unit/provider/deploy_spec.rb +8 -8
- data/spec/unit/provider/dsc_resource_spec.rb +11 -10
- data/spec/unit/provider/dsc_script_spec.rb +9 -9
- data/spec/unit/provider/env/windows_spec.rb +8 -8
- data/spec/unit/provider/file/content_spec.rb +6 -6
- data/spec/unit/provider/file_spec.rb +4 -4
- data/spec/unit/provider/launchd_spec.rb +2 -1
- data/spec/unit/provider/link_spec.rb +155 -0
- data/spec/unit/provider/mount/mount_spec.rb +5 -5
- data/spec/unit/provider/mount/solaris_spec.rb +48 -48
- data/spec/unit/provider/osx_profile_spec.rb +6 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
- data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
- data/spec/unit/provider/package/rubygems_spec.rb +50 -44
- data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
- data/spec/unit/provider/package/yum_spec.rb +61 -60
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +4 -4
- data/spec/unit/provider/remote_directory_spec.rb +1 -1
- data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
- data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file_spec.rb +4 -4
- data/spec/unit/provider/script_spec.rb +4 -4
- data/spec/unit/provider/service/debian_service_spec.rb +4 -4
- data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
- data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
- data/spec/unit/provider/service/windows_spec.rb +10 -10
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/template/content_spec.rb +8 -8
- data/spec/unit/provider/template_spec.rb +8 -8
- data/spec/unit/provider/user/dscl_spec.rb +51 -51
- data/spec/unit/provider/user/linux_spec.rb +76 -0
- data/spec/unit/provider/user/pw_spec.rb +3 -6
- data/spec/unit/provider/user/solaris_spec.rb +5 -5
- data/spec/unit/provider/user/windows_spec.rb +3 -3
- data/spec/unit/provider/user_spec.rb +2 -2
- data/spec/unit/provider/yum_repository_spec.rb +35 -0
- data/spec/unit/provider_resolver_spec.rb +306 -264
- data/spec/unit/recipe_spec.rb +8 -7
- data/spec/unit/resource/apt_repository_spec.rb +4 -4
- data/spec/unit/resource/apt_update_spec.rb +4 -4
- data/spec/unit/resource/conditional_spec.rb +46 -0
- data/spec/unit/resource/dsc_resource_spec.rb +8 -8
- data/spec/unit/resource/dsc_script_spec.rb +4 -4
- data/spec/unit/resource/freebsd_package_spec.rb +6 -6
- data/spec/unit/resource/launchd_spec.rb +3 -2
- data/spec/unit/resource/osx_profile_spec.rb +3 -2
- data/spec/unit/resource/remote_file_spec.rb +6 -6
- data/spec/unit/resource/service_spec.rb +14 -14
- data/spec/unit/resource/user_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +49 -0
- data/spec/unit/resource_collection_spec.rb +4 -4
- data/spec/unit/resource_definition_spec.rb +11 -11
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/resource_resolver_spec.rb +6 -6
- data/spec/unit/resource_spec.rb +36 -16
- data/spec/unit/run_context/child_run_context_spec.rb +4 -4
- data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
- data/spec/unit/run_context_spec.rb +8 -8
- data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/search/query_spec.rb +15 -14
- data/spec/unit/user_v1_spec.rb +8 -8
- data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
- data/spec/unit/util/dsc/resource_store.rb +8 -6
- data/spec/unit/util/editor_spec.rb +6 -6
- data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
- data/tasks/bin/bundle-platform +1 -0
- data/tasks/bin/bundler_patch.rb +27 -0
- data/tasks/cbgb.rb +2 -2
- data/tasks/maintainers.rb +2 -2
- metadata +37 -8
- data/spec/unit/provider/user/useradd_spec.rb +0 -51
data/lib/chef/knife/status.rb
CHANGED
@@ -96,13 +96,13 @@ class Chef
|
|
96
96
|
all_nodes << node
|
97
97
|
end
|
98
98
|
|
99
|
-
output(all_nodes.sort
|
99
|
+
output(all_nodes.sort do |n1, n2|
|
100
100
|
if config[:sort_reverse] || Chef::Config[:knife][:sort_status_reverse]
|
101
101
|
(n2["ohai_time"] || 0) <=> (n1["ohai_time"] || 0)
|
102
102
|
else
|
103
103
|
(n1["ohai_time"] || 0) <=> (n2["ohai_time"] || 0)
|
104
104
|
end
|
105
|
-
|
105
|
+
end)
|
106
106
|
end
|
107
107
|
|
108
108
|
end
|
@@ -64,7 +64,7 @@ class Chef
|
|
64
64
|
$VERBOSE = nil
|
65
65
|
ps.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
66
66
|
|
67
|
-
cid = fork
|
67
|
+
cid = fork do
|
68
68
|
pw.last.close
|
69
69
|
STDIN.reopen pw.first
|
70
70
|
pw.first.close
|
@@ -111,7 +111,7 @@ class Chef
|
|
111
111
|
end
|
112
112
|
ps.last.close unless ps.last.closed?
|
113
113
|
exit!
|
114
|
-
|
114
|
+
end
|
115
115
|
ensure
|
116
116
|
$VERBOSE = verbose
|
117
117
|
end
|
@@ -79,6 +79,9 @@ class Chef
|
|
79
79
|
# part of desired state. Defaults to `true`.
|
80
80
|
# @option options [Boolean] :identity `true` if this property
|
81
81
|
# is part of object identity. Defaults to `false`.
|
82
|
+
# @option options [Boolean] :sensitive `true` if this property could
|
83
|
+
# contain sensitive information and whose value should be redacted
|
84
|
+
# in any resource reporting / auditing output. Defaults to `false`.
|
82
85
|
#
|
83
86
|
# @example Bare property
|
84
87
|
# property :x
|
data/lib/chef/mixin/securable.rb
CHANGED
@@ -43,7 +43,7 @@ class Chef
|
|
43
43
|
:mode,
|
44
44
|
arg,
|
45
45
|
:callbacks => {
|
46
|
-
"not in valid numeric range" => lambda
|
46
|
+
"not in valid numeric range" => lambda do |m|
|
47
47
|
if m.kind_of?(String)
|
48
48
|
m =~ /^0/ || m = "0#{m}"
|
49
49
|
end
|
@@ -54,7 +54,7 @@ class Chef
|
|
54
54
|
else
|
55
55
|
Integer(m) <= 07777 && Integer(m) >= 0
|
56
56
|
end
|
57
|
-
|
57
|
+
end,
|
58
58
|
}
|
59
59
|
)
|
60
60
|
end
|
data/lib/chef/mixin/shell_out.rb
CHANGED
@@ -78,6 +78,36 @@ class Chef
|
|
78
78
|
return my_command_args
|
79
79
|
end
|
80
80
|
|
81
|
+
# Helper for sublcasses to convert an array of string args into a string. It
|
82
|
+
# will compact nil or empty strings in the array and will join the array elements
|
83
|
+
# with spaces, without introducing any double spaces for nil/empty elements.
|
84
|
+
#
|
85
|
+
# @param args [String] variable number of string arguments
|
86
|
+
# @return [String] nicely concatenated string or empty string
|
87
|
+
def a_to_s(*args)
|
88
|
+
clean_array(*args).join(" ")
|
89
|
+
end
|
90
|
+
|
91
|
+
# Helper for sublcasses to reject nil and empty strings out of an array. It allows
|
92
|
+
# using the array form of shell_out (which avoids the need to surround arguments with
|
93
|
+
# quote marks to deal with shells).
|
94
|
+
#
|
95
|
+
# Usage:
|
96
|
+
# shell_out!(*clean_array("useradd", universal_options, useradd_options, new_resource.username))
|
97
|
+
#
|
98
|
+
# universal_options and useradd_options can be nil, empty array, empty string, strings or arrays
|
99
|
+
# and the result makes sense.
|
100
|
+
#
|
101
|
+
# keeping this separate from shell_out!() makes it a bit easier to write expectations against the
|
102
|
+
# shell_out args and be able to omit nils and such in the tests (and to test that the nils are
|
103
|
+
# being rejected correctly).
|
104
|
+
#
|
105
|
+
# @param args [String] variable number of string arguments
|
106
|
+
# @return [Array] array of strings with nil and null string rejection
|
107
|
+
def clean_array(*args)
|
108
|
+
args.flatten.reject { |i| i.nil? || i == "" }.map(&:to_s)
|
109
|
+
end
|
110
|
+
|
81
111
|
private
|
82
112
|
|
83
113
|
def shell_out_command(*command_args)
|
data/lib/chef/mixin/uris.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "uri"
|
20
|
+
require "addressable/uri"
|
20
21
|
|
21
22
|
class Chef
|
22
23
|
module Mixin
|
@@ -34,7 +35,7 @@ class Chef
|
|
34
35
|
URI.parse(source)
|
35
36
|
rescue URI::InvalidURIError
|
36
37
|
Chef::Log.warn("#{source} was an invalid URI. Trying to escape invalid characters")
|
37
|
-
URI.parse(URI.
|
38
|
+
URI.parse(Addressable::URI.encode(source))
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -74,16 +74,15 @@ class Chef
|
|
74
74
|
|
75
75
|
def node_supports_windows_architecture?(node, desired_architecture)
|
76
76
|
assert_valid_windows_architecture!(desired_architecture)
|
77
|
-
return (node_windows_architecture(node) == :x86_64 ||
|
78
|
-
desired_architecture == :i386) ? true : false
|
77
|
+
return ( node_windows_architecture(node) == :x86_64 ) || ( desired_architecture == :i386 )
|
79
78
|
end
|
80
79
|
|
81
80
|
def valid_windows_architecture?(architecture)
|
82
|
-
return (architecture == :x86_64) || (architecture == :i386)
|
81
|
+
return ( architecture == :x86_64 ) || ( architecture == :i386 )
|
83
82
|
end
|
84
83
|
|
85
84
|
def assert_valid_windows_architecture!(architecture)
|
86
|
-
if !
|
85
|
+
if !valid_windows_architecture?(architecture)
|
87
86
|
raise Chef::Exceptions::Win32ArchitectureIncorrect,
|
88
87
|
"The specified architecture was not valid. It must be one of :i386 or :x86_64"
|
89
88
|
end
|
@@ -31,7 +31,7 @@ module WEBrick
|
|
31
31
|
Socket::AI_PASSIVE) # flag
|
32
32
|
last_error = nil
|
33
33
|
sockets = []
|
34
|
-
res.each
|
34
|
+
res.each do |ai|
|
35
35
|
begin
|
36
36
|
logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
|
37
37
|
sock = TCPServer.new(ai[3], port)
|
@@ -42,7 +42,7 @@ module WEBrick
|
|
42
42
|
logger.warn("TCPServer Error: #{ex}") if logger
|
43
43
|
last_error = ex
|
44
44
|
end
|
45
|
-
|
45
|
+
end
|
46
46
|
raise last_error if sockets.empty?
|
47
47
|
return sockets
|
48
48
|
end
|
data/lib/chef/monologger.rb
CHANGED
data/lib/chef/node.rb
CHANGED
data/lib/chef/node/attribute.rb
CHANGED
@@ -537,12 +537,12 @@ class Chef
|
|
537
537
|
end
|
538
538
|
|
539
539
|
def inspect
|
540
|
-
"#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map
|
540
|
+
"#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map do |iv|
|
541
541
|
"#{iv}=#{instance_variable_get(iv).inspect}"
|
542
|
-
|
542
|
+
end.join(", ") << ">"
|
543
543
|
end
|
544
544
|
|
545
|
-
|
545
|
+
private
|
546
546
|
|
547
547
|
# Helper method for merge_all/merge_defaults/merge_overrides.
|
548
548
|
#
|
@@ -197,8 +197,11 @@ class Chef
|
|
197
197
|
|
198
198
|
def resource_matching_provider(platform, version, resource_type)
|
199
199
|
if resource_type.kind_of?(Chef::Resource)
|
200
|
-
class_name =
|
201
|
-
|
200
|
+
class_name = if resource_type.class.name
|
201
|
+
resource_type.class.name.split("::").last
|
202
|
+
else
|
203
|
+
convert_to_class_name(resource_type.resource_name.to_s)
|
204
|
+
end
|
202
205
|
|
203
206
|
if Chef::Provider.const_defined?(class_name, false)
|
204
207
|
Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{convert_to_snake_case(class_name).to_sym.inspect}'.")
|
data/lib/chef/property.rb
CHANGED
@@ -229,15 +229,26 @@ class Chef
|
|
229
229
|
options[:required]
|
230
230
|
end
|
231
231
|
|
232
|
+
#
|
233
|
+
# Whether this property is sensitive or not.
|
234
|
+
#
|
235
|
+
# Defaults to false.
|
236
|
+
#
|
237
|
+
# @return [Boolean]
|
238
|
+
#
|
239
|
+
def sensitive?
|
240
|
+
options.fetch(:sensitive, false)
|
241
|
+
end
|
242
|
+
|
232
243
|
#
|
233
244
|
# Validation options. (See Chef::Mixin::ParamsValidate#validate.)
|
234
245
|
#
|
235
246
|
# @return [Hash<Symbol,Object>]
|
236
247
|
#
|
237
248
|
def validation_options
|
238
|
-
@validation_options ||= options.reject
|
239
|
-
[:declared_in, :name, :instance_variable_name, :desired_state, :identity, :default, :name_property, :coerce, :required, :nillable].include?(k)
|
240
|
-
|
249
|
+
@validation_options ||= options.reject do |k, v|
|
250
|
+
[:declared_in, :name, :instance_variable_name, :desired_state, :identity, :default, :name_property, :coerce, :required, :nillable, :sensitive].include?(k)
|
251
|
+
end
|
241
252
|
end
|
242
253
|
|
243
254
|
#
|
@@ -19,6 +19,7 @@
|
|
19
19
|
require "chef/resource"
|
20
20
|
require "chef/dsl/declare_resource"
|
21
21
|
require "chef/mixin/shell_out"
|
22
|
+
require "chef/mixin/which"
|
22
23
|
require "chef/http/simple"
|
23
24
|
require "chef/provider/noop"
|
24
25
|
|
@@ -28,9 +29,10 @@ class Chef
|
|
28
29
|
use_inline_resources
|
29
30
|
|
30
31
|
include Chef::Mixin::ShellOut
|
32
|
+
extend Chef::Mixin::Which
|
31
33
|
|
32
34
|
provides :apt_repository do
|
33
|
-
|
35
|
+
which("apt-get")
|
34
36
|
end
|
35
37
|
|
36
38
|
def whyrun_supported?
|
@@ -104,12 +106,6 @@ class Chef
|
|
104
106
|
end
|
105
107
|
end
|
106
108
|
|
107
|
-
def self.uses_apt?
|
108
|
-
ENV["PATH"] ||= ""
|
109
|
-
paths = %w{ /bin /usr/bin /sbin /usr/sbin } + ENV["PATH"].split(::File::PATH_SEPARATOR)
|
110
|
-
paths.any? { |path| ::File.executable?(::File.join(path, "apt-get")) }
|
111
|
-
end
|
112
|
-
|
113
109
|
def is_key_id?(id)
|
114
110
|
id = id[2..-1] if id.start_with?("0x")
|
115
111
|
id =~ /^\h+$/ && [8, 16, 40].include?(id.length)
|
@@ -18,14 +18,17 @@
|
|
18
18
|
|
19
19
|
require "chef/provider"
|
20
20
|
require "chef/provider/noop"
|
21
|
+
require "chef/mixin/which"
|
21
22
|
|
22
23
|
class Chef
|
23
24
|
class Provider
|
24
25
|
class AptUpdate < Chef::Provider
|
25
26
|
use_inline_resources
|
26
27
|
|
28
|
+
extend Chef::Mixin::Which
|
29
|
+
|
27
30
|
provides :apt_update do
|
28
|
-
|
31
|
+
which("apt-get")
|
29
32
|
end
|
30
33
|
|
31
34
|
APT_CONF_DIR = "/etc/apt/apt.conf.d"
|
@@ -77,11 +80,6 @@ class Chef
|
|
77
80
|
declare_resource(:execute, "apt-get -q update")
|
78
81
|
end
|
79
82
|
|
80
|
-
def self.uses_apt?
|
81
|
-
ENV["PATH"] ||= ""
|
82
|
-
paths = %w{ /bin /usr/bin /sbin /usr/sbin } + ENV["PATH"].split(::File::PATH_SEPARATOR)
|
83
|
-
paths.any? { |path| ::File.executable?(::File.join(path, "apt-get")) }
|
84
|
-
end
|
85
83
|
end
|
86
84
|
end
|
87
85
|
end
|
data/lib/chef/provider/cron.rb
CHANGED
@@ -187,8 +187,7 @@ class Chef
|
|
187
187
|
end
|
188
188
|
crontab << line
|
189
189
|
end
|
190
|
-
description = cron_found ? "remove #{@new_resource.name} from crontab" :
|
191
|
-
"save unmodified crontab"
|
190
|
+
description = cron_found ? "remove #{@new_resource.name} from crontab" : "save unmodified crontab"
|
192
191
|
converge_by(description) do
|
193
192
|
write_crontab crontab
|
194
193
|
Chef::Log.info("#{@new_resource} deleted crontab entry")
|
@@ -32,12 +32,12 @@ class Chef
|
|
32
32
|
@dsc_resource = dsc_resource
|
33
33
|
@resource_converged = false
|
34
34
|
@operations = {
|
35
|
-
:set => Proc.new
|
35
|
+
:set => Proc.new do |config_manager, document, shellout_flags|
|
36
36
|
config_manager.set_configuration(document, shellout_flags)
|
37
|
-
|
38
|
-
:test => Proc.new
|
37
|
+
end,
|
38
|
+
:test => Proc.new do |config_manager, document, shellout_flags|
|
39
39
|
config_manager.test_configuration(document, shellout_flags)
|
40
|
-
|
40
|
+
end }
|
41
41
|
end
|
42
42
|
|
43
43
|
def action_run
|
@@ -57,7 +57,7 @@ class Chef
|
|
57
57
|
# This provider only supports adding members with
|
58
58
|
# append. Only if the action is create we will go
|
59
59
|
# ahead and add members.
|
60
|
-
if @new_resource.action
|
60
|
+
if @new_resource.action.include?(:create)
|
61
61
|
members.each do |member|
|
62
62
|
add_member(member)
|
63
63
|
end
|
data/lib/chef/provider/link.rb
CHANGED
@@ -141,9 +141,16 @@ class Chef
|
|
141
141
|
|
142
142
|
def action_delete
|
143
143
|
if @current_resource.to # Exists
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
if Chef::Platform.windows? && ::File.directory?(@current_resource.target_file)
|
145
|
+
converge_by("delete link to dir at #{@new_resource.target_file}") do
|
146
|
+
::Dir.delete(@new_resource.target_file)
|
147
|
+
Chef::Log.info("#{@new_resource} deleted")
|
148
|
+
end
|
149
|
+
else
|
150
|
+
converge_by("delete link to file at #{@new_resource.target_file}") do
|
151
|
+
::File.delete(@new_resource.target_file)
|
152
|
+
Chef::Log.info("#{@new_resource} deleted")
|
153
|
+
end
|
147
154
|
end
|
148
155
|
end
|
149
156
|
end
|
@@ -66,33 +66,33 @@ class Chef
|
|
66
66
|
def define_resource_requirements
|
67
67
|
requirements.assert(:remove) do |a|
|
68
68
|
if @new_profile_identifier
|
69
|
-
a.assertion
|
69
|
+
a.assertion do
|
70
70
|
!@new_profile_identifier.nil? &&
|
71
71
|
!@new_profile_identifier.end_with?(".mobileconfig") &&
|
72
|
-
/^\w+(
|
73
|
-
|
72
|
+
/^\w+(?:(\.| )\w+)+$/.match(@new_profile_identifier)
|
73
|
+
end
|
74
74
|
a.failure_message RuntimeError, "when removing using the identifier attribute, it must match the profile identifier"
|
75
75
|
else
|
76
76
|
new_profile_name = @new_resource.profile_name
|
77
|
-
a.assertion
|
77
|
+
a.assertion do
|
78
78
|
!new_profile_name.end_with?(".mobileconfig") &&
|
79
|
-
/^\w+(
|
80
|
-
|
79
|
+
/^\w+(?:(\.| )\w+)+$/.match(new_profile_name)
|
80
|
+
end
|
81
81
|
a.failure_message RuntimeError, "When removing by resource name, it must match the profile identifier "
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
requirements.assert(:install) do |a|
|
86
86
|
if @new_profile_hash.is_a?(Hash)
|
87
|
-
a.assertion
|
87
|
+
a.assertion do
|
88
88
|
@new_profile_hash.include?("PayloadIdentifier")
|
89
|
-
|
89
|
+
end
|
90
90
|
a.failure_message RuntimeError, "The specified profile does not seem to be valid"
|
91
91
|
end
|
92
92
|
if @new_profile_hash.is_a?(String)
|
93
|
-
a.assertion
|
93
|
+
a.assertion do
|
94
94
|
@new_profile_hash.end_with?(".mobileconfig")
|
95
|
-
|
95
|
+
end
|
96
96
|
a.failure_message RuntimeError, "#{new_profile_hash}' is not a valid profile"
|
97
97
|
end
|
98
98
|
end
|
@@ -194,12 +194,12 @@ class Chef
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def action_reconfig
|
197
|
-
if @current_resource.version == nil
|
197
|
+
if @current_resource.version == nil
|
198
198
|
Chef::Log.debug("#{@new_resource} is NOT installed - nothing to do")
|
199
199
|
return
|
200
200
|
end
|
201
201
|
|
202
|
-
unless @new_resource.response_file
|
202
|
+
unless @new_resource.response_file
|
203
203
|
Chef::Log.debug("#{@new_resource} no response_file provided - nothing to do")
|
204
204
|
return
|
205
205
|
end
|
@@ -588,16 +588,6 @@ class Chef
|
|
588
588
|
end
|
589
589
|
args
|
590
590
|
end
|
591
|
-
|
592
|
-
# Helper for sublcasses to convert an array of string args into a string. It
|
593
|
-
# will compact nil or empty strings in the array and will join the array elements
|
594
|
-
# with spaces, without introducing any double spaces for nil/empty elements.
|
595
|
-
#
|
596
|
-
# @param args [String] variable number of string arguments
|
597
|
-
# @return [String] nicely concatenated string or empty string
|
598
|
-
def a_to_s(*args)
|
599
|
-
args.flatten.reject { |i| i.nil? || i == "" }.join(" ")
|
600
|
-
end
|
601
591
|
end
|
602
592
|
end
|
603
593
|
end
|