Puppet: System Administration Automated

Support

Ticket #432: puppet-user.2.patch

File puppet-user.2.patch, 2.3 kB (added by tim, 2 years ago)

A small modification of the original patch

  • puppet-0.22.0/lib/puppet/provider/nameservice/objectadd.rb

    old new  
    1212    end 
    1313     
    1414    def deletecmd 
    15         [command(:delete), @model[:name]] 
     15        if @model[:managehome] == :true 
     16            [command(:delete), "-r", @model[:name]] 
     17        else 
     18            [command(:delete), @model[:name]] 
     19        end 
    1620    end 
    1721 
    1822    # Determine the flag to pass to our command. 
  • puppet-0.22.0/lib/puppet/provider/user/useradd.rb

    old new  
    2424            # the value needs to be quoted, mostly because -c might 
    2525            # have spaces in it 
    2626            if value = @model.should(state) and value != "" 
    27                 cmd << flag(state) << value 
     27                if state == :comment 
     28                    cmd << flag(state) << ("'" + value + "'") 
     29                else 
     30                    cmd << flag(state) << value 
     31                end 
    2832            end 
    2933        end 
    3034        # stupid fedora 
     
    3640        if @model[:allowdupe]  == :true 
    3741            cmd << "-o" 
    3842        end 
     43        if @model[:managehome] == :true 
     44            cmd << "-m" 
     45        end 
    3946 
    4047        cmd << @model[:name] 
    4148 
  • puppet-0.22.0/lib/puppet/type/user.rb

    old new  
    321321            defaultto false 
    322322        end 
    323323 
     324        newparam(:managehome) do 
     325            desc "Whether to create/remove home dir." 
     326                 
     327            newvalues(:true, :false) 
     328 
     329            defaultto false 
     330        end 
     331 
    324332        @doc = "Manage users.  Currently can create and modify users, but 
    325333            cannot delete them.  Theoretically all of the parameters are 
    326334            optional, but if no parameters are specified the comment will