Class: Chef::Provider::ChefDataBag
- Inherits:
-
Cheffish::ChefProviderBase
- Object
- Cheffish::ChefProviderBase
- Chef::Provider::ChefDataBag
- Defined in:
- lib/chef/provider/chef_data_bag.rb
Instance Method Summary collapse
- #json_to_resource(json) ⇒ Object
- #load_current_resource ⇒ Object
-
#resource_class ⇒ Object
Helpers.
- #whyrun_supported? ⇒ Boolean
Instance Method Details
#json_to_resource(json) ⇒ Object
47 48 49 |
# File 'lib/chef/provider/chef_data_bag.rb', line 47 def json_to_resource(json) Chef::Resource::ChefDataBag.new(json['name']) end |
#load_current_resource ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/chef/provider/chef_data_bag.rb', line 26 def load_current_resource begin @current_resource = json_to_resource(rest.get("data/#{new_resource.name}")) rescue Net::HTTPServerException => e if e.response.code == "404" @current_resource = not_found_resource else raise end end end |
#resource_class ⇒ Object
Helpers
Gives us new_json, current_json, not_found_json, etc.
43 44 45 |
# File 'lib/chef/provider/chef_data_bag.rb', line 43 def resource_class Chef::Resource::ChefDataBag end |
#whyrun_supported? ⇒ Boolean
6 7 8 |
# File 'lib/chef/provider/chef_data_bag.rb', line 6 def whyrun_supported? true end |