Sha256: d5e035cb17cadae7cc7e21ef2c717b290d2a64f56db88410484126c7d91c66da
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'wright/dry_run' 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.2.0 | lib/wright/provider/group/gnu_passwd.rb |