chef 12.16.42-universal-mingw32 → 12.17.44-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 +2 -1
- data/README.md +20 -5
- data/Rakefile +17 -0
- data/VERSION +1 -1
- data/acceptance/Gemfile.lock +32 -23
- data/distro/common/markdown/man1/knife-configure.mkd +3 -2
- data/lib-backcompat/chef/chef_fs/file_system/already_exists_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/cookbook_frozen_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/file_system_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/must_delete_recursively_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/not_found_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/operation_failed_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/operation_not_allowed_error.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb +1 -1
- data/lib-backcompat/chef/chef_fs/file_system/repository/file_system_root_dir.rb +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -3
- data/lib/chef/chef_class.rb +15 -5
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +12 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +19 -0
- data/lib/chef/client.rb +1 -0
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/cookbook_version.rb +4 -4
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/data_collector.rb +20 -13
- data/lib/chef/data_collector/messages.rb +0 -1
- data/lib/chef/data_collector/messages/helpers.rb +2 -2
- data/lib/chef/decorator/unchain.rb +2 -2
- data/lib/chef/deprecated.rb +190 -0
- data/lib/chef/deprecation/provider/remote_directory.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +3 -4
- data/lib/chef/dsl/method_missing.rb +2 -2
- data/lib/chef/dsl/resources.rb +2 -2
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/formatters/base.rb +11 -1
- data/lib/chef/formatters/doc.rb +13 -4
- data/lib/chef/key.rb +1 -1
- data/lib/chef/knife/client_delete.rb +12 -9
- data/lib/chef/knife/configure.rb +1 -1
- data/lib/chef/knife/core/bootstrap_context.rb +25 -1
- data/lib/chef/knife/core/subcommand_loader.rb +3 -3
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/node_delete.rb +6 -6
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mixin/deprecation.rb +4 -10
- data/lib/chef/mixin/powershell_type_coercions.rb +19 -19
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node/attribute.rb +3 -4
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/mixin/state_tracking.rb +5 -2
- data/lib/chef/node_map.rb +2 -2
- data/lib/chef/org.rb +1 -1
- data/lib/chef/platform/rebooter.rb +3 -1
- data/lib/chef/policy_builder/expand_node_object.rb +1 -1
- data/lib/chef/property.rb +5 -5
- data/lib/chef/provider.rb +4 -4
- data/lib/chef/provider/launchd.rb +1 -1
- data/lib/chef/provider/link.rb +6 -0
- data/lib/chef/provider/mount.rb +2 -0
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/ohai.rb +5 -3
- data/lib/chef/provider/package/cab.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +2 -2
- data/lib/chef/provider/package/easy_install.rb +2 -2
- data/lib/chef/provider/package/msu.rb +162 -0
- data/lib/chef/provider/package/powershell.rb +114 -0
- data/lib/chef/provider/package/yum.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +6 -7
- data/lib/chef/provider_resolver.rb +2 -2
- data/lib/chef/providers.rb +2 -0
- data/lib/chef/resource.rb +3 -5
- data/lib/chef/resource/apt_update.rb +1 -1
- data/lib/chef/resource/chef_gem.rb +2 -3
- data/lib/chef/resource/file/verification.rb +1 -1
- data/lib/chef/resource/launchd.rb +48 -8
- data/lib/chef/resource/mount.rb +1 -1
- data/lib/chef/resource/msu_package.rb +47 -0
- data/lib/chef/resource/ohai.rb +5 -25
- data/lib/chef/resource/powershell_package.rb +41 -0
- data/lib/chef/resource/reboot.rb +1 -1
- data/lib/chef/resource/user.rb +2 -2
- data/lib/chef/resource_builder.rb +4 -4
- data/lib/chef/resource_resolver.rb +2 -3
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/rest.rb +1 -1
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/user.rb +3 -3
- data/lib/chef/user_v1.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/security.rb +12 -12
- data/spec/data/sample_msu1.xml +10 -0
- data/spec/data/sample_msu2.xml +14 -0
- data/spec/data/sample_msu3.xml +16 -0
- data/spec/functional/rebooter_spec.rb +3 -3
- data/spec/functional/resource/link_spec.rb +62 -1
- data/spec/functional/resource/msu_package_spec.rb +84 -0
- data/spec/functional/resource/registry_spec.rb +3 -3
- data/spec/functional/resource/rpm_spec.rb +7 -10
- data/spec/integration/solo/solo_spec.rb +50 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/platform_helpers.rb +16 -8
- data/spec/unit/application/exit_code_spec.rb +3 -15
- data/spec/unit/data_collector_spec.rb +6 -16
- data/spec/unit/deprecated_spec.rb +59 -0
- data/spec/unit/deprecation_spec.rb +1 -8
- data/spec/unit/handler_spec.rb +2 -2
- data/spec/unit/knife/client_delete_spec.rb +16 -0
- data/spec/unit/knife/configure_spec.rb +1 -1
- data/spec/unit/knife/cookbook_metadata_spec.rb +116 -113
- data/spec/unit/knife/core/bootstrap_context_spec.rb +55 -5
- data/spec/unit/knife/node_delete_spec.rb +19 -10
- data/spec/unit/mixin/shell_out_spec.rb +0 -1
- data/spec/unit/node/immutable_collections_spec.rb +5 -0
- data/spec/unit/node/vivid_mash_spec.rb +11 -0
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/provider/launchd_spec.rb +81 -3
- data/spec/unit/provider/mount/mount_spec.rb +1 -1
- data/spec/unit/provider/mount_spec.rb +7 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +5 -5
- data/spec/unit/provider/package/easy_install_spec.rb +6 -6
- data/spec/unit/provider/package/msu_spec.rb +283 -0
- data/spec/unit/provider/package/powershell_spec.rb +337 -0
- data/spec/unit/provider/service/macosx_spec.rb +1 -1
- data/spec/unit/provider/subversion_spec.rb +9 -0
- data/spec/unit/provider/user/linux_spec.rb +7 -1
- data/spec/unit/recipe_spec.rb +43 -11
- data/spec/unit/resource/apt_update_spec.rb +17 -25
- data/spec/unit/resource/file/verification_spec.rb +1 -1
- data/spec/unit/resource/mount_spec.rb +2 -1
- data/spec/unit/resource/msu_package_spec.rb +49 -0
- data/spec/unit/resource/ohai_spec.rb +1 -1
- data/spec/unit/resource/powershell_package_spec.rb +68 -0
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/run_status_spec.rb +1 -1
- data/tasks/announce.rb +58 -0
- data/tasks/changelog.rb +26 -6
- data/tasks/templates/prerelease.md.erb +35 -0
- data/tasks/templates/release.md.erb +34 -0
- metadata +21 -4
@@ -197,7 +197,7 @@ class Chef
|
|
197
197
|
Chef::Log.debug("#{@new_resource} checking rpm status")
|
198
198
|
shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}", :timeout => Chef::Config[:yum_timeout]).stdout.each_line do |line|
|
199
199
|
case line
|
200
|
-
when
|
200
|
+
when /^(\S+)\s(\S+)$/
|
201
201
|
@current_resource.package_name($1)
|
202
202
|
@new_resource.version($2)
|
203
203
|
end
|
@@ -76,18 +76,17 @@ class Chef
|
|
76
76
|
end
|
77
77
|
|
78
78
|
action :delete do
|
79
|
+
# clean the repo cache first
|
80
|
+
declare_resource(:execute, "yum clean all #{new_resource.repositoryid}") do
|
81
|
+
command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
82
|
+
only_if "yum repolist all | grep -P '^#{new_resource.repositoryid}([ \t]|$)'"
|
83
|
+
end
|
84
|
+
|
79
85
|
declare_resource(:file, "/etc/yum.repos.d/#{new_resource.repositoryid}.repo") do
|
80
86
|
action :delete
|
81
|
-
notifies :run, "execute[yum clean all #{new_resource.repositoryid}]", :immediately
|
82
87
|
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
|
83
88
|
end
|
84
89
|
|
85
|
-
declare_resource(:execute, "yum clean all #{new_resource.repositoryid}") do
|
86
|
-
command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
87
|
-
only_if "yum repolist | grep -P '^#{new_resource.repositoryid}([ \t]|$)'"
|
88
|
-
action :nothing
|
89
|
-
end
|
90
|
-
|
91
90
|
declare_resource(:ruby_block, "yum-cache-reload-#{new_resource.repositoryid}") do
|
92
91
|
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
|
93
92
|
action :nothing
|
@@ -157,8 +157,8 @@ class Chef
|
|
157
157
|
# perf concern otherwise.)
|
158
158
|
handlers = providers.select { |handler| overrode_provides?(handler) && handler.provides?(node, resource) }
|
159
159
|
handlers.each do |handler|
|
160
|
-
|
161
|
-
Chef.
|
160
|
+
message = "#{handler}.provides? returned true when asked if it provides DSL #{resource.resource_name}, but provides #{resource.resource_name.inspect} was never called! In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself."
|
161
|
+
Chef.deprecated(:custom_resource, message)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
handlers
|
data/lib/chef/providers.rb
CHANGED
@@ -84,6 +84,8 @@ require "chef/provider/package/solaris"
|
|
84
84
|
require "chef/provider/package/smartos"
|
85
85
|
require "chef/provider/package/aix"
|
86
86
|
require "chef/provider/package/cab"
|
87
|
+
require "chef/provider/package/powershell"
|
88
|
+
require "chef/provider/package/msu"
|
87
89
|
|
88
90
|
require "chef/provider/service/arch"
|
89
91
|
require "chef/provider/service/freebsd"
|
data/lib/chef/resource.rb
CHANGED
@@ -925,9 +925,7 @@ class Chef
|
|
925
925
|
# @deprecated Multiple actions are supported by resources. Please call {}#updated_by_last_action} instead.
|
926
926
|
#
|
927
927
|
def updated=(true_or_false)
|
928
|
-
Chef
|
929
|
-
Chef::Log.warn("Called from:")
|
930
|
-
caller[0..3].each { |line| Chef::Log.warn(line) }
|
928
|
+
Chef.deprecated(:custom_resource, "Chef::Resource#updated=(true|false) is deprecated. Please call #updated_by_last_action(true|false) instead.")
|
931
929
|
updated_by_last_action(true_or_false)
|
932
930
|
@updated = true_or_false
|
933
931
|
end
|
@@ -982,7 +980,7 @@ class Chef
|
|
982
980
|
# @deprecated Use resource_name instead.
|
983
981
|
#
|
984
982
|
def self.dsl_name
|
985
|
-
Chef.
|
983
|
+
Chef.deprecated(:custom_resource, "Resource.dsl_name is deprecated and will be removed in Chef 13. Use resource_name instead.")
|
986
984
|
if name
|
987
985
|
name = self.name.split("::")[-1]
|
988
986
|
convert_to_snake_case(name)
|
@@ -1060,7 +1058,7 @@ class Chef
|
|
1060
1058
|
#
|
1061
1059
|
def self.provider_base(arg = nil)
|
1062
1060
|
if arg
|
1063
|
-
Chef.
|
1061
|
+
Chef.deprecated(:custom_resource, "Resource.provider_base is deprecated and will be removed in Chef 13. Use provides on the provider, or provider on the resource, instead.")
|
1064
1062
|
end
|
1065
1063
|
@provider_base ||= arg || Chef::Provider
|
1066
1064
|
end
|
@@ -34,9 +34,8 @@ class Chef
|
|
34
34
|
# Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled
|
35
35
|
# Action could be an array of symbols, but probably won't (think install + enable for a package)
|
36
36
|
if compile_time.nil?
|
37
|
-
|
38
|
-
Chef.
|
39
|
-
Chef.log_deprecation "#{self} or set `compile_time true` on the resource if compile_time behavior is required."
|
37
|
+
message = "#{self} chef_gem compile_time installation is deprecated. Please set `compile_time false` on the resource to use the new behavior, or set `compile_time true` on the resource if compile_time behavior is required."
|
38
|
+
Chef.deprecated :chef_gem_compile_time, message
|
40
39
|
end
|
41
40
|
|
42
41
|
if compile_time || compile_time.nil?
|
@@ -108,7 +108,7 @@ class Chef
|
|
108
108
|
def verify_command(path, opts)
|
109
109
|
# First implementation interpolated `file`; docs & RFC claim `path`
|
110
110
|
# is interpolated. Until `file` can be deprecated, interpolate both.
|
111
|
-
Chef.
|
111
|
+
Chef.deprecated(:verify_file,
|
112
112
|
"%{file} is deprecated in verify command and will not be "\
|
113
113
|
"supported in Chef 13. Please use %{path} instead."
|
114
114
|
) if @command.include?("%{file}")
|
@@ -29,12 +29,6 @@ class Chef
|
|
29
29
|
default_action :create
|
30
30
|
allowed_actions :create, :create_if_missing, :delete, :enable, :disable
|
31
31
|
|
32
|
-
def initialize(name, run_context = nil)
|
33
|
-
super
|
34
|
-
provider = Chef::Provider::Launchd
|
35
|
-
resource_name = :launchd
|
36
|
-
end
|
37
|
-
|
38
32
|
property :label, String, default: lazy { name }, identity: true
|
39
33
|
property :backup, [Integer, FalseClass]
|
40
34
|
property :cookbook, String
|
@@ -46,6 +40,53 @@ class Chef
|
|
46
40
|
property :source, String
|
47
41
|
property :session_type, String
|
48
42
|
|
43
|
+
# StartCalendarInterval has some gotchas so we coerce it to help sanity
|
44
|
+
# check. According to `man 5 launchd.plist`:
|
45
|
+
# StartCalendarInterval <dictionary of integers or array of dictionaries of integers>
|
46
|
+
# ... Missing arguments are considered to be wildcard.
|
47
|
+
# What the man page doesn't state, but what was observed (OSX 10.11.5, launchctrl v3.4.0)
|
48
|
+
# Is that keys that are specified, but invalid, will also be treated as a wildcard
|
49
|
+
# this means that an entry like:
|
50
|
+
# { "Hour"=>0, "Weekday"=>"6-7"}
|
51
|
+
# will not just run on midnight of Sat and Sun, rather it will run _every_ midnight.
|
52
|
+
property :start_calendar_interval, [Hash, Array], coerce: proc { |type|
|
53
|
+
# Coerce into an array of hashes to make validation easier
|
54
|
+
array = if type.is_a?(Array)
|
55
|
+
type
|
56
|
+
else
|
57
|
+
[type]
|
58
|
+
end
|
59
|
+
|
60
|
+
# Check to make sure that our array only has hashes
|
61
|
+
unless array.all? { |obj| obj.is_a?(Hash) }
|
62
|
+
error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
|
63
|
+
raise Chef::Exceptions::ValidationFailed, error_msg
|
64
|
+
end
|
65
|
+
|
66
|
+
# Make sure the hashes don't have any incorrect keys/values
|
67
|
+
array.each do |entry|
|
68
|
+
allowed_keys = %w{Minute Hour Day Weekday Month}
|
69
|
+
unless entry.keys.all? { |key| allowed_keys.include?(key) }
|
70
|
+
failed_keys = entry.keys.reject { |k| allowed_keys.include?(k) }.join(", ")
|
71
|
+
error_msg = "The following key(s): #{failed_keys} are invalid for start_calendar_interval, must be one of: #{allowed_keys.join(", ")}"
|
72
|
+
raise Chef::Exceptions::ValidationFailed, error_msg
|
73
|
+
end
|
74
|
+
|
75
|
+
unless entry.values.all? { |val| val.is_a?(Integer) }
|
76
|
+
failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
|
77
|
+
error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
|
78
|
+
raise Chef::Exceptions::ValidationFailed, error_msg
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Don't return array if we only have one entry
|
83
|
+
if array.size == 1
|
84
|
+
array.first
|
85
|
+
else
|
86
|
+
array
|
87
|
+
end
|
88
|
+
}
|
89
|
+
|
49
90
|
property :type, String, default: "daemon", coerce: proc { |type|
|
50
91
|
type = type ? type.downcase : "daemon"
|
51
92
|
types = %w{daemon agent}
|
@@ -73,7 +114,7 @@ class Chef
|
|
73
114
|
property :ld_group, String
|
74
115
|
property :limit_load_from_hosts, Array
|
75
116
|
property :limit_load_to_hosts, Array
|
76
|
-
property :limit_load_to_session_type,
|
117
|
+
property :limit_load_to_session_type, Array
|
77
118
|
property :low_priority_io, [ TrueClass, FalseClass ]
|
78
119
|
property :mach_services, Hash
|
79
120
|
property :nice, Integer
|
@@ -89,7 +130,6 @@ class Chef
|
|
89
130
|
property :standard_error_path, String
|
90
131
|
property :standard_in_path, String
|
91
132
|
property :standard_out_path, String
|
92
|
-
property :start_calendar_interval, Hash
|
93
133
|
property :start_interval, Integer
|
94
134
|
property :start_on_mount, [ TrueClass, FalseClass ]
|
95
135
|
property :throttle_interval, Integer
|
data/lib/chef/resource/mount.rb
CHANGED
@@ -28,7 +28,7 @@ class Chef
|
|
28
28
|
state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain
|
29
29
|
|
30
30
|
default_action :mount
|
31
|
-
allowed_actions :mount, :umount, :remount, :enable, :disable
|
31
|
+
allowed_actions :mount, :umount, :unmount, :remount, :enable, :disable
|
32
32
|
|
33
33
|
def initialize(name, run_context = nil)
|
34
34
|
super
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
|
3
|
+
# Copyright:: Copyright 2008-2016, Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/resource/package"
|
20
|
+
require "chef/mixin/uris"
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
class Resource
|
24
|
+
class MsuPackage < Chef::Resource::Package
|
25
|
+
include Chef::Mixin::Uris
|
26
|
+
|
27
|
+
provides :msu_package, os: "windows"
|
28
|
+
|
29
|
+
allowed_actions :install, :remove
|
30
|
+
|
31
|
+
def initialize(name, run_context = nil)
|
32
|
+
super
|
33
|
+
@resource_name = :msu_package
|
34
|
+
@source = name
|
35
|
+
@action = :install
|
36
|
+
end
|
37
|
+
|
38
|
+
property :source, String,
|
39
|
+
coerce: (proc do |s|
|
40
|
+
unless s.nil?
|
41
|
+
uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
|
42
|
+
end
|
43
|
+
end)
|
44
|
+
property :checksum, String, desired_state: false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/chef/resource/ohai.rb
CHANGED
@@ -20,34 +20,14 @@
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class Ohai < Chef::Resource
|
23
|
+
resource_name :ohai
|
24
|
+
provides :ohai
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
state_attrs :plugin
|
26
|
+
property :ohai_name, name_property: true
|
27
|
+
property :plugin, [String]
|
27
28
|
|
28
29
|
default_action :reload
|
29
|
-
|
30
|
-
def initialize(name, run_context = nil)
|
31
|
-
super
|
32
|
-
@name = name
|
33
|
-
@plugin = nil
|
34
|
-
end
|
35
|
-
|
36
|
-
def plugin(arg = nil)
|
37
|
-
set_or_return(
|
38
|
-
:plugin,
|
39
|
-
arg,
|
40
|
-
:kind_of => [ String ]
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
def name(arg = nil)
|
45
|
-
set_or_return(
|
46
|
-
:name,
|
47
|
-
arg,
|
48
|
-
:kind_of => [ String ]
|
49
|
-
)
|
50
|
-
end
|
30
|
+
allowed_actions :reload
|
51
31
|
end
|
52
32
|
end
|
53
33
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Author:: Dheeraj Dubey(dheeraj.dubey@msystechnologies.com)
|
2
|
+
# Copyright:: Copyright 2008-2016, 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 "chef/resource/package"
|
19
|
+
require "chef/mixin/uris"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class PowershellPackage < Chef::Resource::Package
|
24
|
+
include Chef::Mixin::Uris
|
25
|
+
|
26
|
+
provides :powershell_package, os: "windows"
|
27
|
+
|
28
|
+
allowed_actions :install, :remove
|
29
|
+
|
30
|
+
def initialize(name, run_context = nil)
|
31
|
+
super
|
32
|
+
@resource_name = :powershell_package
|
33
|
+
end
|
34
|
+
|
35
|
+
property :package_name, [String, Array], coerce: proc { |x| [x].flatten }
|
36
|
+
|
37
|
+
property :version, [String, Array], coerce: proc { |x| [x].flatten }
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/chef/resource/reboot.rb
CHANGED
data/lib/chef/resource/user.rb
CHANGED
@@ -158,10 +158,10 @@ class Chef
|
|
158
158
|
|
159
159
|
def supports(args = {})
|
160
160
|
if args.key?(:manage_home)
|
161
|
-
Chef.
|
161
|
+
Chef.deprecated(:supports_property, "supports { manage_home: #{args[:manage_home]} } on the user resource is deprecated and will be removed in Chef 13, set manage_home #{args[:manage_home]} instead")
|
162
162
|
end
|
163
163
|
if args.key?(:non_unique)
|
164
|
-
Chef.
|
164
|
+
Chef.deprecated(:supports_property, "supports { non_unique: #{args[:non_unique]} } on the user resource is deprecated and will be removed in Chef 13, set non_unique #{args[:non_unique]} instead")
|
165
165
|
end
|
166
166
|
super
|
167
167
|
end
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
# This behavior is very counter-intuitive and should be removed.
|
57
57
|
# See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694
|
58
58
|
# Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052
|
59
|
-
if prior_resource
|
59
|
+
if prior_resource && Chef::Config[:resource_cloning]
|
60
60
|
resource.load_from(prior_resource)
|
61
61
|
end
|
62
62
|
|
@@ -80,7 +80,7 @@ class Chef
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# emit a cloned resource warning if it is warranted
|
83
|
-
if prior_resource
|
83
|
+
if prior_resource && Chef::Config[:resource_cloning]
|
84
84
|
if is_trivial_resource?(prior_resource) && identicalish_resources?(prior_resource, resource)
|
85
85
|
emit_harmless_cloning_debug
|
86
86
|
else
|
@@ -128,10 +128,10 @@ class Chef
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def emit_cloned_resource_warning
|
131
|
-
message = "Cloning resource attributes for #{resource} from prior resource
|
131
|
+
message = "Cloning resource attributes for #{resource} from prior resource"
|
132
132
|
message << "\nPrevious #{prior_resource}: #{prior_resource.source_line}" if prior_resource.source_line
|
133
133
|
message << "\nCurrent #{resource}: #{resource.source_line}" if resource.source_line
|
134
|
-
Chef.
|
134
|
+
Chef.deprecated(:resource_cloning, message)
|
135
135
|
end
|
136
136
|
|
137
137
|
def emit_harmless_cloning_debug
|
@@ -55,7 +55,7 @@ class Chef
|
|
55
55
|
attr_reader :resource_name
|
56
56
|
# @api private
|
57
57
|
def resource
|
58
|
-
Chef.
|
58
|
+
Chef.deprecated(:custom_resource, "Chef::ResourceResolver.resource deprecated. Use resource_name instead.")
|
59
59
|
resource_name
|
60
60
|
end
|
61
61
|
# @api private
|
@@ -173,8 +173,7 @@ class Chef
|
|
173
173
|
if handlers.empty?
|
174
174
|
handlers = resources.select { |handler| overrode_provides?(handler) && handler.provides?(node, resource_name) }
|
175
175
|
handlers.each do |handler|
|
176
|
-
Chef.
|
177
|
-
Chef.log_deprecation("In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.")
|
176
|
+
Chef.deprecated(:custom_resource, "#{handler}.provides? returned true when asked if it provides DSL #{resource_name}, but provides #{resource_name.inspect} was never called! In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.")
|
178
177
|
end
|
179
178
|
end
|
180
179
|
handlers
|
data/lib/chef/resources.rb
CHANGED
data/lib/chef/rest.rb
CHANGED
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
# http://localhost:4000, a call to +get_rest+ with 'nodes' will make an
|
60
60
|
# HTTP GET request to http://localhost:4000/nodes
|
61
61
|
def initialize(url, client_name = Chef::Config[:node_name], signing_key_filename = Chef::Config[:client_key], options = {})
|
62
|
-
Chef.
|
62
|
+
Chef.deprecated(:chef_rest, "Chef::REST is deprecated. Please use Chef::ServerAPI, or investigate Ridley or ChefAPI.")
|
63
63
|
|
64
64
|
signing_key_filename = nil if chef_zero_uri?(url)
|
65
65
|
|
data/lib/chef/role.rb
CHANGED
@@ -170,7 +170,7 @@ class Chef
|
|
170
170
|
|
171
171
|
# Create a Chef::Role from JSON
|
172
172
|
def self.json_create(o)
|
173
|
-
Chef.
|
173
|
+
Chef.deprecated(:json_auto_inflate, "Auto inflation of JSON data is deprecated. Please use Chef::Role#from_hash")
|
174
174
|
from_hash(o)
|
175
175
|
end
|
176
176
|
|
data/lib/chef/run_context.rb
CHANGED
@@ -581,17 +581,17 @@ ERROR_MESSAGE
|
|
581
581
|
# These need to be settable so deploy can run a resource_collection
|
582
582
|
# independent of any cookbooks via +recipe_eval+
|
583
583
|
def audits=(value)
|
584
|
-
Chef.
|
584
|
+
Chef.deprecated(:internal_api, "Setting run_context.audits will be removed in a future Chef. Use run_context.create_child to create a new RunContext instead.")
|
585
585
|
@audits = value
|
586
586
|
end
|
587
587
|
|
588
588
|
def immediate_notification_collection=(value)
|
589
|
-
Chef.
|
589
|
+
Chef.deprecated(:internal_api, "Setting run_context.immediate_notification_collection will be removed in a future Chef. Use run_context.create_child to create a new RunContext instead.")
|
590
590
|
@immediate_notification_collection = value
|
591
591
|
end
|
592
592
|
|
593
593
|
def delayed_notification_collection=(value)
|
594
|
-
Chef.
|
594
|
+
Chef.deprecated(:internal_api, "Setting run_context.delayed_notification_collection will be removed in a future Chef. Use run_context.create_child to create a new RunContext instead.")
|
595
595
|
@delayed_notification_collection = value
|
596
596
|
end
|
597
597
|
end
|