Class: Wright::Resource::User
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::User
- Defined in:
- lib/wright/resource/user.rb
Overview
User resource, represents a user.
Instance Attribute Summary collapse
-
#full_name ⇒ String
The user’s intended full name.
-
#groups ⇒ Array<String>
The user’s intended groups.
-
#home ⇒ String
(also: #homedir)
The user’s intended home directory path.
-
#primary_group ⇒ String, Integer
(also: #login_group)
The user’s intended primary group.
-
#shell ⇒ String
The user’s intended shell.
-
#system ⇒ Bool
True if the user should be a system user.
-
#uid ⇒ Integer
The user’s intended user id.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#create ⇒ Bool
Creates or updates the user.
-
#initialize(name, args = {}) ⇒ User
constructor
Initializes a user.
-
#remove ⇒ Bool
Removes the user.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name, args = {}) ⇒ User
Initializes a user.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/wright/resource/user.rb', line 49 def initialize(name, args = {}) super @action = args.fetch(:action, :create) @uid = args.fetch(:uid, nil) @full_name = args.fetch(:full_name, nil) @groups = args.fetch(:groups, nil) @shell = args.fetch(:shell, nil) @home = fetch_last(args, [:home, :homedir], nil) @primary_group = fetch_last(args, [:primary_group, :login_group], nil) @system = args.fetch(:system, false) end |
Instance Attribute Details
#full_name ⇒ String
Returns the user’s intended full name.
16 17 18 |
# File 'lib/wright/resource/user.rb', line 16 def full_name @full_name end |
#groups ⇒ Array<String>
Returns the user’s intended groups.
19 20 21 |
# File 'lib/wright/resource/user.rb', line 19 def groups @groups end |
#home ⇒ String Also known as: homedir
Returns the user’s intended home directory path.
25 26 27 |
# File 'lib/wright/resource/user.rb', line 25 def home @home end |
#primary_group ⇒ String, Integer Also known as: login_group
Returns the user’s intended primary group.
29 30 31 |
# File 'lib/wright/resource/user.rb', line 29 def primary_group @primary_group end |
#shell ⇒ String
Returns the user’s intended shell.
22 23 24 |
# File 'lib/wright/resource/user.rb', line 22 def shell @shell end |
#system ⇒ Bool
Returns true if the user should be a system user. Ignored if #uid is set.
34 35 36 |
# File 'lib/wright/resource/user.rb', line 34 def system @system end |
#uid ⇒ Integer
Returns the user’s intended user id.
13 14 15 |
# File 'lib/wright/resource/user.rb', line 13 def uid @uid end |
Instance Method Details
#create ⇒ Bool
Creates or updates the user.
65 66 67 68 69 |
# File 'lib/wright/resource/user.rb', line 65 def create might_update_resource do provider.create end end |
#remove ⇒ Bool
Removes the user.
75 76 77 78 79 |
# File 'lib/wright/resource/user.rb', line 75 def remove might_update_resource do provider.remove end end |