Class: Chef::Provider::ChefRole

Inherits:
Cheffish::ChefProviderBase
  • Object
show all
Defined in:
lib/chef/provider/chef_role.rb

Instance Method Summary collapse

Instance Method Details

#augment_new_json(json) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/chef/provider/chef_role.rb', line 49

def augment_new_json(json)
  # Apply modifiers
  json['run_list'] = apply_run_list_modifiers(new_resource.run_list_modifiers, new_resource.run_list_removers, json['run_list'])
  json['default_attributes'] = apply_modifiers(new_resource.default_attribute_modifiers, json['default_attributes'])
  json['override_attributes'] = apply_modifiers(new_resource.override_attribute_modifiers, json['override_attributes'])
  json
end

#data_handlerObject



65
66
67
# File 'lib/chef/provider/chef_role.rb', line 65

def data_handler
  Chef::ChefFS::DataHandler::RoleDataHandler.new
end

#keysObject



69
70
71
72
73
74
75
76
77
78
# File 'lib/chef/provider/chef_role.rb', line 69

def keys
  {
    'name' => :name,
    'description' => :description,
    'run_list' => :run_list,
    'env_run_lists' => :env_run_lists,
    'default_attributes' => :default_attributes,
    'override_attributes' => :override_attributes
  }
end

#load_current_resourceObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chef/provider/chef_role.rb', line 37

def load_current_resource
  begin
    @current_resource = json_to_resource(rest.get("roles/#{new_resource.name}"))
  rescue Net::HTTPServerException => e
    if e.response.code == "404"
      @current_resource = not_found_resource
    else
      raise
    end
  end
end

#resource_classObject

Helpers



61
62
63
# File 'lib/chef/provider/chef_role.rb', line 61

def resource_class
  Chef::Resource::ChefRole
end

#whyrun_supported?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/chef/provider/chef_role.rb', line 7

def whyrun_supported?
  true
end