class Wright::Resource::Group
Group
resource, represents a group.
@example
admins = Wright::Resource::Group.new('admins', members: ['root']) admins.create
@todo Use GnuPasswd provider on all GNU-flavoured systems
Attributes
gid[RW]
@return [Integer] the group's intended group id
members[RW]
@return [Array<String>] the group's intended members
system[RW]
@return [Bool] true if the group should be a system
group. Ignored if {#gid} is set.
Public Class Methods
new(name, args = {})
click to toggle source
Initializes a Group
.
@param name [String] the group's name @param args [Hash] the arguments @option args [Symbol] :action (:create) the action @option args [Array<String>] :members the group's members @option args [Integer] :gid the group's gid @option args [Bool] :system (false) denotes whether the group
should be a system group or not
Calls superclass method
Wright::Resource::new
# File lib/wright/resource/group.rb, line 32 def initialize(name, args = {}) super @action = args.fetch(:action, :create) @members = args.fetch(:members, nil) @gid = args.fetch(:gid, nil) @system = args.fetch(:system, false) end
Public Instance Methods
create()
click to toggle source
Creates or updates the group.
@return [Bool] true if the group was updated and false
otherwise
# File lib/wright/resource/group.rb, line 44 def create might_update_resource do provider.create end end
remove()
click to toggle source
Removes the group.
@return [Bool] true if the group was updated and false
otherwise
# File lib/wright/resource/group.rb, line 54 def remove might_update_resource do provider.remove end end