Update the mediawiki cookbook and upstream cookbooks

Compatibility with Chef 14
This commit is contained in:
Greg Karékinian
2019-04-08 11:20:12 +02:00
parent 6e3e8cde1b
commit 777b85c2ab
312 changed files with 5603 additions and 14219 deletions

View File

@@ -3,8 +3,8 @@
# Cookbook:: windows
# Resource:: auto_run
#
# Copyright:: 2011-2017, Business Intelligence Associates, Inc.
# Copyright:: 2017, Chef Software, Inc.
# Copyright:: 2011-2018, Business Intelligence Associates, Inc.
# Copyright:: 2017-2018, Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,28 +19,48 @@
# limitations under the License.
#
property :program, String
property :name, String, name_property: true
chef_version_for_provides '< 14.0' if respond_to?(:chef_version_for_provides)
resource_name :windows_auto_run
property :program_name, String, name_property: true
property :path, String, coerce: proc { |x| x.tr('/', '\\') }
property :args, String
property :root, Symbol,
equal_to: %i(machine user),
default: :machine
alias_method :program, :path
action :create do
registry_key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' do
data = "\"#{new_resource.path}\""
data << " #{new_resource.args}" if new_resource.args
registry_key registry_path do
values [{
name: new_resource.name,
name: new_resource.program_name,
type: :string,
data: "\"#{new_resource.program}\" #{new_resource.args}",
data: data,
}]
action :create
end
end
action :remove do
registry_key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' do
registry_key registry_path do
values [{
name: new_resource.name,
name: new_resource.program_name,
type: :string,
data: '',
}]
action :delete
end
end
action_class do
# determine the full registry path based on the root property
# @return [String]
def registry_path
{ machine: 'HKLM', user: 'HKCU' }[new_resource.root] + \
'\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run'
end
end