Class: Wright::Resource::Group

Inherits:
Wright::Resource show all
Defined in:
lib/wright/resource/group.rb

Overview

TODO:

Use GnuPasswd provider on all GNU-flavoured systems

Group resource, represents a group.

Examples:

admins = Wright::Resource::Group.new('admins')
admins.members = ['root']
admins.create

Instance Attribute Summary collapse

Attributes inherited from Wright::Resource

#action, #ignore_failure, #name, #resource_name

Instance Method Summary collapse

Methods inherited from Wright::Resource

#log_error, #might_update_resource, #on_update=, #provider_for_resource, #provider_name, #resource_class, #run_action, #run_update_action

Constructor Details

#initialize(name) ⇒ Group

Initializes a Group.


27
28
29
30
31
# File 'lib/wright/resource/group.rb', line 27

def initialize(name)
  super
  @action = :create
  @system = false
end

Instance Attribute Details

#gidInteger


18
19
20
# File 'lib/wright/resource/group.rb', line 18

def gid
  @gid
end

#membersArray<String>


15
16
17
# File 'lib/wright/resource/group.rb', line 15

def members
  @members
end

#systemBool


22
23
24
# File 'lib/wright/resource/group.rb', line 22

def system
  @system
end

Instance Method Details

#createBool

Creates or updates the group.


37
38
39
40
41
# File 'lib/wright/resource/group.rb', line 37

def create
  might_update_resource do
    @provider.create
  end
end

#removeBool

Removes the group.


47
48
49
50
51
# File 'lib/wright/resource/group.rb', line 47

def remove
  might_update_resource do
    @provider.remove
  end
end