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/run_list.rb
CHANGED
@@ -47,13 +47,13 @@ class Chef
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def role_names
|
50
|
-
@run_list_items.inject([]) { |memo, run_list_item| memo << run_list_item.name if run_list_item.role
|
50
|
+
@run_list_items.inject([]) { |memo, run_list_item| memo << run_list_item.name if run_list_item.role?; memo }
|
51
51
|
end
|
52
52
|
|
53
53
|
alias :roles :role_names
|
54
54
|
|
55
55
|
def recipe_names
|
56
|
-
@run_list_items.inject([]) { |memo, run_list_item| memo << run_list_item.name if run_list_item.recipe
|
56
|
+
@run_list_items.inject([]) { |memo, run_list_item| memo << run_list_item.name if run_list_item.recipe?; memo }
|
57
57
|
end
|
58
58
|
|
59
59
|
alias :recipes :recipe_names
|
data/lib/chef/search/query.rb
CHANGED
@@ -21,6 +21,7 @@ require "chef/exceptions"
|
|
21
21
|
require "chef/server_api"
|
22
22
|
|
23
23
|
require "uri"
|
24
|
+
require "addressable/uri"
|
24
25
|
|
25
26
|
class Chef
|
26
27
|
class Search
|
@@ -29,7 +30,7 @@ class Chef
|
|
29
30
|
attr_accessor :rest
|
30
31
|
attr_reader :config
|
31
32
|
|
32
|
-
def initialize(url = nil, config:Chef::Config)
|
33
|
+
def initialize(url = nil, config: Chef::Config)
|
33
34
|
@config = config
|
34
35
|
@url = url
|
35
36
|
end
|
@@ -134,19 +135,21 @@ WARNDEP
|
|
134
135
|
args_h
|
135
136
|
end
|
136
137
|
|
137
|
-
|
138
|
-
|
138
|
+
QUERY_PARAM_VALUE = Addressable::URI::CharacterClasses::QUERY + "\\&\\;"
|
139
|
+
|
140
|
+
def escape_value(s)
|
141
|
+
s && Addressable::URI.encode_component(s.to_s, QUERY_PARAM_VALUE)
|
139
142
|
end
|
140
143
|
|
141
144
|
def create_query_string(type, query, rows, start, sort)
|
142
|
-
qstr = "search/#{type}?q=#{
|
143
|
-
qstr += "&sort=#{
|
144
|
-
qstr += "&start=#{
|
145
|
-
qstr += "&rows=#{
|
145
|
+
qstr = "search/#{type}?q=#{escape_value(query)}"
|
146
|
+
qstr += "&sort=#{escape_value(sort)}" if sort
|
147
|
+
qstr += "&start=#{escape_value(start)}" if start
|
148
|
+
qstr += "&rows=#{escape_value(rows)}" if rows
|
146
149
|
qstr
|
147
150
|
end
|
148
151
|
|
149
|
-
def call_rest_service(type, query:"*:*", rows:nil, start:0, sort:"X_CHEF_id_CHEF_X asc", filter_result:nil)
|
152
|
+
def call_rest_service(type, query: "*:*", rows: nil, start: 0, sort: "X_CHEF_id_CHEF_X asc", filter_result: nil)
|
150
153
|
query_string = create_query_string(type, query, rows, start, sort)
|
151
154
|
|
152
155
|
if filter_result
|
data/lib/chef/shell/ext.rb
CHANGED
@@ -39,13 +39,13 @@ module Shell
|
|
39
39
|
# irb breaks if you prematurely define IRB::JobMangager
|
40
40
|
# so these methods need to be defined at the latest possible time.
|
41
41
|
unless jobs.respond_to?(:select_session_by_context)
|
42
|
-
def jobs.select_session_by_context(&block)
|
42
|
+
def jobs.select_session_by_context(&block) # rubocop:disable Lint/NestedMethodDefinition
|
43
43
|
@jobs.select { |job| block.call(job[1].context.main) }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
unless jobs.respond_to?(:session_select)
|
48
|
-
def jobs.select_shell_session(target_context)
|
48
|
+
def jobs.select_shell_session(target_context) # rubocop:disable Lint/NestedMethodDefinition
|
49
49
|
session = if target_context.kind_of?(Class)
|
50
50
|
select_session_by_context { |main| main.kind_of?(target_context) }
|
51
51
|
else
|
@@ -48,7 +48,7 @@ class Chef::Util::DSC
|
|
48
48
|
configuration_document_location = find_configuration_document(configuration_name)
|
49
49
|
|
50
50
|
if ! configuration_document_location
|
51
|
-
raise
|
51
|
+
raise "No DSC configuration for '#{configuration_name}' was generated from supplied DSC script"
|
52
52
|
end
|
53
53
|
|
54
54
|
configuration_document = get_configuration_document(configuration_document_location)
|
@@ -62,8 +62,11 @@ class Chef
|
|
62
62
|
json_depth = @output_format_options[:depth]
|
63
63
|
end
|
64
64
|
|
65
|
-
json_command = @json_format
|
66
|
-
|
65
|
+
json_command = if @json_format
|
66
|
+
" | convertto-json -compress -depth #{json_depth} > #{streams[:json].path}"
|
67
|
+
else
|
68
|
+
""
|
69
|
+
end
|
67
70
|
redirections = "4> '#{streams[:verbose].path}'"
|
68
71
|
command_string = "powershell.exe -executionpolicy bypass -noprofile -noninteractive "\
|
69
72
|
"-command \"trap [Exception] {write-error -exception "\
|
data/lib/chef/util/selinux.rb
CHANGED
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
when 0
|
79
79
|
return true
|
80
80
|
else
|
81
|
-
raise
|
81
|
+
raise "Unknown exit code from command #{selinuxenabled_path}: #{cmd.exitstatus}"
|
82
82
|
end
|
83
83
|
else
|
84
84
|
# We assume selinux is not enabled if selinux utils are not
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/version_class.rb
CHANGED
@@ -32,11 +32,11 @@ class Chef
|
|
32
32
|
"#{@major}.#{@minor}.#{@patch}"
|
33
33
|
end
|
34
34
|
|
35
|
-
def <=>(
|
35
|
+
def <=>(other)
|
36
36
|
[:major, :minor, :patch].each do |method|
|
37
37
|
version = self.send(method)
|
38
38
|
begin
|
39
|
-
ans = (version <=>
|
39
|
+
ans = (version <=> other.send(method))
|
40
40
|
rescue NoMethodError # if the other thing isn't a version object, return nil
|
41
41
|
return nil
|
42
42
|
end
|
@@ -57,8 +57,8 @@ class Chef
|
|
57
57
|
"#{@op} #{@raw_version}"
|
58
58
|
end
|
59
59
|
|
60
|
-
def eql?(
|
61
|
-
|
60
|
+
def eql?(other)
|
61
|
+
other.class == self.class && @op == other.op && @version == other.version
|
62
62
|
end
|
63
63
|
alias_method :==, :eql?
|
64
64
|
|
data/lib/chef/win32/api/error.rb
CHANGED
@@ -194,12 +194,12 @@ class Chef
|
|
194
194
|
ERROR_INVALID_EXE_SIGNATURE = 191
|
195
195
|
ERROR_EXE_MARKED_INVALID = 192
|
196
196
|
ERROR_BAD_EXE_FORMAT = 193
|
197
|
-
ERROR_ITERATED_DATA_EXCEEDS_64k = 194
|
197
|
+
ERROR_ITERATED_DATA_EXCEEDS_64k = 194 # rubocop:disable Style/ConstantName
|
198
198
|
ERROR_INVALID_MINALLOCSIZE = 195
|
199
199
|
ERROR_DYNLINK_FROM_INVALID_RING = 196
|
200
200
|
ERROR_IOPL_NOT_ENABLED = 197
|
201
201
|
ERROR_INVALID_SEGDPL = 198
|
202
|
-
ERROR_AUTODATASEG_EXCEEDS_64k = 199
|
202
|
+
ERROR_AUTODATASEG_EXCEEDS_64k = 199 # rubocop:disable Style/ConstantName
|
203
203
|
ERROR_RING2SEG_MUST_BE_MOVABLE = 200
|
204
204
|
ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201
|
205
205
|
ERROR_INFLOOP_IN_RELOC_CHAIN = 202
|
data/lib/chef/win32/api/net.rb
CHANGED
data/lib/chef/win32/eventlog.rb
CHANGED
data/lib/chef/win32/net.rb
CHANGED
@@ -207,7 +207,7 @@ class Chef
|
|
207
207
|
|
208
208
|
def self.members_to_lgrmi3(members)
|
209
209
|
buf = FFI::MemoryPointer.new(LOCALGROUP_MEMBERS_INFO_3, members.size)
|
210
|
-
members.size
|
210
|
+
Array.new(members.size) do |i|
|
211
211
|
member_info = LOCALGROUP_MEMBERS_INFO_3.new(
|
212
212
|
buf + i * LOCALGROUP_MEMBERS_INFO_3.size)
|
213
213
|
member_info[:lgrmi3_domainandname] = FFI::MemoryPointer.from_string(wstring(members[i]))
|
@@ -279,7 +279,7 @@ class Chef
|
|
279
279
|
status = NetUserEnum(servername, level, filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle)
|
280
280
|
|
281
281
|
if status == NERR_Success || status == ERROR_MORE_DATA
|
282
|
-
entriesread.read_long
|
282
|
+
Array.new(entriesread.read_long) do |i|
|
283
283
|
user_info = USER_INFO_3.new(bufptr.read_pointer + i * USER_INFO_3.size)
|
284
284
|
# Check if the account is the Administrator account
|
285
285
|
# RID for the Administrator account is always 500 and it's privilage is set to USER_PRIV_ADMIN
|
@@ -48,25 +48,28 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o
|
|
48
48
|
it "writes run_start event with event_id 10000 and contains version" do
|
49
49
|
logger.run_start(version)
|
50
50
|
|
51
|
-
expect(event_log.read(flags, offset).any?
|
52
|
-
|
51
|
+
expect(event_log.read(flags, offset).any? do |e|
|
52
|
+
e.source == "Chef" && e.event_id == 10000 &&
|
53
|
+
e.string_inserts[0].include?(version) end).to be_truthy
|
53
54
|
end
|
54
55
|
|
55
56
|
it "writes run_started event with event_id 10001 and contains the run_id" do
|
56
57
|
logger.run_started(run_status)
|
57
58
|
|
58
|
-
expect(event_log.read(flags, offset).any?
|
59
|
-
|
59
|
+
expect(event_log.read(flags, offset).any? do |e|
|
60
|
+
e.source == "Chef" && e.event_id == 10001 &&
|
61
|
+
e.string_inserts[0].include?(run_id) end).to be_truthy
|
60
62
|
end
|
61
63
|
|
62
64
|
it "writes run_completed event with event_id 10002 and contains the run_id and elapsed time" do
|
63
65
|
logger.run_started(run_status)
|
64
66
|
logger.run_completed(node)
|
65
67
|
|
66
|
-
expect(event_log.read(flags, offset).any?
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
expect(event_log.read(flags, offset).any? do |e|
|
69
|
+
e.source == "Chef" && e.event_id == 10002 &&
|
70
|
+
e.string_inserts[0].include?(run_id) &&
|
71
|
+
e.string_inserts[1].include?(elapsed_time.to_s)
|
72
|
+
end).to be_truthy
|
70
73
|
end
|
71
74
|
|
72
75
|
it "writes run_failed event with event_id 10003 and contains the run_id, elapsed time, and exception info" do
|
@@ -209,7 +209,7 @@ describe Chef::FileContentManagement::Deploy::MvUnix, :unix_only do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
# On Unix we won't have loaded the file, avoid undefined constant errors:
|
212
|
-
class Chef::FileContentManagement::Deploy::MvWindows
|
212
|
+
class Chef::FileContentManagement::Deploy::MvWindows; end
|
213
213
|
|
214
214
|
describe Chef::FileContentManagement::Deploy::MvWindows, :windows_only do
|
215
215
|
|
@@ -26,11 +26,11 @@ describe Chef::HTTP::Simple do
|
|
26
26
|
let(:http_client) { described_class.new(source) }
|
27
27
|
let(:http_client_disable_gzip) { described_class.new(source, { :disable_gzip => true } ) }
|
28
28
|
|
29
|
-
before(:
|
29
|
+
before(:each) do
|
30
30
|
start_tiny_server
|
31
31
|
end
|
32
32
|
|
33
|
-
after(:
|
33
|
+
after(:each) do
|
34
34
|
stop_tiny_server
|
35
35
|
end
|
36
36
|
|
@@ -20,11 +20,15 @@ require "spec_helper"
|
|
20
20
|
require "tiny_server"
|
21
21
|
|
22
22
|
describe Chef::Knife::CookbookDelete do
|
23
|
-
before(:
|
23
|
+
before(:each) do
|
24
24
|
@server = TinyServer::Manager.new
|
25
25
|
@server.start
|
26
26
|
end
|
27
27
|
|
28
|
+
after(:each) do
|
29
|
+
@server.stop
|
30
|
+
end
|
31
|
+
|
28
32
|
before(:each) do
|
29
33
|
@knife = Chef::Knife::CookbookDelete.new
|
30
34
|
@api = TinyServer::API.instance
|
@@ -35,10 +39,6 @@ describe Chef::Knife::CookbookDelete do
|
|
35
39
|
Chef::Config[:chef_server_url] = "http://localhost:9000"
|
36
40
|
end
|
37
41
|
|
38
|
-
after(:all) do
|
39
|
-
@server.stop
|
40
|
-
end
|
41
|
-
|
42
42
|
context "when the cookbook doesn't exist" do
|
43
43
|
let(:log_output) { StringIO.new }
|
44
44
|
|
@@ -20,11 +20,15 @@ require "spec_helper"
|
|
20
20
|
require "tiny_server"
|
21
21
|
|
22
22
|
describe Chef::Knife::Exec do
|
23
|
-
before(:
|
24
|
-
@server = TinyServer::Manager.new#(:debug => true)
|
23
|
+
before(:each) do
|
24
|
+
@server = TinyServer::Manager.new #(:debug => true)
|
25
25
|
@server.start
|
26
26
|
end
|
27
27
|
|
28
|
+
after(:each) do
|
29
|
+
@server.stop
|
30
|
+
end
|
31
|
+
|
28
32
|
before(:each) do
|
29
33
|
@knife = Chef::Knife::Exec.new
|
30
34
|
@api = TinyServer::API.instance
|
@@ -37,10 +41,6 @@ describe Chef::Knife::Exec do
|
|
37
41
|
$output = StringIO.new
|
38
42
|
end
|
39
43
|
|
40
|
-
after(:all) do
|
41
|
-
@server.stop
|
42
|
-
end
|
43
|
-
|
44
44
|
it "executes a script in the context of the chef-shell main context" do
|
45
45
|
@node = Chef::Node.new
|
46
46
|
@node.name("ohai-world")
|
@@ -21,13 +21,13 @@ require "tiny_server"
|
|
21
21
|
|
22
22
|
describe Chef::Knife::Ssh do
|
23
23
|
|
24
|
-
before(:
|
24
|
+
before(:each) do
|
25
25
|
Chef::Knife::Ssh.load_deps
|
26
26
|
@server = TinyServer::Manager.new
|
27
27
|
@server.start
|
28
28
|
end
|
29
29
|
|
30
|
-
after(:
|
30
|
+
after(:each) do
|
31
31
|
@server.stop
|
32
32
|
end
|
33
33
|
|
@@ -276,9 +276,9 @@ describe Chef::Knife::Ssh do
|
|
276
276
|
Chef::Config[:client_key] = nil
|
277
277
|
Chef::Config[:chef_server_url] = "http://localhost:9000"
|
278
278
|
|
279
|
-
@api.get("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200)
|
279
|
+
@api.get("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200) do
|
280
280
|
%({"total":1, "start":0, "rows":[{"name":"i-xxxxxxxx", "json_class":"Chef::Node", "automatic":{"fqdn":"the.fqdn", "ec2":{"public_hostname":"the_public_hostname"}},"recipes":[]}]})
|
281
|
-
|
281
|
+
end
|
282
282
|
end
|
283
283
|
|
284
284
|
end
|
@@ -13,11 +13,11 @@ describe "Notifications" do
|
|
13
13
|
|
14
14
|
# We always pretend we are on OSx because that has a specific provider (HomebrewProvider) so it
|
15
15
|
# tests the translation from Provider => HomebrewProvider
|
16
|
-
let(:node)
|
16
|
+
let(:node) do
|
17
17
|
n = Chef::Node.new
|
18
18
|
n.override[:os] = "darwin"
|
19
19
|
n
|
20
|
-
|
20
|
+
end
|
21
21
|
let(:cookbook_collection) { double("Chef::CookbookCollection").as_null_object }
|
22
22
|
let(:events) { double("Chef::EventDispatch::Dispatcher").as_null_object }
|
23
23
|
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
|
@@ -21,10 +21,10 @@ require "spec_helper"
|
|
21
21
|
describe Chef::Resource::WhyrunSafeRubyBlock do
|
22
22
|
let(:node) { Chef::Node.new }
|
23
23
|
|
24
|
-
let(:run_context)
|
24
|
+
let(:run_context) do
|
25
25
|
events = Chef::EventDispatch::Dispatcher.new
|
26
26
|
Chef::RunContext.new(node, {}, events)
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
29
|
before do
|
30
30
|
$evil_global_evil_laugh = :wahwah
|
@@ -50,15 +50,15 @@ describe Chef::Platform::Rebooter do
|
|
50
50
|
|
51
51
|
let(:rebooter) { Chef::Platform::Rebooter }
|
52
52
|
|
53
|
-
describe
|
53
|
+
describe "#reboot_if_needed!" do
|
54
54
|
|
55
|
-
it
|
55
|
+
it "should not call #shell_out! when reboot has not been requested" do
|
56
56
|
expect(rebooter).to receive(:shell_out!).exactly(0).times
|
57
57
|
expect(rebooter).to receive(:reboot_if_needed!).once.and_call_original
|
58
58
|
rebooter.reboot_if_needed!(run_context.node)
|
59
59
|
end
|
60
60
|
|
61
|
-
describe
|
61
|
+
describe "calling #shell_out! to reboot" do
|
62
62
|
|
63
63
|
before(:each) do
|
64
64
|
run_context.request_reboot(reboot_info)
|
@@ -77,7 +77,7 @@ describe Chef::Platform::Rebooter do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
describe
|
80
|
+
describe "when using #reboot_if_needed!" do
|
81
81
|
include_context "test a reboot method"
|
82
82
|
|
83
83
|
it "should produce the correct string on Windows" do
|
@@ -89,7 +89,7 @@ describe Chef::Platform::Rebooter do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
describe
|
92
|
+
describe "when using #reboot!" do
|
93
93
|
include_context "test a reboot method"
|
94
94
|
|
95
95
|
it "should produce the correct string on Windows" do
|
@@ -21,11 +21,11 @@ require "functional/resource/base"
|
|
21
21
|
|
22
22
|
describe Chef::Resource::Bash, :unix_only do
|
23
23
|
let(:code) { "echo hello" }
|
24
|
-
let(:resource)
|
24
|
+
let(:resource) do
|
25
25
|
resource = Chef::Resource::Bash.new("foo_resource", run_context)
|
26
26
|
resource.code(code)
|
27
27
|
resource
|
28
|
-
|
28
|
+
end
|
29
29
|
|
30
30
|
describe "when setting the command attribute" do
|
31
31
|
let (:command) { "wizard racket" }
|