chef 16.3.45-universal-mingw32 → 16.4.35-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/chef-universal-mingw32.gemspec +0 -1
- data/lib/chef/action_collection.rb +4 -0
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/apply.rb +5 -5
- data/lib/chef/application/windows_service.rb +27 -27
- data/lib/chef/chef_class.rb +0 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +54 -54
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +10 -10
- data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +8 -8
- data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +8 -8
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +18 -18
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/client.rb +11 -11
- data/lib/chef/data_collector/run_end_message.rb +11 -1
- data/lib/chef/dsl/platform_introspection.rb +8 -8
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_content_management/tempfile.rb +9 -9
- data/lib/chef/http.rb +2 -1
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +23 -23
- data/lib/chef/knife/core/generic_presenter.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
- data/lib/chef/knife/core/windows_bootstrap_context.rb +32 -24
- data/lib/chef/knife/delete.rb +15 -15
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +6 -6
- data/lib/chef/knife/xargs.rb +19 -19
- data/lib/chef/knife/yaml_convert.rb +1 -1
- data/lib/chef/mixin/checksum.rb +0 -1
- data/lib/chef/mixin/deep_merge.rb +35 -6
- data/lib/chef/mixin/openssl_helper.rb +3 -1
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/monkey_patches/webrick-utils.rb +10 -10
- data/lib/chef/node/attribute.rb +2 -4
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/property.rb +1 -1
- data/lib/chef/provider/cron/unix.rb +0 -2
- data/lib/chef/provider/git.rb +5 -5
- data/lib/chef/provider/group.rb +0 -2
- data/lib/chef/provider/group/suse.rb +5 -5
- data/lib/chef/provider/ifconfig.rb +1 -4
- data/lib/chef/provider/mount.rb +0 -2
- data/lib/chef/provider/package.rb +0 -2
- data/lib/chef/provider/package/rubygems.rb +1 -1
- data/lib/chef/provider/package/snap.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +9 -9
- data/lib/chef/provider/powershell_script.rb +21 -5
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/service/arch.rb +1 -1
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +1 -4
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/service/windows.rb +10 -10
- data/lib/chef/provider/systemd_unit.rb +0 -2
- data/lib/chef/provider/template/content.rb +1 -0
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/mac.rb +9 -9
- data/lib/chef/provider/windows_task.rb +0 -3
- data/lib/chef/provider/zypper_repository.rb +0 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/recipe.rb +1 -1
- data/lib/chef/resource.rb +6 -10
- data/lib/chef/resource/apt_repository.rb +1 -10
- data/lib/chef/resource/chef_client_systemd_timer.rb +2 -2
- data/lib/chef/resource/chef_vault_secret.rb +13 -13
- data/lib/chef/resource/execute.rb +2 -3
- data/lib/chef/resource/homebrew_update.rb +2 -2
- data/lib/chef/resource/openssl_dhparam.rb +2 -0
- data/lib/chef/resource/openssl_ec_private_key.rb +2 -0
- data/lib/chef/resource/openssl_ec_public_key.rb +2 -0
- data/lib/chef/resource/openssl_rsa_private_key.rb +2 -0
- data/lib/chef/resource/openssl_rsa_public_key.rb +2 -0
- data/lib/chef/resource/openssl_x509_certificate.rb +24 -21
- data/lib/chef/resource/openssl_x509_crl.rb +2 -0
- data/lib/chef/resource/openssl_x509_request.rb +23 -20
- data/lib/chef/resource/osx_profile.rb +227 -5
- data/lib/chef/resource/powershell_package_source.rb +1 -1
- data/lib/chef/resource/powershell_script.rb +24 -30
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/sysctl.rb +5 -5
- data/lib/chef/resource/windows_ad_join.rb +2 -0
- data/lib/chef/resource/windows_audit_policy.rb +3 -0
- data/lib/chef/resource/windows_auto_run.rb +2 -0
- data/lib/chef/resource/windows_certificate.rb +2 -0
- data/lib/chef/resource/windows_dfs_folder.rb +2 -0
- data/lib/chef/resource/windows_dfs_namespace.rb +2 -0
- data/lib/chef/resource/windows_dfs_server.rb +2 -0
- data/lib/chef/resource/windows_dns_record.rb +10 -7
- data/lib/chef/resource/windows_dns_zone.rb +12 -7
- data/lib/chef/resource/windows_feature.rb +2 -0
- data/lib/chef/resource/windows_feature_dism.rb +10 -0
- data/lib/chef/resource/windows_feature_powershell.rb +14 -2
- data/lib/chef/resource/windows_firewall_profile.rb +4 -2
- data/lib/chef/resource/windows_firewall_rule.rb +5 -3
- data/lib/chef/resource/windows_font.rb +3 -1
- data/lib/chef/resource/windows_pagefile.rb +4 -0
- data/lib/chef/resource/windows_printer.rb +17 -18
- data/lib/chef/resource/windows_printer_port.rb +14 -13
- data/lib/chef/resource/windows_security_policy.rb +2 -0
- data/lib/chef/resource/windows_share.rb +5 -3
- data/lib/chef/resource/windows_shortcut.rb +2 -0
- data/lib/chef/resource/windows_uac.rb +2 -0
- data/lib/chef/resource/windows_user_privilege.rb +2 -0
- data/lib/chef/resource/windows_workgroup.rb +2 -3
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -2
- data/lib/chef/role.rb +2 -2
- data/lib/chef/run_context/cookbook_compiler.rb +20 -20
- data/lib/chef/run_status.rb +2 -6
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/util/backup.rb +1 -1
- data/lib/chef/util/diff.rb +11 -11
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/lib/chef/win32/file/version_info.rb +5 -5
- data/spec/data/ssl/chef-rspec.cert +15 -15
- data/spec/functional/resource/aixinit_service_spec.rb +7 -7
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +0 -1
- data/spec/functional/resource/group_spec.rb +6 -6
- data/spec/functional/resource/insserv_spec.rb +4 -4
- data/spec/functional/resource/link_spec.rb +20 -20
- data/spec/functional/resource/powershell_script_spec.rb +4 -4
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/resource/windows_security_policy_spec.rb +0 -3
- data/spec/functional/run_lock_spec.rb +24 -24
- data/spec/functional/win32/registry_spec.rb +8 -8
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +12 -12
- data/spec/integration/knife/config_get_profile_spec.rb +69 -68
- data/spec/integration/knife/config_get_spec.rb +126 -125
- data/spec/integration/knife/config_list_profiles_spec.rb +181 -180
- data/spec/integration/knife/config_use_profile_spec.rb +110 -109
- data/spec/integration/knife/diff_spec.rb +3 -1
- data/spec/integration/knife/download_spec.rb +3 -1
- data/spec/integration/knife/serve_spec.rb +5 -5
- data/spec/integration/knife/upload_spec.rb +3 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/spec_helper.rb +6 -6
- data/spec/support/platform_helpers.rb +9 -9
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +20 -20
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/integration_helper.rb +22 -52
- data/spec/support/shared/unit/script_resource.rb +6 -20
- data/spec/support/shared/unit/windows_script_resource.rb +15 -28
- data/spec/unit/data_collector_spec.rb +22 -0
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/knife/bootstrap_spec.rb +14 -14
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +21 -12
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/mixin/template_spec.rb +30 -30
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +4 -4
- data/spec/unit/node/immutable_collections_spec.rb +6 -2
- data/spec/unit/node_spec.rb +5 -5
- data/spec/unit/provider/powershell_script_spec.rb +11 -4
- data/spec/unit/provider/remote_directory_spec.rb +9 -9
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider_resolver_spec.rb +6 -6
- data/spec/unit/resource/batch_spec.rb +6 -6
- data/spec/unit/resource/execute_spec.rb +113 -118
- data/spec/unit/resource/osx_profile_spec.rb +233 -0
- data/spec/unit/resource/powershell_script_spec.rb +11 -29
- data/spec/unit/resource/script_spec.rb +6 -1
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/role_spec.rb +11 -11
- data/tasks/rspec.rb +1 -1
- metadata +7 -22
- data/lib/chef/provider/osx_profile.rb +0 -255
- data/spec/unit/provider/osx_profile_spec.rb +0 -255
@@ -22,6 +22,8 @@ require_relative "../resource"
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class WindowsPrinterPort < Chef::Resource
|
25
|
+
unified_mode true
|
26
|
+
|
25
27
|
require "resolv"
|
26
28
|
|
27
29
|
provides(:windows_printer_port) { true }
|
@@ -82,30 +84,19 @@ class Chef
|
|
82
84
|
validation_message: "port_protocol must be either 1 for RAW or 2 for LPR!",
|
83
85
|
default: 1, equal_to: [1, 2]
|
84
86
|
|
85
|
-
property :exists, [TrueClass, FalseClass],
|
86
|
-
skip_docs: true
|
87
|
-
|
88
87
|
PORTS_REG_KEY = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\\'.freeze unless defined?(PORTS_REG_KEY)
|
89
88
|
|
90
|
-
def port_exists?(name)
|
91
|
-
port_reg_key = PORTS_REG_KEY + name
|
92
|
-
|
93
|
-
logger.trace "Checking to see if this reg key exists: '#{port_reg_key}'"
|
94
|
-
registry_key_exists?(port_reg_key)
|
95
|
-
end
|
96
|
-
|
97
89
|
# @todo Set @current_resource port properties from registry
|
98
90
|
load_current_value do |desired|
|
99
91
|
name desired.name
|
100
92
|
ipv4_address desired.ipv4_address
|
101
93
|
port_name desired.port_name || "IP_#{desired.ipv4_address}"
|
102
|
-
exists port_exists?(desired.port_name || "IP_#{desired.ipv4_address}")
|
103
94
|
end
|
104
95
|
|
105
96
|
action :create do
|
106
97
|
description "Create the new printer port if it does not already exist."
|
107
98
|
|
108
|
-
if
|
99
|
+
if port_exists?
|
109
100
|
Chef::Log.info "#{@new_resource} already exists - nothing to do."
|
110
101
|
else
|
111
102
|
converge_by("Create #{@new_resource}") do
|
@@ -117,7 +108,7 @@ class Chef
|
|
117
108
|
action :delete do
|
118
109
|
description "Delete an existing printer port."
|
119
110
|
|
120
|
-
if
|
111
|
+
if port_exists?
|
121
112
|
converge_by("Delete #{@new_resource}") do
|
122
113
|
delete_printer_port
|
123
114
|
end
|
@@ -127,6 +118,16 @@ class Chef
|
|
127
118
|
end
|
128
119
|
|
129
120
|
action_class do
|
121
|
+
private
|
122
|
+
|
123
|
+
def port_exists?
|
124
|
+
name = new_resource.port_name || "IP_#{new_resource.ipv4_address}"
|
125
|
+
port_reg_key = PORTS_REG_KEY + name
|
126
|
+
|
127
|
+
logger.trace "Checking to see if this reg key exists: '#{port_reg_key}'"
|
128
|
+
registry_key_exists?(port_reg_key)
|
129
|
+
end
|
130
|
+
|
130
131
|
def create_printer_port
|
131
132
|
port_name = new_resource.port_name || "IP_#{new_resource.ipv4_address}"
|
132
133
|
|
@@ -26,6 +26,8 @@ require_relative "../util/path_helper"
|
|
26
26
|
class Chef
|
27
27
|
class Resource
|
28
28
|
class WindowsShare < Chef::Resource
|
29
|
+
unified_mode true
|
30
|
+
|
29
31
|
provides :windows_share
|
30
32
|
|
31
33
|
description "Use the **windows_share** resource to create, modify and remove Windows shares."
|
@@ -59,7 +61,7 @@ class Chef
|
|
59
61
|
# Specifies the path of the location of the folder to share. The path must be fully qualified. Relative paths or paths that contain wildcard characters are not permitted.
|
60
62
|
property :path, String,
|
61
63
|
description: "The path of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created.",
|
62
|
-
coerce: proc { |p| p.
|
64
|
+
coerce: proc { |p| p.tr("/", "\\") || p }
|
63
65
|
|
64
66
|
# Specifies an optional description of the SMB share. A description of the share is displayed by running the Get-SmbShare cmdlet. The description may not contain more than 256 characters.
|
65
67
|
property :description, String,
|
@@ -117,8 +119,6 @@ class Chef
|
|
117
119
|
# Specifies which files and folders in the SMB share are visible to users. AccessBased: SMB does not the display the files and folders for a share to a user unless that user has rights to access the files and folders. By default, access-based enumeration is disabled for new SMB shares. Unrestricted: SMB displays files and folders to a user even when the user does not have permission to access the items.
|
118
120
|
# property :folder_enumeration_mode, String, equal_to: %(AccessBased Unrestricted)
|
119
121
|
|
120
|
-
include Chef::Mixin::PowershellOut
|
121
|
-
|
122
122
|
load_current_value do |desired|
|
123
123
|
# this command selects individual objects because EncryptData & CachingMode have underlying
|
124
124
|
# types that get converted to their Integer values by ConvertTo-Json & we need to make sure
|
@@ -233,6 +233,8 @@ class Chef
|
|
233
233
|
end
|
234
234
|
|
235
235
|
action_class do
|
236
|
+
private
|
237
|
+
|
236
238
|
def different_path?
|
237
239
|
return false if current_resource.nil? # going from nil to something isn't different for our concerns
|
238
240
|
return false if current_resource.path == Chef::Util::PathHelper.cleanpath(new_resource.path)
|
@@ -21,6 +21,8 @@ require_relative "../resource"
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class WindowsShortcut < Chef::Resource
|
24
|
+
unified_mode true
|
25
|
+
|
24
26
|
provides(:windows_shortcut) { true }
|
25
27
|
|
26
28
|
description "Use the **windows_shortcut** resource to create shortcut files on Windows."
|
@@ -20,6 +20,8 @@ require_relative "../resource"
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class WindowsUac < Chef::Resource
|
23
|
+
unified_mode true
|
24
|
+
|
23
25
|
provides :windows_uac
|
24
26
|
|
25
27
|
description 'The *windows_uac* resource configures UAC on Windows hosts by setting registry keys at `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System`'
|
@@ -16,7 +16,6 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
require_relative "../resource"
|
19
|
-
require_relative "../mixin/powershell_out"
|
20
19
|
require_relative "../dist"
|
21
20
|
|
22
21
|
class Chef
|
@@ -24,8 +23,6 @@ class Chef
|
|
24
23
|
class WindowsWorkgroup < Chef::Resource
|
25
24
|
provides :windows_workgroup
|
26
25
|
|
27
|
-
include Chef::Mixin::PowershellOut
|
28
|
-
|
29
26
|
description "Use the **windows_workgroup** resource to join or change the workgroup of a Windows host."
|
30
27
|
introduced "14.5"
|
31
28
|
examples <<~DOC
|
@@ -57,6 +54,7 @@ class Chef
|
|
57
54
|
|
58
55
|
property :password, String,
|
59
56
|
description: "The password for the local administrator user. Required if using the `user` property.",
|
57
|
+
sensitive: true,
|
60
58
|
desired_state: false
|
61
59
|
|
62
60
|
property :reboot, Symbol,
|
@@ -83,6 +81,7 @@ class Chef
|
|
83
81
|
end
|
84
82
|
|
85
83
|
# define this again so we can default it to true. Otherwise failures print the password
|
84
|
+
# FIXME: this should now be unnecessary with the password property itself marked sensitive?
|
86
85
|
property :sensitive, [TrueClass, FalseClass],
|
87
86
|
default: true, desired_state: false
|
88
87
|
|
data/lib/chef/role.rb
CHANGED
@@ -256,11 +256,11 @@ class Chef
|
|
256
256
|
|
257
257
|
js_path, rb_path = js_files.first, rb_files.first
|
258
258
|
|
259
|
-
if js_path && File.
|
259
|
+
if js_path && File.exist?(js_path)
|
260
260
|
# from_json returns object.class => json_class in the JSON.
|
261
261
|
hsh = Chef::JSONCompat.parse(IO.read(js_path))
|
262
262
|
return from_hash(hsh)
|
263
|
-
elsif rb_path && File.
|
263
|
+
elsif rb_path && File.exist?(rb_path)
|
264
264
|
role = Chef::Role.new
|
265
265
|
role.name(name)
|
266
266
|
role.from_file(rb_path)
|
@@ -169,17 +169,17 @@ class Chef
|
|
169
169
|
def compile_recipes
|
170
170
|
@events.recipe_load_start(run_list_expansion.recipes.size)
|
171
171
|
run_list_expansion.recipes.each do |recipe|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
172
|
+
|
173
|
+
path = resolve_recipe(recipe)
|
174
|
+
@run_context.load_recipe(recipe)
|
175
|
+
@events.recipe_file_loaded(path, recipe)
|
176
|
+
rescue Chef::Exceptions::RecipeNotFound => e
|
177
|
+
@events.recipe_not_found(e)
|
178
|
+
raise
|
179
|
+
rescue Exception => e
|
180
|
+
@events.recipe_file_load_failed(path, e, recipe)
|
181
|
+
raise
|
182
|
+
|
183
183
|
end
|
184
184
|
@events.recipe_load_complete
|
185
185
|
end
|
@@ -231,14 +231,14 @@ class Chef
|
|
231
231
|
|
232
232
|
def load_libraries_from_cookbook(cookbook_name, globs = "**/*.rb")
|
233
233
|
each_file_in_cookbook_by_segment(cookbook_name, :libraries, globs) do |filename|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
234
|
+
|
235
|
+
logger.trace("Loading cookbook #{cookbook_name}'s library file: #{filename}")
|
236
|
+
Kernel.require(filename)
|
237
|
+
@events.library_file_loaded(filename)
|
238
|
+
rescue Exception => e
|
239
|
+
@events.library_file_load_failed(filename, e)
|
240
|
+
raise
|
241
|
+
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
@@ -325,7 +325,7 @@ class Chef
|
|
325
325
|
|
326
326
|
def count_files_by_segment(segment, root_alias = nil)
|
327
327
|
cookbook_collection.inject(0) do |count, cookbook_by_name|
|
328
|
-
count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).
|
328
|
+
count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).count { |record| record[:name] == root_alias } : 0)
|
329
329
|
end
|
330
330
|
end
|
331
331
|
|
data/lib/chef/run_status.rb
CHANGED
@@ -25,17 +25,13 @@ class Chef::RunStatus
|
|
25
25
|
|
26
26
|
attr_reader :events
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
attr_writer :run_context
|
28
|
+
attr_accessor :run_context
|
31
29
|
|
32
30
|
attr_reader :start_time
|
33
31
|
|
34
32
|
attr_reader :end_time
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
attr_writer :exception
|
34
|
+
attr_accessor :exception
|
39
35
|
|
40
36
|
attr_accessor :run_id
|
41
37
|
|
data/lib/chef/shell.rb
CHANGED
@@ -339,7 +339,7 @@ module Shell
|
|
339
339
|
config[:config_file] = config_file_for_shell_mode(environment)
|
340
340
|
config_msg = config[:config_file] || "none (standalone session)"
|
341
341
|
puts "loading configuration: #{config_msg}"
|
342
|
-
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.
|
342
|
+
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exist?(config[:config_file]) && File.readable?(config[:config_file])
|
343
343
|
Chef::Config.merge!(config)
|
344
344
|
end
|
345
345
|
|
data/lib/chef/util/backup.rb
CHANGED
data/lib/chef/util/diff.rb
CHANGED
@@ -63,7 +63,7 @@ class Chef
|
|
63
63
|
|
64
64
|
def use_tempfile_if_missing(file)
|
65
65
|
tempfile = nil
|
66
|
-
unless File.
|
66
|
+
unless File.exist?(file)
|
67
67
|
Chef::Log.trace("File #{file} does not exist to diff against, using empty tempfile")
|
68
68
|
tempfile = Tempfile.new("chef-diff")
|
69
69
|
file = tempfile.path
|
@@ -106,16 +106,16 @@ class Chef
|
|
106
106
|
# join them. otherwise, print out the old one.
|
107
107
|
old_hunk = hunk = nil
|
108
108
|
diff_data.each do |piece|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
109
|
+
|
110
|
+
hunk = ::Diff::LCS::Hunk.new(old_data, new_data, piece, 3, file_length_difference)
|
111
|
+
file_length_difference = hunk.file_length_difference
|
112
|
+
next unless old_hunk
|
113
|
+
next if hunk.merge(old_hunk)
|
114
|
+
|
115
|
+
diff_str << old_hunk.diff(:unified) << "\n"
|
116
|
+
ensure
|
117
|
+
old_hunk = hunk
|
118
|
+
|
119
119
|
end
|
120
120
|
diff_str << old_hunk.diff(:unified) << "\n"
|
121
121
|
diff_str
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/file.rb
CHANGED
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
def self.symlink?(file_name)
|
79
79
|
is_symlink = false
|
80
80
|
path = encode_path(file_name)
|
81
|
-
if ::File.
|
81
|
+
if ::File.exist?(file_name) || ::File.symlink?(file_name)
|
82
82
|
if (GetFileAttributesW(path) & FILE_ATTRIBUTE_REPARSE_POINT) > 0
|
83
83
|
file_search_handle(file_name) do |handle, find_data|
|
84
84
|
if find_data[:dw_reserved_0] == IO_REPARSE_TAG_SYMLINK
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
# will raise a NotImplementedError, as per MRI.
|
105
105
|
#
|
106
106
|
def self.readlink(link_name)
|
107
|
-
raise Errno::ENOENT, link_name unless ::File.
|
107
|
+
raise Errno::ENOENT, link_name unless ::File.exist?(link_name) || ::File.symlink?(link_name)
|
108
108
|
|
109
109
|
symlink_file_handle(link_name) do |handle|
|
110
110
|
# Go to DeviceIoControl to get the symlink information
|
@@ -49,11 +49,11 @@ class Chef
|
|
49
49
|
SpecialBuild
|
50
50
|
}.each do |method|
|
51
51
|
define_method method do
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
|
53
|
+
get_version_info_string(method.to_s)
|
54
|
+
rescue Chef::Exceptions::Win32APIError
|
55
|
+
return nil
|
56
|
+
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEkjCCA3qgAwIBAgIJAOEDC5RFoEUZMA0GCSqGSIb3DQEBCwUAMIGMMQswCQYD
|
3
3
|
VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHU2VhdHRsZTEN
|
4
4
|
MAsGA1UEChMEQ2hlZjETMBEGA1UECxMKZGV2ZWxvcGVyczESMBAGA1UEAxMJa2Fs
|
5
|
-
|
6
|
-
|
5
|
+
bGlzdGVjMR4wHAYJKoZIhvcNAQkBFg9kYW5Ab3BzY29kZS5jb20wHhcNMjAwODEy
|
6
|
+
MTEyOTUxWhcNMzAwODEwMTEyOTUxWjCBjDELMAkGA1UEBhMCVVMxEzARBgNVBAgT
|
7
7
|
Cldhc2hpbmd0b24xEDAOBgNVBAcTB1NlYXR0bGUxDTALBgNVBAoTBENoZWYxEzAR
|
8
8
|
BgNVBAsTCmRldmVsb3BlcnMxEjAQBgNVBAMTCWthbGxpc3RlYzEeMBwGCSqGSIb3
|
9
9
|
DQEJARYPZGFuQG9wc2NvZGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
@@ -12,16 +12,16 @@ SxuFR7Fnp2OM8ed7iPIKSrcM0vQ+g7vYKCv5Z8UR3sbLY8UHm9AgZ/bLAHEHS2if
|
|
12
12
|
1WHPD5DOe1B7HwW0IfEiW4/WakkVn4uoWw5rCZ87f4YCrETomXIo1n/rMFHf+yoY
|
13
13
|
guuEfGQxRcQdlEZM9YMlMByQvXlVR5IVhpiMHBCyV6KzxjZVCgTlvS8nPMiiHpoO
|
14
14
|
pgB6BGEQ/nn4Kapk40baPqpT4EP/DnBnbhhR3kBQ6MQRlh7bl5vjH5xFSFwGUUA9
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
IcaDTwfliD27bo36aMvcBhrsmbSwqwIDAQABo4H0MIHxMAwGA1UdEwQFMAMBAf8w
|
16
|
+
HQYDVR0OBBYEFLzxnG28b4VO7VT5UUDjt9/PBK1uMIHBBgNVHSMEgbkwgbaAFLzx
|
17
|
+
nG28b4VO7VT5UUDjt9/PBK1uoYGSpIGPMIGMMQswCQYDVQQGEwJVUzETMBEGA1UE
|
18
|
+
CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHU2VhdHRsZTENMAsGA1UEChMEQ2hlZjET
|
19
|
+
MBEGA1UECxMKZGV2ZWxvcGVyczESMBAGA1UEAxMJa2FsbGlzdGVjMR4wHAYJKoZI
|
20
|
+
hvcNAQkBFg9kYW5Ab3BzY29kZS5jb22CCQDhAwuURaBFGTANBgkqhkiG9w0BAQsF
|
21
|
+
AAOCAQEAoTCRzUbZOPrJdpd928fQPt/HsYODDmgWQJIPucdLKmlY5wb3zSc1B5H6
|
22
|
+
zBUmSFylnDLKhZlO+gojBuQDhr2h9bMXn8RvE0A/Dqq9XcNsblMn0HjoJmjv/x8Q
|
23
|
+
wFfrwIWj1wHoGHromkJaedWCRGlVW1oLZa99JmQCNee4bjcwkK2H0xRqX8STbqJV
|
24
|
+
z+uEBf5fDc4EioULwfxa6B15XDD09k14uHtlV6JwTmahDjpdKV/ICKBi/WN0aQg1
|
25
|
+
9k7OAkW5cnzmS6uFFjrvWuNy4ey4j1c4U5GogxEgCsattshHNO+icWRCN2gPg2Nx
|
26
|
+
SKEXNcUA4jRWGF7PRgY/oyjULObFqw==
|
27
27
|
-----END CERTIFICATE-----
|
@@ -27,11 +27,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
27
27
|
# Platform specific validation routines.
|
28
28
|
def service_should_be_started(file_name)
|
29
29
|
# The existence of this file indicates that the service was started.
|
30
|
-
expect(File.
|
30
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
|
31
31
|
end
|
32
32
|
|
33
33
|
def service_should_be_stopped(file_name)
|
34
|
-
expect(File.
|
34
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
|
35
35
|
end
|
36
36
|
|
37
37
|
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
|
@@ -68,12 +68,12 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
before(:all) do
|
71
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
71
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
72
72
|
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
|
73
73
|
end
|
74
74
|
|
75
75
|
after(:all) do
|
76
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
76
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
77
77
|
end
|
78
78
|
|
79
79
|
before(:each) do
|
@@ -165,7 +165,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
165
165
|
end
|
166
166
|
|
167
167
|
after do
|
168
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
168
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
169
169
|
end
|
170
170
|
|
171
171
|
it "creates symlink with status K" do
|
@@ -181,7 +181,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
after do
|
184
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
184
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
185
185
|
end
|
186
186
|
|
187
187
|
it "creates a symlink with status K and a priority" do
|
@@ -198,7 +198,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
after do
|
201
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
201
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
202
202
|
end
|
203
203
|
|
204
204
|
it "create symlink with status stop (K) and a priority " do
|