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
@@ -76,7 +76,7 @@ describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metada
|
|
76
76
|
let(:iterations) { nil }
|
77
77
|
|
78
78
|
let(:user_resource) do
|
79
|
-
r = Chef::Resource::User.new("TEST USER RESOURCE", run_context)
|
79
|
+
r = Chef::Resource::User::DsclUser.new("TEST USER RESOURCE", run_context)
|
80
80
|
r.username(username)
|
81
81
|
r.uid(uid)
|
82
82
|
r.gid(gid)
|
@@ -123,7 +123,7 @@ describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metada
|
|
123
123
|
end
|
124
124
|
|
125
125
|
describe "when password is being set via shadow hash" do
|
126
|
-
let(:password)
|
126
|
+
let(:password) do
|
127
127
|
if node[:platform_version].start_with?("10.7.")
|
128
128
|
# On Mac 10.7 we only need to set the password
|
129
129
|
"c9b3bd1a0cde797eef0eff16c580dab996ba3a21961cccc\
|
@@ -139,7 +139,7 @@ b1d4880833aa7a190afc13e2bf0936b8\
|
|
139
139
|
c5adbbac718b7eb99463a7b679571e0f\
|
140
140
|
1c9fef2ef08d0b9e9c2bcf644eed2ffc"
|
141
141
|
end
|
142
|
-
|
142
|
+
end
|
143
143
|
|
144
144
|
let(:iterations) { 25000 }
|
145
145
|
let(:salt) { "9e2e7d5ee473b496fd24cf0bbfcaedfcb291ee21740e570d1e917e874f8788ca" }
|
@@ -21,19 +21,26 @@ require "spec_helper"
|
|
21
21
|
require "functional/resource/base"
|
22
22
|
require "chef/mixin/shell_out"
|
23
23
|
|
24
|
-
def
|
25
|
-
|
24
|
+
def resource_for_platform(username, run_context)
|
25
|
+
Chef::Resource.resource_for_node(:user, node).new(username, run_context)
|
26
|
+
end
|
27
|
+
|
28
|
+
# ideally we could somehow pass an array of [ ...::Aix, ...::Linux ] to the
|
29
|
+
# filter, but we have to pick the right one for the O/S.
|
30
|
+
def user_provider_filter
|
31
|
+
case ohai[:os]
|
26
32
|
when "aix"
|
27
33
|
Chef::Provider::User::Aix
|
28
|
-
|
29
|
-
Chef::Provider::User::
|
34
|
+
when "linux"
|
35
|
+
Chef::Provider::User::Linux
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
|
-
metadata = {
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
metadata = {
|
40
|
+
:unix_only => true,
|
41
|
+
:requires_root => true,
|
42
|
+
:not_supported_on_mac_osx => true,
|
43
|
+
:provider => { :user => user_provider_filter },
|
37
44
|
}
|
38
45
|
|
39
46
|
describe Chef::Provider::User::Useradd, metadata do
|
@@ -81,12 +88,13 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
81
88
|
end
|
82
89
|
|
83
90
|
def try_cleanup
|
84
|
-
["/home/cheftestfoo", "/home/cheftestbar"].each do |f|
|
91
|
+
["/home/cheftestfoo", "/home/cheftestbar", "/home/cf-test"].each do |f|
|
85
92
|
FileUtils.rm_rf(f) if File.exists? f
|
86
93
|
end
|
87
94
|
|
88
95
|
["cf-test"].each do |u|
|
89
|
-
r =
|
96
|
+
r = resource_for_platform("DELETE USER", run_context)
|
97
|
+
r.manage_home true
|
90
98
|
r.username("cf-test")
|
91
99
|
r.run_action(:remove)
|
92
100
|
end
|
@@ -134,10 +142,7 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
134
142
|
Chef::RunContext.new(node, {}, events)
|
135
143
|
end
|
136
144
|
|
137
|
-
let(:username)
|
138
|
-
"cf-test"
|
139
|
-
end
|
140
|
-
|
145
|
+
let(:username) { "cf-test" }
|
141
146
|
let(:uid) { nil }
|
142
147
|
let(:home) { nil }
|
143
148
|
let(:manage_home) { false }
|
@@ -146,7 +151,7 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
146
151
|
let(:comment) { nil }
|
147
152
|
|
148
153
|
let(:user_resource) do
|
149
|
-
r =
|
154
|
+
r = resource_for_platform("TEST USER RESOURCE", run_context)
|
150
155
|
r.username(username)
|
151
156
|
r.uid(uid)
|
152
157
|
r.home(home)
|
@@ -242,15 +247,8 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
242
247
|
expect(pw_entry.home).to eq(home)
|
243
248
|
end
|
244
249
|
|
245
|
-
|
246
|
-
|
247
|
-
it "creates the home dir when not explicitly asked to on RHEL (XXX)" do
|
248
|
-
expect(File).to exist(home)
|
249
|
-
end
|
250
|
-
else
|
251
|
-
it "does not create the home dir without `manage_home'" do
|
252
|
-
expect(File).not_to exist(home)
|
253
|
-
end
|
250
|
+
it "does not create the home dir without `manage_home'" do
|
251
|
+
expect(File).not_to exist(home)
|
254
252
|
end
|
255
253
|
|
256
254
|
context "and manage_home is enabled" do
|
@@ -260,6 +258,14 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
260
258
|
expect(File).to exist(home)
|
261
259
|
end
|
262
260
|
end
|
261
|
+
|
262
|
+
context "and manage_home is the default" do
|
263
|
+
let(:manage_home) { nil }
|
264
|
+
|
265
|
+
it "does not create the home dir without `manage_home'" do
|
266
|
+
expect(File).not_to exist(home)
|
267
|
+
end
|
268
|
+
end
|
263
269
|
end
|
264
270
|
|
265
271
|
context "when a password is specified" do
|
@@ -310,8 +316,8 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
310
316
|
let(:existing_comment) { nil }
|
311
317
|
|
312
318
|
let(:existing_user) do
|
313
|
-
r =
|
314
|
-
|
319
|
+
r = resource_for_platform("TEST USER RESOURCE", run_context)
|
320
|
+
# username is identity attr, must match.
|
315
321
|
r.username(username)
|
316
322
|
r.uid(existing_uid)
|
317
323
|
r.home(existing_home)
|
@@ -27,19 +27,19 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
27
27
|
let(:qualified_username) { "#{ENV['COMPUTERNAME']}\\#{username}" }
|
28
28
|
let(:password) { "1a2b3c4X!&narf" }
|
29
29
|
|
30
|
-
let(:user_resource)
|
31
|
-
r = Chef::Resource::User.new(username, run_context)
|
30
|
+
let(:user_resource) do
|
31
|
+
r = Chef::Resource::User::WindowsUser.new(username, run_context)
|
32
32
|
r.username(username)
|
33
33
|
r.password(password)
|
34
34
|
r.comment("temp spec user")
|
35
35
|
r
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
|
-
let(:global_service_file_path)
|
38
|
+
let(:global_service_file_path) do
|
39
39
|
"#{ENV['WINDIR']}\\temp\\#{File.basename(test_service[:service_file_path])}"
|
40
|
-
|
40
|
+
end
|
41
41
|
|
42
|
-
let(:service_params)
|
42
|
+
let(:service_params) do
|
43
43
|
|
44
44
|
id = "#{$$}_#{rand(1000)}"
|
45
45
|
|
@@ -51,19 +51,19 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
51
51
|
service_description: "Test service for running the windows_service functional spec.",
|
52
52
|
service_file_path: global_service_file_path,
|
53
53
|
} )
|
54
|
-
|
54
|
+
end
|
55
55
|
|
56
|
-
let(:manager)
|
56
|
+
let(:manager) do
|
57
57
|
Chef::Application::WindowsServiceManager.new(service_params)
|
58
|
-
|
58
|
+
end
|
59
59
|
|
60
|
-
let(:service_resource)
|
60
|
+
let(:service_resource) do
|
61
61
|
r = Chef::Resource::WindowsService.new(service_params[:service_name], run_context)
|
62
62
|
[:run_as_user, :run_as_password].each { |prop| r.send(prop, service_params[prop]) }
|
63
63
|
r
|
64
|
-
|
64
|
+
end
|
65
65
|
|
66
|
-
before
|
66
|
+
before do
|
67
67
|
user_resource.run_action(:create)
|
68
68
|
|
69
69
|
# the service executable has to be outside the current user's home
|
@@ -81,13 +81,13 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
81
81
|
file.run_action(:create)
|
82
82
|
|
83
83
|
manager.run(%w{--action install})
|
84
|
-
|
84
|
+
end
|
85
85
|
|
86
|
-
after
|
86
|
+
after do
|
87
87
|
user_resource.run_action(:remove)
|
88
88
|
manager.run(%w{--action uninstall})
|
89
89
|
File.delete(global_service_file_path)
|
90
|
-
|
90
|
+
end
|
91
91
|
|
92
92
|
describe "logon as a service" do
|
93
93
|
it "successfully runs a service as another user" do
|
@@ -46,11 +46,9 @@ describe Chef::RunLock do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
WAIT_ON_LOCK_TIME = 1.0
|
49
|
-
def wait_on_lock
|
49
|
+
def wait_on_lock(from_fork)
|
50
50
|
Timeout.timeout(WAIT_ON_LOCK_TIME) do
|
51
|
-
|
52
|
-
sleep 0.1
|
53
|
-
end
|
51
|
+
from_fork.readline
|
54
52
|
end
|
55
53
|
rescue Timeout::Error
|
56
54
|
raise "Lockfile never created, abandoning test"
|
@@ -259,14 +257,16 @@ describe Chef::RunLock do
|
|
259
257
|
it "test returns true and acquires the lock" do
|
260
258
|
run_lock = Chef::RunLock.new(lockfile)
|
261
259
|
from_tests, to_fork = IO.pipe
|
260
|
+
from_fork, to_tests = IO.pipe
|
262
261
|
p1 = fork do
|
263
262
|
expect(run_lock.test).to eq(true)
|
263
|
+
to_tests.puts "lock acquired"
|
264
264
|
# Wait for the test to tell us we can exit before exiting
|
265
265
|
from_tests.readline
|
266
266
|
exit! 0
|
267
267
|
end
|
268
268
|
|
269
|
-
wait_on_lock
|
269
|
+
wait_on_lock(from_fork)
|
270
270
|
|
271
271
|
p2 = fork do
|
272
272
|
expect(run_lock.test).to eq(false)
|
@@ -283,14 +283,16 @@ describe Chef::RunLock do
|
|
283
283
|
it "test returns without waiting when the lock is acquired" do
|
284
284
|
run_lock = Chef::RunLock.new(lockfile)
|
285
285
|
from_tests, to_fork = IO.pipe
|
286
|
+
from_fork, to_tests = IO.pipe
|
286
287
|
p1 = fork do
|
287
288
|
run_lock.acquire
|
289
|
+
to_tests.puts "lock acquired"
|
288
290
|
# Wait for the test to tell us we can exit before exiting
|
289
291
|
from_tests.readline
|
290
292
|
exit! 0
|
291
293
|
end
|
292
294
|
|
293
|
-
wait_on_lock
|
295
|
+
wait_on_lock(from_fork)
|
294
296
|
expect(run_lock.test).to eq(false)
|
295
297
|
|
296
298
|
to_fork.puts "you can exit now"
|
@@ -393,9 +395,7 @@ describe Chef::RunLock do
|
|
393
395
|
# Send it the kill signal over and over until it dies
|
394
396
|
Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do
|
395
397
|
Process.kill(:KILL, pid)
|
396
|
-
until Process.waitpid2(pid, Process::WNOHANG)
|
397
|
-
sleep(0.05)
|
398
|
-
end
|
398
|
+
sleep(0.05) until Process.waitpid2(pid, Process::WNOHANG)
|
399
399
|
end
|
400
400
|
example.log_event("#{name}.stop finished (stopped pid #{pid})")
|
401
401
|
# Process not found is perfectly fine when we're trying to kill a process :)
|
@@ -65,14 +65,15 @@ end
|
|
65
65
|
|
66
66
|
describe TinyServer::Manager do
|
67
67
|
it "runs the server" do
|
68
|
-
|
69
|
-
|
68
|
+
server = TinyServer::Manager.new
|
69
|
+
server.start
|
70
|
+
begin
|
71
|
+
TinyServer::API.instance.get("/index", 200, "[\"hello\"]")
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
@server.stop
|
73
|
+
rest = Chef::HTTP.new("http://localhost:9000")
|
74
|
+
expect(rest.get("index")).to eq("[\"hello\"]")
|
75
|
+
ensure
|
76
|
+
server.stop
|
77
|
+
end
|
77
78
|
end
|
78
79
|
end
|
@@ -22,7 +22,7 @@ if Chef::Platform.windows?
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "Chef::ReservedNames::Win32::Crypto", :windows_only do
|
25
|
-
describe
|
25
|
+
describe "#encrypt" do
|
26
26
|
before(:all) do
|
27
27
|
new_node = Chef::Node.new
|
28
28
|
new_node.consume_external_attrs(OHAI_SYSTEM.data, {})
|
@@ -45,27 +45,27 @@ describe "Chef::Win32::Security", :windows_only do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe "access_check" do
|
48
|
-
let(:security_descriptor)
|
48
|
+
let(:security_descriptor) do
|
49
49
|
Chef::ReservedNames::Win32::Security.get_file_security(
|
50
50
|
"C:\\Program Files")
|
51
|
-
|
51
|
+
end
|
52
52
|
|
53
53
|
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
|
54
54
|
|
55
|
-
let(:token)
|
55
|
+
let(:token) do
|
56
56
|
Chef::ReservedNames::Win32::Security.open_process_token(
|
57
57
|
Chef::ReservedNames::Win32::Process.get_current_process,
|
58
58
|
token_rights).duplicate_token(:SecurityImpersonation)
|
59
|
-
|
59
|
+
end
|
60
60
|
|
61
|
-
let(:mapping)
|
61
|
+
let(:mapping) do
|
62
62
|
mapping = Chef::ReservedNames::Win32::Security::GENERIC_MAPPING.new
|
63
63
|
mapping[:GenericRead] = Chef::ReservedNames::Win32::Security::FILE_GENERIC_READ
|
64
64
|
mapping[:GenericWrite] = Chef::ReservedNames::Win32::Security::FILE_GENERIC_WRITE
|
65
65
|
mapping[:GenericExecute] = Chef::ReservedNames::Win32::Security::FILE_GENERIC_EXECUTE
|
66
66
|
mapping[:GenericAll] = Chef::ReservedNames::Win32::Security::FILE_ALL_ACCESS
|
67
67
|
mapping
|
68
|
-
|
68
|
+
end
|
69
69
|
|
70
70
|
let(:desired_access) { Chef::ReservedNames::Win32::Security::FILE_GENERIC_READ }
|
71
71
|
|
@@ -76,11 +76,11 @@ describe "Chef::Win32::Security", :windows_only do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
describe "Chef::Win32::Security::Token" do
|
79
|
-
let(:token)
|
79
|
+
let(:token) do
|
80
80
|
Chef::ReservedNames::Win32::Security.open_process_token(
|
81
81
|
Chef::ReservedNames::Win32::Process.get_current_process,
|
82
82
|
token_rights)
|
83
|
-
|
83
|
+
end
|
84
84
|
context "with all rights" do
|
85
85
|
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
|
86
86
|
|
@@ -19,11 +19,11 @@ describe "chef-client" do
|
|
19
19
|
#
|
20
20
|
# just a normal file
|
21
21
|
# (expected_content should be uncompressed)
|
22
|
-
@api.get("/recipes.tgz", 200)
|
22
|
+
@api.get("/recipes.tgz", 200) do
|
23
23
|
File.open(recipes_filename, "rb") do |f|
|
24
24
|
f.read
|
25
25
|
end
|
26
|
-
|
26
|
+
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def stop_tiny_server
|
@@ -376,6 +376,8 @@ EOM
|
|
376
376
|
end
|
377
377
|
|
378
378
|
it "the cheffish DSL tries to load but fails (because chef-provisioning is not there)" do
|
379
|
+
# we'd need to have a custom bundle to fix this that omitted chef-provisioning, but that would dig our crazy even deeper, so lets not
|
380
|
+
skip "but if chef-provisioning is in our bundle or in our gemset then this test, very annoyingly, always fails"
|
379
381
|
command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
|
380
382
|
expect(command.exitstatus).to eql(1)
|
381
383
|
expect(command.stdout).to match(/cannot load such file -- chef\/provisioning/)
|
@@ -474,11 +476,11 @@ end
|
|
474
476
|
|
475
477
|
# Fails on appveyor, but works locally on windows and on windows hosts in Ci.
|
476
478
|
context "when using recipe-url", :skip_appveyor do
|
477
|
-
before(:
|
479
|
+
before(:each) do
|
478
480
|
start_tiny_server
|
479
481
|
end
|
480
482
|
|
481
|
-
after(:
|
483
|
+
after(:each) do
|
482
484
|
stop_tiny_server
|
483
485
|
end
|
484
486
|
|
@@ -48,7 +48,7 @@ describe "chef_repo_path tests", :workstation do
|
|
48
48
|
|
49
49
|
directory "chef_repo2" do
|
50
50
|
file "clients/client3.json", {}
|
51
|
-
file "cookbooks/cookbook3/metadata.rb", ""
|
51
|
+
file "cookbooks/cookbook3/metadata.rb", "name 'cookbook3'"
|
52
52
|
file "data_bags/bag3/item3.json", {}
|
53
53
|
file "environments/env3.json", {}
|
54
54
|
file "nodes/node3.json", {}
|
@@ -79,6 +79,75 @@ describe "chef_repo_path tests", :workstation do
|
|
79
79
|
EOM
|
80
80
|
end
|
81
81
|
|
82
|
+
it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do
|
83
|
+
Chef::Config.delete(:chef_repo_path)
|
84
|
+
knife("list --local -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<EOM
|
85
|
+
/clients/
|
86
|
+
/clients/client3.json
|
87
|
+
/cookbooks/
|
88
|
+
/cookbooks/cookbook3/
|
89
|
+
/cookbooks/cookbook3/metadata.rb
|
90
|
+
/data_bags/
|
91
|
+
/data_bags/bag3/
|
92
|
+
/data_bags/bag3/item3.json
|
93
|
+
/environments/
|
94
|
+
/environments/env3.json
|
95
|
+
/nodes/
|
96
|
+
/nodes/node3.json
|
97
|
+
/roles/
|
98
|
+
/roles/role3.json
|
99
|
+
/users/
|
100
|
+
/users/user3.json
|
101
|
+
EOM
|
102
|
+
end
|
103
|
+
|
104
|
+
it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do
|
105
|
+
Chef::Config.delete(:chef_repo_path)
|
106
|
+
knife("list -z -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<EOM
|
107
|
+
/acls/
|
108
|
+
/acls/clients/
|
109
|
+
/acls/clients/client3.json
|
110
|
+
/acls/containers/
|
111
|
+
/acls/cookbook_artifacts/
|
112
|
+
/acls/cookbooks/
|
113
|
+
/acls/cookbooks/cookbook3.json
|
114
|
+
/acls/data_bags/
|
115
|
+
/acls/data_bags/bag3.json
|
116
|
+
/acls/environments/
|
117
|
+
/acls/environments/env3.json
|
118
|
+
/acls/groups/
|
119
|
+
/acls/nodes/
|
120
|
+
/acls/nodes/node3.json
|
121
|
+
/acls/organization.json
|
122
|
+
/acls/policies/
|
123
|
+
/acls/policy_groups/
|
124
|
+
/acls/roles/
|
125
|
+
/acls/roles/role3.json
|
126
|
+
/clients/
|
127
|
+
/clients/client3.json
|
128
|
+
/containers/
|
129
|
+
/cookbook_artifacts/
|
130
|
+
/cookbooks/
|
131
|
+
/cookbooks/cookbook3/
|
132
|
+
/cookbooks/cookbook3/metadata.rb
|
133
|
+
/data_bags/
|
134
|
+
/data_bags/bag3/
|
135
|
+
/data_bags/bag3/item3.json
|
136
|
+
/environments/
|
137
|
+
/environments/env3.json
|
138
|
+
/groups/
|
139
|
+
/invitations.json
|
140
|
+
/members.json
|
141
|
+
/nodes/
|
142
|
+
/nodes/node3.json
|
143
|
+
/org.json
|
144
|
+
/policies/
|
145
|
+
/policy_groups/
|
146
|
+
/roles/
|
147
|
+
/roles/role3.json
|
148
|
+
EOM
|
149
|
+
end
|
150
|
+
|
82
151
|
context "when all _paths are set to alternates" do
|
83
152
|
before :each do
|
84
153
|
%w{client cookbook data_bag environment node role user}.each do |object_name|
|