Sha256: 7f4d68d901585c4ee7285b9071828ecc01a4f3b6afe10a66aaff5e6842efd092

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-0.25.5 lib/puppet/provider/user/pw.rb
puppet-0.25.4 lib/puppet/provider/user/pw.rb
puppet-0.25.3 lib/puppet/provider/user/pw.rb
puppet-0.24.9 lib/puppet/provider/user/pw.rb
puppet-0.25.2 lib/puppet/provider/user/pw.rb
puppet-0.25.1 lib/puppet/provider/user/pw.rb
puppet-0.25.0 lib/puppet/provider/user/pw.rb
puppet-0.24.0 lib/puppet/provider/user/pw.rb
puppet-0.24.4 lib/puppet/provider/user/pw.rb
puppet-0.24.3 lib/puppet/provider/user/pw.rb
puppet-0.24.1 lib/puppet/provider/user/pw.rb
puppet-0.24.2 lib/puppet/provider/user/pw.rb
puppet-0.24.6 lib/puppet/provider/user/pw.rb
puppet-0.24.5 lib/puppet/provider/user/pw.rb
puppet-0.24.7 lib/puppet/provider/user/pw.rb
puppet-0.24.8 lib/puppet/provider/user/pw.rb