Class: Chef::Resource::User

Inherits:
Chef::Resource show all
Defined in:
lib/chef/resource/user.rb

Instance Attribute Summary

Attributes inherited from Chef::Resource

#actions, #allowed_actions, #collection, #cookbook_name, #enclosing_provider, #node, #params, #provider, #recipe_name, #resource_name, #source_line, #updated

Instance Method Summary collapse

Methods inherited from Chef::Resource

#action, attribute, build_from_file, #epic_fail, #ignore_failure, #is, json_create, #load_prior_resource, #method_missing, #name, #noop, #not_if, #notifies, #only_if, provider_base, #resources, #run_action, #subscribes, #supports, #to_hash, #to_json, #to_s

Methods included from Mixin::ConvertToClassName

#convert_to_class_name, #filename_to_qualified_string

Methods included from Mixin::Language

#platform?, #value_for_platform

Methods included from Mixin::ParamsValidate

#set_or_return, #validate

Methods included from Mixin::CheckHelper

#set_if_args

Constructor Details

#initialize(name, collection = nil, node = nil) ⇒ User

Returns a new instance of User.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chef/resource/user.rb', line 25

def initialize(name, collection=nil, node=nil)
  super(name, collection, node)
  @resource_name = :user
  @username = name
  @comment = nil
  @uid = nil
  @gid = nil
  @home = nil
  @shell = nil
  @password = nil
  @action = :create
  @supports = { :manage_home => false }
  @allowed_actions.push(:create, :remove, :modify, :manage, :lock, :unlock)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chef::Resource

Instance Method Details

#comment(arg = nil) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/chef/resource/user.rb', line 48

def comment(arg=nil)
  set_or_return(
    :comment,
    arg,
    :kind_of => [ String ]
  )
end

#gid(arg = nil) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/chef/resource/user.rb', line 64

def gid(arg=nil)
  set_or_return(
    :gid,
    arg,
    :kind_of => [ String, Integer ]
  )
end

#home(arg = nil) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/chef/resource/user.rb', line 72

def home(arg=nil)
  set_or_return(
    :home,
    arg,
    :kind_of => [ String ]
  )
end

#password(arg = nil) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/chef/resource/user.rb', line 88

def password(arg=nil)
  set_or_return(
    :password,
    arg,
    :kind_of => [ String ]
  )
end

#shell(arg = nil) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/chef/resource/user.rb', line 80

def shell(arg=nil)
  set_or_return(
    :shell,
    arg,
    :kind_of => [ String ]
  )
end

#uid(arg = nil) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/chef/resource/user.rb', line 56

def uid(arg=nil)
  set_or_return(
    :uid,
    arg,
    :kind_of => [ String, Integer ]
  )
end

#username(arg = nil) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/chef/resource/user.rb', line 40

def username(arg=nil)
  set_or_return(
    :username,
    arg,
    :kind_of => [ String ]
  )
end