Sha256: 2305afe2787513763cc0259c04328a3289364c3ed987663a181de51cb2b88237

Contents?: true

Size: 1.88 KB

Versions: 95

Compression:

Stored size: 1.88 KB

Contents

Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do
  desc "User management for HP-UX. This provider uses the undocumented `-F`
    switch to HP-UX's special `usermod` binary to work around the fact that
    its standard `usermod` cannot make changes while the user is logged in."

  defaultfor :operatingsystem => "hp-ux"
  confine :operatingsystem => "hp-ux"

  commands :modify => "/usr/sam/lbin/usermod.sam", :delete => "/usr/sam/lbin/userdel.sam", :add => "/usr/sam/lbin/useradd.sam"
  options :comment, :method => :gecos
  options :groups, :flag => "-G"
  options :home, :flag => "-d", :method => :dir

  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

  has_features :manages_homedir, :allows_duplicates, :manages_passwords

  def deletecmd
    super.insert(1,"-F")
  end

  def modifycmd(param,value)
    super.insert(1,"-F")
  end

  def password
    # Password management routine for trusted and non-trusted systems
    #temp=""
    while ent = Etc.getpwent() do
      if ent.name == resource.name
        temp=ent.name
        break
      end
    end
    Etc.endpwent()
    if !temp
      return nil
    end

    ent = Etc.getpwnam(resource.name)
    if ent.passwd == "*"
      # Either no password or trusted password, check trusted
      file_name="/tcb/files/auth/#{resource.name.chars.first}/#{resource.name}"
      if File.file?(file_name)
        # Found the tcb user for the specific user, now get passwd
        File.open(file_name).each do |line|
          if ( line =~ /u_pwd/ )
            temp_passwd=line.split(":")[1].split("=")[1]
            ent.passwd = temp_passwd
            return ent.passwd
          end
        end
      else
        debug "No trusted computing user file #{file_name} found."
      end
    else
      return ent.passwd
    end
  end
end

Version data entries

95 entries across 95 versions & 3 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-3.8.7 lib/puppet/provider/user/hpux.rb
puppet-3.8.7-x86-mingw32 lib/puppet/provider/user/hpux.rb
puppet-3.8.7-x64-mingw32 lib/puppet/provider/user/hpux.rb
puppet-3.8.6 lib/puppet/provider/user/hpux.rb
puppet-3.8.6-x86-mingw32 lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-3.8.6-x64-mingw32 lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-3.8.5 lib/puppet/provider/user/hpux.rb
puppet-3.8.5-x86-mingw32 lib/puppet/provider/user/hpux.rb
puppet-3.8.5-x64-mingw32 lib/puppet/provider/user/hpux.rb
puppet-3.8.4 lib/puppet/provider/user/hpux.rb
puppet-3.8.4-x86-mingw32 lib/puppet/provider/user/hpux.rb
puppet-3.8.4-x64-mingw32 lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/provider/user/hpux.rb