Sha256: 8628d2e11732d4b2cf7c3fc2d4d459e7a7a0648a67eb72082edd8a0e8a75fa91

Contents?: true

Size: 685 Bytes

Versions: 14

Compression:

Stored size: 685 Bytes

Contents

require 'etc'

module Dockerun

  module UserInfo
    include TR::CondUtils

    def user_info(login = nil)
      login = Etc.getlogin if is_empty?(login)
      res = { login: login }
      begin
        res[:user_id] = Etc.getpwnam(login).uid
      rescue Exception => ex
        res[:user_id] = nil
      end
      res
    end

    def group_info(login = nil)
      login = Etc.getlogin if is_empty?(login)
      res = {  }
      begin
        gnm = Etc.getgrnam(login)
        res[:group_name] = gnm.name
        res[:group_id] = gnm.gid
      rescue Exception => ex
        p ex
        res[:group_name] = ""
        res[:group_id] = nil
      end
      res
    end

  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dockerun-0.3.6 lib/dockerun/user_info.rb
dockerun-0.3.5 lib/dockerun/user_info.rb
dockerun-0.3.4 lib/dockerun/user_info.rb
dockerun-0.3.3 lib/dockerun/user_info.rb
dockerun-0.3.1 lib/dockerun/user_info.rb
dockerun-0.3.0 lib/dockerun/user_info.rb
dockerun-0.2.3 lib/dockerun/user_info.rb
dockerun-0.2.2 lib/dockerun/user_info.rb
dockerun-0.2.1 lib/dockerun/user_info.rb
dockerun-0.2.0 lib/dockerun/user_info.rb
dockerun-0.1.18 lib/dockerun/user_info.rb
dockerun-0.1.16 lib/dockerun/user_info.rb
dockerun-0.1.15 lib/dockerun/user_info.rb
dockerun-0.1.14 lib/dockerun/user_info.rb