Class: Chef::Provider::ChefGroup

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

Instance Method Summary collapse

Instance Method Details

#augment_new_json(json) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/chef/provider/chef_group.rb', line 49

def augment_new_json(json)
  # Apply modifiers
  json['users']   |= new_resource.users
  json['clients'] |= new_resource.clients
  json['groups']  |= new_resource.groups
  json['users']   -= new_resource.remove_users
  json['clients'] -= new_resource.remove_clients
  json['groups']  -= new_resource.remove_groups
  json
end

#data_handlerObject



68
69
70
# File 'lib/chef/provider/chef_group.rb', line 68

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

#keysObject



72
73
74
75
76
77
# File 'lib/chef/provider/chef_group.rb', line 72

def keys
  {
    'name' => :name,
    'groupname' => :name
  }
end

#load_current_resourceObject



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

def load_current_resource
  begin
    @current_resource = json_to_resource(rest.get("groups/#{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



64
65
66
# File 'lib/chef/provider/chef_group.rb', line 64

def resource_class
  Chef::Resource::ChefGroup
end

#whyrun_supported?Boolean

Returns:

  • (Boolean)


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

def whyrun_supported?
  true
end