Sha256: 3a9b2f3adc682fa0d067af801623be0872002c3911a83c22699328b069a8e7ff
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'wright/provider' require 'wright/provider/group' module Wright class Provider class Group # GNU passwd group provider. Used as a provider for # {Resource::Group} on GNU systems. class GnuPasswd < Wright::Provider::Group private def add_group(group_name, gid, system) options = [] options << '--system' if system options += ['-g', gid.to_s] if gid cmd = 'groupadd' args = [*options, group_name] exec_or_fail(cmd, args, "cannot create group '#{group_name}'") end def delete_group(group_name) cmd = 'groupdel' args = [group_name] exec_or_fail(cmd, args, "cannot remove group '#{group_name}'") end def set_members(group_name, members) cmd = 'gpasswd' args = ['-M', "'#{members.join(',')}'", group_name] exec_or_fail(cmd, args, "cannot create group '#{group_name}'") end def set_gid(group_name, gid) cmd = 'groupmod' args = ['-g', gid.to_s, group_name] exec_or_fail(cmd, args, "cannot create group '#{group_name}'") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wright-0.3.0 | lib/wright/provider/group/gnu_passwd.rb |