Sha256: c6cc7de422893ee7e6646255483b8c89161eabbdcf4aed9d487a6754c571f3fc
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
require 'wright/resource' require 'wright/dsl' module Wright class Resource # Group resource, represents a group. # # @example # admins = Wright::Resource::Group.new('admins') # admins.members = ['root'] # admins.create # @todo Use GnuPasswd provider on all GNU-flavoured systems class Group < Wright::Resource # @return [Array<String>] the group's intended members attr_accessor :members # @return [Integer] the group's intended group id attr_accessor :gid # @return [Bool] true if the group should be a system # group. Ignored if {#gid} is set. attr_accessor :system # Initializes a Group. # # @param name [String] the group's name def initialize(name) super @action = :create @system = false end # Creates or updates the group. # # @return [Bool] true if the group was updated and false # otherwise def create might_update_resource do @provider.create end end # Removes the group. # # @return [Bool] true if the group was updated and false # otherwise def remove might_update_resource do @provider.remove end end end end end Wright::DSL.register_resource(Wright::Resource::Group) group_providers = { 'debian' => 'Wright::Provider::Group::GnuPasswd', 'rhel' => 'Wright::Provider::Group::GnuPasswd', 'fedora' => 'Wright::Provider::Group::GnuPasswd', 'macosx' => 'Wright::Provider::Group::DarwinDirectoryService' } Wright::Config[:resources][:group] ||= {} Wright::Config[:resources][:group][:provider] ||= group_providers[Wright::Util.os_family]
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wright-0.4.4 | lib/wright/resource/group.rb |
wright-0.4.3 | lib/wright/resource/group.rb |
wright-0.4.2 | lib/wright/resource/group.rb |
wright-0.4.1 | lib/wright/resource/group.rb |