Class: Chef::Provider::ChefDataBag
- Inherits:
-
Cheffish::ChefProviderBase
- Object
- LWRPBase
- 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
Methods inherited from Cheffish::ChefProviderBase
#apply_modifiers, #apply_run_list_modifiers, #augment_current_json, #augment_new_json, #current_json, #current_resource_exists?, #json_differences, #json_differences_internal, #new_json, #normalize, #normalize_for_post, #normalize_for_put, #not_found_resource, #resource_to_json, #rest, #same_run_list_item
Instance Method Details
#json_to_resource(json) ⇒ Object
50 51 52 |
# File 'lib/chef/provider/chef_data_bag.rb', line 50 def json_to_resource(json) Chef::Resource::ChefDataBag.new(json['name'], run_context) end |
#load_current_resource ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/chef/provider/chef_data_bag.rb', line 29 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.
46 47 48 |
# File 'lib/chef/provider/chef_data_bag.rb', line 46 def resource_class Chef::Resource::ChefDataBag end |
#whyrun_supported? ⇒ Boolean
9 10 11 |
# File 'lib/chef/provider/chef_data_bag.rb', line 9 def whyrun_supported? true end |