class Chef::Resource::ChefDataBag

Public Instance Methods

json_to_resource(json) click to toggle source
# File lib/chef/resource/chef_data_bag.rb, line 47
def json_to_resource(json)
  Chef::Resource::ChefDataBag.new(json["name"], run_context)
end
load_current_resource() click to toggle source
# File lib/chef/resource/chef_data_bag.rb, line 28
def load_current_resource
  @current_resource = json_to_resource(rest.get("data/#{new_resource.data_bag_name}"))
rescue Net::HTTPClientException => e
  if e.response.code == "404"
    @current_resource = not_found_resource
  else
    raise
  end
end
resource_class() click to toggle source

Helpers

Gives us new_json, current_json, not_found_json, etc.

# File lib/chef/resource/chef_data_bag.rb, line 43
def resource_class
  Chef::Resource::ChefDataBag
end