summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorAdam Leff <adam@leff.co>2016-12-02 15:07:55 -0500
committerAdam Leff <adam@leff.co>2016-12-02 15:10:20 -0500
commitb3d2b5b6ee62045d391a99752b9b038b01627e91 (patch)
tree9d2e771a35d56c8c2b9fe6531e2905319b8d0320 /lib/chef/resource
parent88269ebd629775c625b121709991ebc76d9c0fa4 (diff)
downloadchef-b3d2b5b6ee62045d391a99752b9b038b01627e91.tar.gz
Update ohai resource to new style, stop overwriting name propertyadamleff/update-ohai-resource
If #5606 is approved, any resource that creates a property that is an already-existing Ruby method on a Chef::Resource object will throw a deprecation warning. The ohai resource currently creates a `name` property which conflicts with the `name` property created in the base Chef::Resource class. This change updates the ohai resource and provider to the new style of defining resources and stops overwriting the `name` method. Signed-off-by: Adam Leff <adam@leff.co>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/ohai.rb30
1 files changed, 5 insertions, 25 deletions
diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb
index 09cd22efc5..6fffecf16e 100644
--- a/lib/chef/resource/ohai.rb
+++ b/lib/chef/resource/ohai.rb
@@ -20,34 +20,14 @@
class Chef
class Resource
class Ohai < Chef::Resource
+ resource_name :ohai
+ provides :ohai
- identity_attr :name
-
- state_attrs :plugin
+ property :ohai_name, name_property: true
+ property :plugin, [String]
default_action :reload
-
- def initialize(name, run_context = nil)
- super
- @name = name
- @plugin = nil
- end
-
- def plugin(arg = nil)
- set_or_return(
- :plugin,
- arg,
- :kind_of => [ String ]
- )
- end
-
- def name(arg = nil)
- set_or_return(
- :name,
- arg,
- :kind_of => [ String ]
- )
- end
+ allowed_actions :reload
end
end
end