chef 11.14.0.alpha.4 → 11.14.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +0 -4
- data/README.md +1 -1
- data/distro/common/man/man1/chef-shell.1 +4 -4
- data/distro/common/man/man1/knife-bootstrap.1 +14 -11
- data/distro/common/man/man1/knife-client.1 +14 -11
- data/distro/common/man/man1/knife-configure.1 +7 -7
- data/distro/common/man/man1/knife-cookbook-site.1 +23 -23
- data/distro/common/man/man1/knife-cookbook.1 +23 -23
- data/distro/common/man/man1/knife-data-bag.1 +13 -13
- data/distro/common/man/man1/knife-delete.1 +9 -9
- data/distro/common/man/man1/knife-deps.1 +9 -9
- data/distro/common/man/man1/knife-diff.1 +10 -10
- data/distro/common/man/man1/knife-download.1 +9 -9
- data/distro/common/man/man1/knife-edit.1 +7 -7
- data/distro/common/man/man1/knife-environment.1 +10 -10
- data/distro/common/man/man1/knife-exec.1 +7 -7
- data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
- data/distro/common/man/man1/knife-list.1 +12 -12
- data/distro/common/man/man1/knife-node.1 +12 -9
- data/distro/common/man/man1/knife-raw.1 +7 -7
- data/distro/common/man/man1/knife-recipe-list.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +8 -8
- data/distro/common/man/man1/knife-search.1 +9 -9
- data/distro/common/man/man1/knife-serve.1 +109 -0
- data/distro/common/man/man1/knife-show.1 +8 -8
- data/distro/common/man/man1/knife-ssh.1 +9 -9
- data/distro/common/man/man1/knife-ssl-check.1 +9 -9
- data/distro/common/man/man1/knife-ssl-fetch.1 +10 -10
- data/distro/common/man/man1/knife-status.1 +9 -9
- data/distro/common/man/man1/knife-tag.1 +7 -7
- data/distro/common/man/man1/knife-upload.1 +10 -10
- data/distro/common/man/man1/knife-user.1 +9 -9
- data/distro/common/man/man1/knife-xargs.1 +7 -7
- data/distro/common/man/man1/knife.1 +118 -14
- data/distro/common/man/man8/chef-client.8 +13 -10
- data/distro/common/man/man8/chef-solo.8 +13 -14
- data/distro/common/markdown/man1/knife.mkd +1 -1
- data/lib/chef/application/knife.rb +1 -1
- data/lib/chef/application/windows_service.rb +0 -1
- data/lib/chef/chef_fs/file_system.rb +6 -2
- data/lib/chef/config.rb +3 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +20 -14
- data/lib/chef/cookbook/synchronizer.rb +24 -13
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +2 -2
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +1 -1
- data/lib/chef/http.rb +6 -1
- data/lib/chef/http/http_request.rb +9 -1
- data/lib/chef/http/simple.rb +2 -1
- data/lib/chef/json_compat.rb +5 -16
- data/lib/chef/knife/bootstrap.rb +2 -0
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/core/object_loader.rb +3 -1
- data/lib/chef/knife/ssh.rb +14 -7
- data/lib/chef/mixin/convert_to_class_name.rb +1 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +24 -4
- data/lib/chef/platform/provider_mapping.rb +13 -0
- data/lib/chef/provider/env/windows.rb +3 -6
- data/lib/chef/provider/git.rb +1 -2
- data/lib/chef/provider/log.rb +15 -1
- data/lib/chef/provider/package/apt.rb +3 -3
- data/lib/chef/provider/package/dpkg.rb +35 -16
- data/lib/chef/provider/package/paludis.rb +91 -0
- data/lib/chef/provider/package/rpm.rb +3 -2
- data/lib/chef/provider/package/yum-dump.py +6 -6
- data/lib/chef/provider/package/yum.rb +2 -0
- data/lib/chef/provider/registry_key.rb +4 -5
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/upstart.rb +2 -1
- data/lib/chef/provider/service/windows.rb +37 -9
- data/lib/chef/provider/user/pw.rb +1 -1
- data/lib/chef/provider/user/useradd.rb +1 -1
- data/lib/chef/provider/windows_script.rb +2 -1
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource.rb +10 -0
- data/lib/chef/resource/file.rb +0 -9
- data/lib/chef/resource/package.rb +14 -4
- data/lib/chef/resource/paludis_package.rb +33 -0
- data/lib/chef/resource/registry_key.rb +62 -3
- data/lib/chef/resource/service.rb +21 -4
- data/lib/chef/resource_reporter.rb +10 -0
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/role.rb +14 -10
- data/lib/chef/shell.rb +8 -0
- data/lib/chef/shell/shell_session.rb +3 -3
- data/lib/chef/user.rb +12 -11
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_constraint.rb +6 -5
- data/lib/chef/win32/api/process.rb +1 -0
- data/lib/chef/win32/api/system.rb +14 -0
- data/lib/chef/win32/error.rb +1 -1
- data/lib/chef/win32/security.rb +5 -5
- data/lib/chef/win32/version.rb +6 -2
- data/spec/data/trusted_certs/opscode.pem +57 -35
- data/spec/functional/application_spec.rb +2 -2
- data/spec/functional/resource/mount_spec.rb +3 -1
- data/spec/functional/shell_spec.rb +10 -0
- data/spec/functional/tiny_server_spec.rb +2 -2
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +11 -2
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +13 -2
- data/spec/tiny_server.rb +1 -1
- data/spec/unit/config_spec.rb +5 -0
- data/spec/unit/cookbook/metadata_spec.rb +24 -0
- data/spec/unit/environment_spec.rb +6 -0
- data/spec/unit/http/http_request_spec.rb +91 -0
- data/spec/unit/http_spec.rb +23 -0
- data/spec/unit/knife/bootstrap_spec.rb +2 -2
- data/spec/unit/knife/ssh_spec.rb +7 -13
- data/spec/unit/knife_spec.rb +1 -1
- data/spec/unit/mixin/convert_to_class_name_spec.rb +4 -0
- data/spec/unit/provider/git_spec.rb +2 -2
- data/spec/unit/provider/log_spec.rb +18 -0
- data/spec/unit/provider/mount/solaris_spec.rb +3 -1
- data/spec/unit/provider/package/apt_spec.rb +85 -40
- data/spec/unit/provider/package/dpkg_spec.rb +24 -48
- data/spec/unit/provider/package/paludis_spec.rb +135 -0
- data/spec/unit/provider/package/rpm_spec.rb +40 -32
- data/spec/unit/provider/package/yum_spec.rb +11 -4
- data/spec/unit/provider/registry_key_spec.rb +67 -53
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +10 -1
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +23 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +7 -0
- data/spec/unit/provider/service/windows_spec.rb +72 -0
- data/spec/unit/provider/user/pw_spec.rb +21 -4
- data/spec/unit/provider/user/useradd_spec.rb +10 -0
- data/spec/unit/resource/package_spec.rb +26 -18
- data/spec/unit/resource/registry_key_spec.rb +28 -0
- data/spec/unit/resource/service_spec.rb +14 -0
- data/spec/unit/resource_reporter_spec.rb +37 -12
- data/spec/unit/resource_spec.rb +41 -6
- data/spec/unit/rest_spec.rb +2 -2
- data/spec/unit/role_spec.rb +46 -28
- data/spec/unit/shell/shell_session_spec.rb +42 -2
- data/spec/unit/shell_spec.rb +1 -1
- data/spec/unit/user_spec.rb +12 -0
- data/spec/unit/util/selinux_spec.rb +4 -4
- data/spec/unit/version_constraint_spec.rb +14 -2
- metadata +195 -161
- checksums.yaml +0 -7
@@ -42,9 +42,14 @@ class Chef
|
|
42
42
|
@reload_command = nil
|
43
43
|
@init_command = nil
|
44
44
|
@priority = nil
|
45
|
+
@timeout = nil
|
45
46
|
@action = "nothing"
|
46
47
|
@supports = { :restart => false, :reload => false, :status => false }
|
47
48
|
@allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload)
|
49
|
+
|
50
|
+
if(run_context && run_context.node[:init_package] == "systemd")
|
51
|
+
@provider = Chef::Provider::Service::Systemd
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
def service_name(arg=nil)
|
@@ -150,16 +155,28 @@ class Chef
|
|
150
155
|
# similar for other runlevels
|
151
156
|
#
|
152
157
|
def priority(arg=nil)
|
153
|
-
set_or_return(
|
154
|
-
|
155
|
-
|
158
|
+
set_or_return(
|
159
|
+
:priority,
|
160
|
+
arg,
|
161
|
+
:kind_of => [ Integer, String, Hash ]
|
162
|
+
)
|
163
|
+
end
|
164
|
+
|
165
|
+
# timeout only applies to the windows service manager
|
166
|
+
def timeout(arg=nil)
|
167
|
+
set_or_return(
|
168
|
+
:timeout,
|
169
|
+
arg,
|
170
|
+
:kind_of => Integer
|
171
|
+
)
|
156
172
|
end
|
157
173
|
|
158
174
|
def parameters(arg=nil)
|
159
175
|
set_or_return(
|
160
176
|
:parameters,
|
161
177
|
arg,
|
162
|
-
:kind_of => [ Hash ]
|
178
|
+
:kind_of => [ Hash ]
|
179
|
+
)
|
163
180
|
end
|
164
181
|
|
165
182
|
def supports(args={})
|
@@ -47,6 +47,16 @@ class Chef
|
|
47
47
|
report
|
48
48
|
end
|
49
49
|
|
50
|
+
# Future: Some resources store state information that does not convert nicely
|
51
|
+
# to json. We can't call a resource's state method here, since there are conflicts
|
52
|
+
# with some LWRPs, so we can't override a resource's state method to return
|
53
|
+
# json-friendly state data.
|
54
|
+
#
|
55
|
+
# The registry key resource returns json-friendly state data through its state
|
56
|
+
# attribute, and uses a read-only variable for fetching true state data. If
|
57
|
+
# we have conflicts with other resources reporting json incompatible state, we
|
58
|
+
# may want to extend the state_attrs API with the ability to rename POST'd
|
59
|
+
# attrs.
|
50
60
|
def for_json
|
51
61
|
as_hash = {}
|
52
62
|
as_hash["type"] = new_resource.class.dsl_name
|
data/lib/chef/resources.rb
CHANGED
@@ -48,6 +48,7 @@ require 'chef/resource/mount'
|
|
48
48
|
require 'chef/resource/ohai'
|
49
49
|
require 'chef/resource/package'
|
50
50
|
require 'chef/resource/pacman_package'
|
51
|
+
require 'chef/resource/paludis_package'
|
51
52
|
require 'chef/resource/perl'
|
52
53
|
require 'chef/resource/portage_package'
|
53
54
|
require 'chef/resource/powershell_script'
|
data/lib/chef/role.rb
CHANGED
@@ -231,21 +231,25 @@ class Chef
|
|
231
231
|
end
|
232
232
|
|
233
233
|
# Load a role from disk - prefers to load the JSON, but will happily load
|
234
|
-
# the raw rb files as well.
|
235
|
-
def self.from_disk(name
|
234
|
+
# the raw rb files as well. Can search within directories in the role_path.
|
235
|
+
def self.from_disk(name)
|
236
236
|
paths = Array(Chef::Config[:role_path])
|
237
|
+
paths.each do |path|
|
238
|
+
roles_files = Dir.glob(File.join(path, "**", "**"))
|
239
|
+
js_files = roles_files.select { |file| file.match /#{name}\.json$/ }
|
240
|
+
rb_files = roles_files.select { |file| file.match /#{name}\.rb$/ }
|
241
|
+
if js_files.count > 1 or rb_files.count > 1
|
242
|
+
raise Chef::Exceptions::DuplicateRole, "Multiple roles of same type found named #{name}"
|
243
|
+
end
|
244
|
+
js_path, rb_path = js_files.first, rb_files.first
|
237
245
|
|
238
|
-
|
239
|
-
js_file = File.join(p, "#{name}.json")
|
240
|
-
rb_file = File.join(p, "#{name}.rb")
|
241
|
-
|
242
|
-
if File.exists?(js_file) || force == "json"
|
246
|
+
if js_path && File.exists?(js_path)
|
243
247
|
# from_json returns object.class => json_class in the JSON.
|
244
|
-
return Chef::JSONCompat.from_json(IO.read(
|
245
|
-
elsif File.exists?(
|
248
|
+
return Chef::JSONCompat.from_json(IO.read(js_path))
|
249
|
+
elsif rb_path && File.exists?(rb_path)
|
246
250
|
role = Chef::Role.new
|
247
251
|
role.name(name)
|
248
|
-
role.from_file(
|
252
|
+
role.from_file(rb_path)
|
249
253
|
return role
|
250
254
|
end
|
251
255
|
end
|
data/lib/chef/shell.rb
CHANGED
@@ -53,6 +53,7 @@ module Shell
|
|
53
53
|
IRB::ExtendCommandBundle.instance_variable_get(:@ALIASES).delete(irb_help)
|
54
54
|
|
55
55
|
parse_opts
|
56
|
+
Chef::Config[:shell_config] = options.config
|
56
57
|
|
57
58
|
# HACK: this duplicates the functions of IRB.start, but we have to do it
|
58
59
|
# to get access to the main object before irb starts.
|
@@ -111,6 +112,7 @@ module Shell
|
|
111
112
|
conf.prompt_i = "chef#{leader(m)} > "
|
112
113
|
conf.prompt_n = "chef#{leader(m)} ?> "
|
113
114
|
conf.prompt_s = "chef#{leader(m)}%l> "
|
115
|
+
conf.use_tracer = false
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
@@ -257,6 +259,12 @@ FOOTER
|
|
257
259
|
:proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"},
|
258
260
|
:exit => 0
|
259
261
|
|
262
|
+
option :override_runlist,
|
263
|
+
:short => "-o RunlistItem,RunlistItem...",
|
264
|
+
:long => "--override-runlist RunlistItem,RunlistItem...",
|
265
|
+
:description => "Replace current run list with specified items",
|
266
|
+
:proc => lambda { |items| items.split(',').map { |item| Chef::RunList::RunListItem.new(item) }}
|
267
|
+
|
260
268
|
def self.print_help
|
261
269
|
instance = new
|
262
270
|
instance.parse_options([])
|
@@ -151,7 +151,7 @@ module Shell
|
|
151
151
|
|
152
152
|
def rebuild_node
|
153
153
|
Chef::Config[:solo] = true
|
154
|
-
@client = Chef::Client.new
|
154
|
+
@client = Chef::Client.new(nil, Chef::Config[:shell_config])
|
155
155
|
@client.run_ohai
|
156
156
|
@client.load_node
|
157
157
|
@client.build_node
|
@@ -183,7 +183,7 @@ module Shell
|
|
183
183
|
def rebuild_node
|
184
184
|
# Tell the client we're chef solo so it won't try to contact the server
|
185
185
|
Chef::Config[:solo] = true
|
186
|
-
@client = Chef::Client.new
|
186
|
+
@client = Chef::Client.new(nil, Chef::Config[:shell_config])
|
187
187
|
@client.run_ohai
|
188
188
|
@client.load_node
|
189
189
|
@client.build_node
|
@@ -214,7 +214,7 @@ module Shell
|
|
214
214
|
def rebuild_node
|
215
215
|
# Make sure the client knows this is not chef solo
|
216
216
|
Chef::Config[:solo] = false
|
217
|
-
@client = Chef::Client.new
|
217
|
+
@client = Chef::Client.new(nil, Chef::Config[:shell_config])
|
218
218
|
@client.run_ohai
|
219
219
|
@client.register
|
220
220
|
@client.load_node
|
data/lib/chef/user.rb
CHANGED
@@ -144,18 +144,19 @@ class Chef
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def self.list(inflate=false)
|
147
|
-
response =
|
148
|
-
|
149
|
-
|
150
|
-
Chef::User.load(name)
|
151
|
-
end
|
152
|
-
else
|
153
|
-
Chef::REST.new(Chef::Config[:chef_server_url]).get_rest('users')
|
154
|
-
end
|
155
|
-
if response.is_a? Array
|
156
|
-
transform_ohc_list_response(response)
|
147
|
+
response = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest('users')
|
148
|
+
users = if response.is_a?(Array)
|
149
|
+
transform_ohc_list_response(response) # OHC/OPC
|
157
150
|
else
|
158
|
-
response
|
151
|
+
response # OSC
|
152
|
+
end
|
153
|
+
if inflate
|
154
|
+
users.inject({}) do |user_map, (name, _url)|
|
155
|
+
user_map[name] = Chef::User.load(name)
|
156
|
+
user_map
|
157
|
+
end
|
158
|
+
else
|
159
|
+
users
|
159
160
|
end
|
160
161
|
end
|
161
162
|
|
data/lib/chef/util/selinux.rb
CHANGED
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
def restore_security_context(file_path, recursive = false)
|
48
48
|
if restorecon_path
|
49
49
|
restorecon_command = recursive ? "#{restorecon_path} -R -r" : "#{restorecon_path} -R"
|
50
|
-
restorecon_command += " #{file_path}"
|
50
|
+
restorecon_command += " \"#{file_path}\""
|
51
51
|
Chef::Log.debug("Restoring selinux security content with #{restorecon_command}")
|
52
52
|
shell_out!(restorecon_command)
|
53
53
|
else
|
data/lib/chef/version.rb
CHANGED
@@ -21,10 +21,10 @@ class Chef
|
|
21
21
|
DEFAULT_CONSTRAINT = ">= 0.0.0"
|
22
22
|
STANDARD_OPS = %w(< > <= >=)
|
23
23
|
OPS = %w(< > = <= >= ~>)
|
24
|
-
PATTERN = /^(#{OPS.join('|')}) (
|
24
|
+
PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/
|
25
25
|
VERSION_CLASS = Chef::Version
|
26
26
|
|
27
|
-
attr_reader :op, :version
|
27
|
+
attr_reader :op, :version, :raw_version
|
28
28
|
|
29
29
|
def initialize(constraint_spec=DEFAULT_CONSTRAINT)
|
30
30
|
case constraint_spec
|
@@ -99,12 +99,13 @@ class Chef
|
|
99
99
|
@missing_patch_level = false
|
100
100
|
if str.index(" ").nil? && str =~ /^[0-9]/
|
101
101
|
# try for lone version, implied '='
|
102
|
-
@
|
102
|
+
@raw_version = str
|
103
|
+
@version = self.class::VERSION_CLASS.new(@raw_version)
|
103
104
|
@op = "="
|
104
105
|
elsif PATTERN.match str
|
105
106
|
@op = $1
|
106
|
-
raw_version = $2
|
107
|
-
@version = self.class::VERSION_CLASS.new(raw_version)
|
107
|
+
@raw_version = $2
|
108
|
+
@version = self.class::VERSION_CLASS.new(@raw_version)
|
108
109
|
if raw_version.split('.').size <= 2
|
109
110
|
@missing_patch_level = true
|
110
111
|
end
|
@@ -34,6 +34,7 @@ class Chef
|
|
34
34
|
safe_attach_function :GetProcessHandleCount, [ :HANDLE, :LPDWORD ], :BOOL
|
35
35
|
safe_attach_function :GetProcessId, [ :HANDLE ], :DWORD
|
36
36
|
safe_attach_function :CloseHandle, [ :HANDLE ], :BOOL
|
37
|
+
safe_attach_function :IsWow64Process, [ :HANDLE, :PBOOL ], :BOOL
|
37
38
|
|
38
39
|
end
|
39
40
|
end
|
@@ -186,6 +186,20 @@ int WINAPI GetSystemMetrics(
|
|
186
186
|
=end
|
187
187
|
safe_attach_function :GetSystemMetrics, [:int], :int
|
188
188
|
|
189
|
+
=begin
|
190
|
+
LRESULT WINAPI SendMessageTimeout(
|
191
|
+
_In_ HWND hWnd,
|
192
|
+
_In_ UINT Msg,
|
193
|
+
_In_ WPARAM wParam,
|
194
|
+
_In_ LPARAM lParam,
|
195
|
+
_In_ UINT fuFlags,
|
196
|
+
_In_ UINT uTimeout,
|
197
|
+
_Out_opt_ PDWORD_PTR lpdwResult
|
198
|
+
);
|
199
|
+
=end
|
200
|
+
safe_attach_function :SendMessageTimeoutW, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
|
201
|
+
safe_attach_function :SendMessageTimeoutA, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
|
202
|
+
|
189
203
|
end
|
190
204
|
end
|
191
205
|
end
|
data/lib/chef/win32/error.rb
CHANGED
data/lib/chef/win32/security.rb
CHANGED
@@ -262,7 +262,7 @@ class Chef
|
|
262
262
|
system_name = system_name.to_wstring if system_name
|
263
263
|
if LookupAccountNameW(system_name, name.to_wstring, nil, sid_size, nil, referenced_domain_name_size, nil)
|
264
264
|
raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountName, and got no error!"
|
265
|
-
elsif
|
265
|
+
elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
|
266
266
|
Chef::ReservedNames::Win32::Error.raise!
|
267
267
|
end
|
268
268
|
|
@@ -284,7 +284,7 @@ class Chef
|
|
284
284
|
system_name = system_name.to_wstring if system_name
|
285
285
|
if LookupAccountSidW(system_name, sid, nil, name_size, nil, referenced_domain_name_size, nil)
|
286
286
|
raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountSid, and got no error!"
|
287
|
-
elsif
|
287
|
+
elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
|
288
288
|
Chef::ReservedNames::Win32::Error.raise!
|
289
289
|
end
|
290
290
|
|
@@ -303,7 +303,7 @@ class Chef
|
|
303
303
|
name_size = FFI::Buffer.new(:long).write_long(0)
|
304
304
|
if LookupPrivilegeNameW(system_name, luid, nil, name_size)
|
305
305
|
raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeName, and got no error!"
|
306
|
-
elsif
|
306
|
+
elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
|
307
307
|
Chef::ReservedNames::Win32::Error.raise!
|
308
308
|
end
|
309
309
|
|
@@ -321,7 +321,7 @@ class Chef
|
|
321
321
|
language_id = FFI::Buffer.new(:long)
|
322
322
|
if LookupPrivilegeDisplayNameW(system_name, name.to_wstring, nil, display_name_size, language_id)
|
323
323
|
raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeDisplayName, and got no error!"
|
324
|
-
elsif
|
324
|
+
elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
|
325
325
|
Chef::ReservedNames::Win32::Error.raise!
|
326
326
|
end
|
327
327
|
|
@@ -353,7 +353,7 @@ class Chef
|
|
353
353
|
group_size = FFI::Buffer.new(:long).write_long(0)
|
354
354
|
if MakeAbsoluteSD(security_descriptor, nil, absolute_sd_size, nil, dacl_size, nil, sacl_size, nil, owner_size, nil, group_size)
|
355
355
|
raise "Expected ERROR_INSUFFICIENT_BUFFER from MakeAbsoluteSD, and got no error!"
|
356
|
-
elsif
|
356
|
+
elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
|
357
357
|
Chef::ReservedNames::Win32::Error.raise!
|
358
358
|
end
|
359
359
|
|
data/lib/chef/win32/version.rb
CHANGED
@@ -23,6 +23,10 @@ require 'wmi-lite/wmi'
|
|
23
23
|
class Chef
|
24
24
|
module ReservedNames::Win32
|
25
25
|
class Version
|
26
|
+
class << self
|
27
|
+
include Chef::ReservedNames::Win32::API::System
|
28
|
+
end
|
29
|
+
|
26
30
|
include Chef::ReservedNames::Win32::API::Macros
|
27
31
|
include Chef::ReservedNames::Win32::API::System
|
28
32
|
|
@@ -33,12 +37,12 @@ class Chef
|
|
33
37
|
private
|
34
38
|
|
35
39
|
def self.get_system_metrics(n_index)
|
36
|
-
|
40
|
+
GetSystemMetrics(n_index)
|
37
41
|
end
|
38
42
|
|
39
43
|
def self.method_name_from_marketing_name(marketing_name)
|
40
44
|
"#{marketing_name.gsub(/\s/, '_').gsub(/\./, '_').downcase}?"
|
41
|
-
# "#{marketing_name.gsub(/\s/, '_').gsub(//, '_').downcase}?"
|
45
|
+
# "#{marketing_name.gsub(/\s/,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