chef 12.18.31-universal-mingw32 → 12.19.33-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -146,7 +146,7 @@ class Chef
|
|
146
146
|
results << lookup(create_key(resource_type, instance_name))
|
147
147
|
end
|
148
148
|
end
|
149
|
-
|
149
|
+
results
|
150
150
|
end
|
151
151
|
|
152
152
|
def find_resource_by_string(arg)
|
@@ -166,7 +166,7 @@ class Chef
|
|
166
166
|
else
|
167
167
|
raise ArgumentError, "Bad string format #{arg}, you must have a string like resource_type[name]!"
|
168
168
|
end
|
169
|
-
|
169
|
+
results
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
data/lib/chef/run_context.rb
CHANGED
@@ -253,7 +253,7 @@ class Chef
|
|
253
253
|
# @return [Array[Notification]]
|
254
254
|
#
|
255
255
|
def before_notifications(resource)
|
256
|
-
|
256
|
+
before_notification_collection[resource.declared_key]
|
257
257
|
end
|
258
258
|
|
259
259
|
#
|
@@ -262,7 +262,7 @@ class Chef
|
|
262
262
|
# @return [Array[Notification]]
|
263
263
|
#
|
264
264
|
def immediate_notifications(resource)
|
265
|
-
|
265
|
+
immediate_notification_collection[resource.declared_key]
|
266
266
|
end
|
267
267
|
|
268
268
|
#
|
@@ -272,7 +272,7 @@ class Chef
|
|
272
272
|
# @return [Array[Notification]]
|
273
273
|
#
|
274
274
|
def delayed_notifications(resource)
|
275
|
-
|
275
|
+
delayed_notification_collection[resource.declared_key]
|
276
276
|
end
|
277
277
|
|
278
278
|
#
|
@@ -81,7 +81,7 @@ class Chef
|
|
81
81
|
|
82
82
|
def ==(other)
|
83
83
|
if other.kind_of?(String)
|
84
|
-
|
84
|
+
to_s == other.to_s
|
85
85
|
else
|
86
86
|
other.respond_to?(:type) && other.respond_to?(:name) && other.respond_to?(:version) && other.type == @type && other.name == @name && other.version == @version
|
87
87
|
end
|
@@ -36,17 +36,17 @@ class Chef
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
@versions[name] = version if version
|
39
|
-
self << name unless
|
39
|
+
self << name unless include?(name)
|
40
40
|
end
|
41
41
|
|
42
42
|
def with_versions
|
43
|
-
|
43
|
+
map { |recipe_name| { :name => recipe_name, :version => @versions[recipe_name] } }
|
44
44
|
end
|
45
45
|
|
46
46
|
# Return an Array of Hashes, each of the form:
|
47
47
|
# {:name => RECIPE_NAME, :version_constraint => Chef::VersionConstraint }
|
48
48
|
def with_version_constraints
|
49
|
-
|
49
|
+
map do |recipe_name|
|
50
50
|
constraint = Chef::VersionConstraint.new(@versions[recipe_name])
|
51
51
|
{ :name => recipe_name, :version_constraint => constraint }
|
52
52
|
end
|
@@ -55,7 +55,7 @@ class Chef
|
|
55
55
|
# Return an Array of Strings, each of the form:
|
56
56
|
# "NAME@VERSION"
|
57
57
|
def with_version_constraints_strings
|
58
|
-
|
58
|
+
map do |recipe_name|
|
59
59
|
if @versions[recipe_name]
|
60
60
|
"#{recipe_name}@#{@versions[recipe_name]}"
|
61
61
|
else
|
@@ -69,7 +69,7 @@ class Chef
|
|
69
69
|
#
|
70
70
|
# @return [Array] Array of strings with fully-qualified recipe names
|
71
71
|
def with_fully_qualified_names_and_version_constraints
|
72
|
-
|
72
|
+
map do |recipe_name|
|
73
73
|
qualified_recipe = if recipe_name.include?("::")
|
74
74
|
recipe_name
|
75
75
|
else
|
@@ -89,7 +89,7 @@ class Chef
|
|
89
89
|
#
|
90
90
|
# @return [Array] Array of strings with fully-qualified and unexpanded recipe names
|
91
91
|
def with_duplicate_names
|
92
|
-
|
92
|
+
map do |recipe_name|
|
93
93
|
if recipe_name.include?("::")
|
94
94
|
recipe_name
|
95
95
|
else
|
data/lib/chef/server_api.rb
CHANGED
@@ -24,6 +24,7 @@ require "chef/http/json_input"
|
|
24
24
|
require "chef/http/json_output"
|
25
25
|
require "chef/http/remote_request_id"
|
26
26
|
require "chef/http/validate_content_length"
|
27
|
+
require "chef/http/api_versions"
|
27
28
|
|
28
29
|
class Chef
|
29
30
|
class ServerAPI < Chef::HTTP
|
@@ -42,6 +43,7 @@ class Chef
|
|
42
43
|
use Chef::HTTP::Decompressor
|
43
44
|
use Chef::HTTP::Authenticator
|
44
45
|
use Chef::HTTP::RemoteRequestID
|
46
|
+
use Chef::HTTP::APIVersions
|
45
47
|
|
46
48
|
# ValidateContentLength should come after Decompressor
|
47
49
|
# because the order of middlewares is reversed when handling
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright:: Copyright 2017, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "singleton"
|
19
|
+
|
20
|
+
class Chef
|
21
|
+
class ServerAPIVersions
|
22
|
+
include Singleton
|
23
|
+
|
24
|
+
def set_versions(versions)
|
25
|
+
@versions ||= versions
|
26
|
+
end
|
27
|
+
|
28
|
+
def min_server_version
|
29
|
+
!@versions.nil? ? @versions["min_version"] : nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def max_server_version
|
33
|
+
!@versions.nil? ? @versions["max_version"] : nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def reset!
|
37
|
+
@versions = nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/chef/shell.rb
CHANGED
data/lib/chef/shell/ext.rb
CHANGED
@@ -73,7 +73,7 @@ module Shell
|
|
73
73
|
banner << "| " + "Command".ljust(25) + "| " + "Description"
|
74
74
|
banner << "".ljust(80, "=")
|
75
75
|
|
76
|
-
|
76
|
+
all_help_descriptions.each do |help_text|
|
77
77
|
banner << "| " + help_text.cmd.ljust(25) + "| " + help_text.desc
|
78
78
|
end
|
79
79
|
banner << "".ljust(80, "=")
|
@@ -84,7 +84,7 @@ module Shell
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def explain_command(method_name)
|
87
|
-
help =
|
87
|
+
help = all_help_descriptions.find { |h| h.cmd.to_s == method_name.to_s }
|
88
88
|
if help
|
89
89
|
puts ""
|
90
90
|
puts "Command: #{method_name}"
|
@@ -159,7 +159,7 @@ module Shell
|
|
159
159
|
|
160
160
|
module Symbol
|
161
161
|
def on_off_to_bool
|
162
|
-
|
162
|
+
to_s.on_off_to_bool
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -127,7 +127,7 @@ module Shell
|
|
127
127
|
|
128
128
|
def shorten_node_inspect
|
129
129
|
def @node.inspect # rubocop:disable Lint/NestedMethodDefinition
|
130
|
-
"<Chef::Node:0x#{
|
130
|
+
"<Chef::Node:0x#{object_id.to_s(16)} @name=\"#{name}\">"
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
data/lib/chef/user.rb
CHANGED
@@ -97,10 +97,10 @@ class Chef
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def create
|
100
|
-
payload = { :name =>
|
100
|
+
payload = { :name => name, :admin => admin, :password => password }
|
101
101
|
payload[:public_key] = public_key if public_key
|
102
102
|
new_user = chef_rest_v0.post("users", payload)
|
103
|
-
Chef::User.from_hash(
|
103
|
+
Chef::User.from_hash(to_hash.merge(new_user))
|
104
104
|
end
|
105
105
|
|
106
106
|
def update(new_key = false)
|
@@ -108,18 +108,16 @@ class Chef
|
|
108
108
|
payload[:private_key] = new_key if new_key
|
109
109
|
payload[:password] = password if password
|
110
110
|
updated_user = chef_rest_v0.put("users/#{name}", payload)
|
111
|
-
Chef::User.from_hash(
|
111
|
+
Chef::User.from_hash(to_hash.merge(updated_user))
|
112
112
|
end
|
113
113
|
|
114
114
|
def save(new_key = false)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
raise e
|
122
|
-
end
|
115
|
+
create
|
116
|
+
rescue Net::HTTPServerException => e
|
117
|
+
if e.response.code == "409"
|
118
|
+
update(new_key)
|
119
|
+
else
|
120
|
+
raise e
|
123
121
|
end
|
124
122
|
end
|
125
123
|
|
data/lib/chef/user_v1.rb
CHANGED
@@ -180,7 +180,7 @@ class Chef
|
|
180
180
|
new_user = chef_root_rest_v0.post("users", payload)
|
181
181
|
end
|
182
182
|
|
183
|
-
Chef::UserV1.from_hash(
|
183
|
+
Chef::UserV1.from_hash(to_hash.merge(new_user))
|
184
184
|
end
|
185
185
|
|
186
186
|
def update(new_key = false)
|
@@ -213,25 +213,23 @@ class Chef
|
|
213
213
|
end
|
214
214
|
updated_user = chef_root_rest_v0.put("users/#{username}", payload)
|
215
215
|
end
|
216
|
-
Chef::UserV1.from_hash(
|
216
|
+
Chef::UserV1.from_hash(to_hash.merge(updated_user))
|
217
217
|
end
|
218
218
|
|
219
219
|
def save(new_key = false)
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
raise e
|
227
|
-
end
|
220
|
+
create
|
221
|
+
rescue Net::HTTPServerException => e
|
222
|
+
if e.response.code == "409"
|
223
|
+
update(new_key)
|
224
|
+
else
|
225
|
+
raise e
|
228
226
|
end
|
229
227
|
end
|
230
228
|
|
231
229
|
# Note: remove after API v0 no longer supported by client (and knife command).
|
232
230
|
def reregister
|
233
231
|
begin
|
234
|
-
payload =
|
232
|
+
payload = to_hash.merge({ "private_key" => true })
|
235
233
|
reregistered_self = chef_root_rest_v0.put("users/#{username}", payload)
|
236
234
|
private_key(reregistered_self["private_key"])
|
237
235
|
# only V0 supported for reregister
|
data/lib/chef/util/diff.rb
CHANGED
data/lib/chef/util/selinux.rb
CHANGED
@@ -35,50 +35,38 @@ class Chef::Util::Windows::NetGroup
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def local_get_members
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
raise ArgumentError, e
|
42
|
-
end
|
38
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_get_members(nil, groupname)
|
39
|
+
rescue Chef::Exceptions::Win32APIError => e
|
40
|
+
raise ArgumentError, e
|
43
41
|
end
|
44
42
|
|
45
43
|
def local_add
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
raise ArgumentError, e
|
50
|
-
end
|
44
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_add(nil, groupname)
|
45
|
+
rescue Chef::Exceptions::Win32APIError => e
|
46
|
+
raise ArgumentError, e
|
51
47
|
end
|
52
48
|
|
53
49
|
def local_set_members(members)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
raise ArgumentError, e
|
58
|
-
end
|
50
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_set_members(nil, groupname, members)
|
51
|
+
rescue Chef::Exceptions::Win32APIError => e
|
52
|
+
raise ArgumentError, e
|
59
53
|
end
|
60
54
|
|
61
55
|
def local_add_members(members)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
raise ArgumentError, e
|
66
|
-
end
|
56
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_add_members(nil, groupname, members)
|
57
|
+
rescue Chef::Exceptions::Win32APIError => e
|
58
|
+
raise ArgumentError, e
|
67
59
|
end
|
68
60
|
|
69
61
|
def local_delete_members(members)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
raise ArgumentError, e
|
74
|
-
end
|
62
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_del_members(nil, groupname, members)
|
63
|
+
rescue Chef::Exceptions::Win32APIError => e
|
64
|
+
raise ArgumentError, e
|
75
65
|
end
|
76
66
|
|
77
67
|
def local_delete
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
raise ArgumentError, e
|
82
|
-
end
|
68
|
+
Chef::ReservedNames::Win32::NetUser.net_local_group_del(nil, groupname)
|
69
|
+
rescue Chef::Exceptions::Win32APIError => e
|
70
|
+
raise ArgumentError, e
|
83
71
|
end
|
84
72
|
end
|
@@ -59,12 +59,10 @@ class Chef::Util::Windows::NetUse < Chef::Util::Windows
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def get_info
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
raise ArgumentError, e
|
67
|
-
end
|
62
|
+
ui2 = Chef::ReservedNames::Win32::Net.net_use_get_info_l2(nil, use_name)
|
63
|
+
from_use_info_struct(ui2)
|
64
|
+
rescue Chef::Exceptions::Win32APIError => e
|
65
|
+
raise ArgumentError, e
|
68
66
|
end
|
69
67
|
|
70
68
|
def device
|
@@ -72,11 +70,9 @@ class Chef::Util::Windows::NetUse < Chef::Util::Windows
|
|
72
70
|
end
|
73
71
|
|
74
72
|
def delete
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
raise ArgumentError, e
|
79
|
-
end
|
73
|
+
Chef::ReservedNames::Win32::Net.net_use_del(nil, use_name, :use_noforce)
|
74
|
+
rescue Chef::Exceptions::Win32APIError => e
|
75
|
+
raise ArgumentError, e
|
80
76
|
end
|
81
77
|
|
82
78
|
def use_name
|
@@ -78,11 +78,9 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def set_info(args)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
raise ArgumentError, e
|
85
|
-
end
|
81
|
+
rc = NetUser.net_user_set_info_l3(nil, @username, transform_usri3(args))
|
82
|
+
rescue Chef::Exceptions::Win32APIError => e
|
83
|
+
raise ArgumentError, e
|
86
84
|
end
|
87
85
|
|
88
86
|
public
|
@@ -95,13 +93,11 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
|
|
95
93
|
LOGON32_LOGON_NETWORK = Security::LOGON32_LOGON_NETWORK
|
96
94
|
#XXX for an extra painful alternative, see: http://support.microsoft.com/kb/180548
|
97
95
|
def validate_credentials(passwd)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
return false
|
104
|
-
end
|
96
|
+
token = Security.logon_user(@username, nil, passwd,
|
97
|
+
LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT)
|
98
|
+
return true
|
99
|
+
rescue Chef::Exceptions::Win32APIError
|
100
|
+
return false
|
105
101
|
end
|
106
102
|
|
107
103
|
def get_info
|
@@ -137,11 +133,9 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
|
|
137
133
|
end
|
138
134
|
|
139
135
|
def delete
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
raise ArgumentError, e
|
144
|
-
end
|
136
|
+
NetUser.net_user_del(nil, @username)
|
137
|
+
rescue Chef::Exceptions::Win32APIError => e
|
138
|
+
raise ArgumentError, e
|
145
139
|
end
|
146
140
|
|
147
141
|
def disable_account
|