Sha256: d059b4de3b61ebac8a204accf0b616abcf964d39622c7e254da4c5b3fea5125b

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'puppet/provider/nameservice/pw'

Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::PW do
    desc "User management via ``pw`` on FreeBSD."

    commands :pw => "pw"
    has_features :manages_homedir, :allows_duplicates

    defaultfor :operatingsystem => :freebsd

    options :home, :flag => "-d", :method => :dir
    options :comment, :method => :gecos
    options :groups, :flag => "-G"

    verify :gid, "GID must be an integer" do |value|
        value.is_a? Integer
    end

    verify :groups, "Groups must be comma-separated" do |value|
        value !~ /\s/
    end

    def addcmd
        cmd = [command(:pw), "useradd", @resource[:name]]
        @resource.class.validproperties.each do |property|
            next if property == :ensure
            # the value needs to be quoted, mostly because -c might
            # have spaces in it
            if value = @resource.should(property) and value != ""
                cmd << flag(property) << value
            end
        end

        if @resource.allowdupe?
            cmd << "-o"
        end

        if @resource.managehome?
            cmd << "-m"
        end

        return cmd
    end
end

# $Id: pw.rb 2600 2007-06-18 06:42:07Z luke $

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-0.23.0 lib/puppet/provider/user/pw.rb
puppet-0.23.2 lib/puppet/provider/user/pw.rb
puppet-0.23.1 lib/puppet/provider/user/pw.rb