Sha256: 2000dbd9a49ebc99022eaad39fca03ed4b6bdaecfc23a1f1279ea7e4c8a9cf1b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'puppet/provider/nameservice'

class Puppet::Provider::NameService
class ObjectAdd < Puppet::Provider::NameService
    # Does the object already exist?
    def self.exists?(obj)
        if obj.getinfo(true)
            return true
        else
            return false
        end
    end
    
    def deletecmd
        [command(:delete), @resource[:name]]
    end

    # Determine the flag to pass to our command.
    def flag(name)
        name = name.intern if name.is_a? String
        self.class.option(name, :flag) || "-" + name.to_s[0,1]
    end

    def modifycmd(param, value)
        cmd = [command(:modify), flag(param), value]
        if @resource.allowdupe? && ((param == :uid and self.class.name == :useradd) || (param == :gid and self.class.name == :groupadd))
            cmd << "-o"
        end
        cmd << @resource[:name]

        return cmd
    end

    def posixmethod(name)
        name = name.intern if name.is_a? String
        method = self.class.option(name, :method) || name

        return method
    end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-0.24.5 lib/puppet/provider/nameservice/objectadd.rb