summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource.rb24
-rw-r--r--lib/chef/resource/mount.rb16
-rw-r--r--lib/chef/resource/service.rb16
-rw-r--r--lib/chef/resource/user.rb4
4 files changed, 7 insertions, 53 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 40911cd2cc..f9fb5926aa 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -138,7 +138,6 @@ class Chef
@action = self.class.default_action
@updated = false
@updated_by_last_action = false
- @supports = {}
@ignore_failure = false
@retries = 0
@retry_delay = 2
@@ -955,29 +954,6 @@ class Chef
end
#
- # Sets a list of capabilities of the real resource. For example, `:remount`
- # (for filesystems) and `:restart` (for services).
- #
- # TODO Calling resource.supports({}) will not set this to empty; it will do
- # a get instead. That's wrong.
- #
- # @param args Hash{Symbol=>Boolean} If non-empty, sets the capabilities of
- # this resource. Default: {}
- # @return Hash{Symbol=>Boolean} An array of things this resource supports.
- #
- def supports(args = {})
- if args.any?
- @supports = args
- else
- @supports
- end
- end
-
- def supports=(args)
- supports(args)
- end
-
- #
# A hook called after a resource is created. Meant to be overriden by
# subclasses.
#
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb
index 3e35325246..32ffee931b 100644
--- a/lib/chef/resource/mount.rb
+++ b/lib/chef/resource/mount.rb
@@ -1,7 +1,7 @@
#
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2009-2016, Chef Software Inc.
+# Copyright:: Copyright 2009-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,6 +30,9 @@ class Chef
default_action :mount
allowed_actions :mount, :umount, :unmount, :remount, :enable, :disable
+ # this is a poor API please do not re-use this pattern
+ property :supports, Hash, default: { remount: false }
+
def initialize(name, run_context = nil)
super
@mount_point = name
@@ -42,7 +45,6 @@ class Chef
@pass = 2
@mounted = false
@enabled = false
- @supports = { :remount => false }
@username = nil
@password = nil
@domain = nil
@@ -140,16 +142,6 @@ class Chef
)
end
- def supports(args = {})
- if args.is_a? Array
- args.each { |arg| @supports[arg] = true }
- elsif args.any?
- @supports = args
- else
- @supports
- end
- end
-
def username(arg = nil)
set_or_return(
:username,
diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb
index 1ca4b84af0..77c99fbdc6 100644
--- a/lib/chef/resource/service.rb
+++ b/lib/chef/resource/service.rb
@@ -1,7 +1,7 @@
#
# Author:: AJ Christensen (<aj@hjksolutions.com>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software, Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,6 +30,8 @@ class Chef
allowed_actions :enable, :disable, :start, :stop, :restart, :reload,
:mask, :unmask
+ property :supports, Hash, default: { restart: nil, reload: nil, status: nil }
+
def initialize(name, run_context = nil)
super
@service_name = name
@@ -48,7 +50,6 @@ class Chef
@timeout = nil
@run_levels = nil
@user = nil
- @supports = { :restart => nil, :reload => nil, :status => nil }
end
def service_name(arg = nil)
@@ -201,17 +202,6 @@ class Chef
:kind_of => [ String ]
)
end
-
- def supports(args = {})
- if args.is_a? Array
- args.each { |arg| @supports[arg] = true }
- elsif args.any?
- @supports = args
- else
- @supports
- end
- end
-
end
end
end
diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb
index 288335a599..a1e315ef50 100644
--- a/lib/chef/resource/user.rb
+++ b/lib/chef/resource/user.rb
@@ -151,10 +151,6 @@ class Chef
:kind_of => [ TrueClass, FalseClass ]
)
end
-
- def supports(args = {})
- raise Chef::Exceptions::User, "calling supports on a user resource is no longer supported in Chef-13, you probably need to use the manage_home or non_unique properties directly"
- end
end
end
end