Sha256: 501f7c12df42cdb109dc5335b1768d684d0fe695bf058bf0a4ebb2d6240c3f2e

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

require 'etc'

module Docker
  module Cli

    module UserInfo
      include TR::CondUtils

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

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

    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
docker-cli-0.5.4 lib/docker/cli/user_info.rb
docker-cli-0.5.3 lib/docker/cli/user_info.rb
docker-cli-0.5.2 lib/docker/cli/user_info.rb
docker-cli-0.5.1 lib/docker/cli/user_info.rb
docker-cli-0.5.0 lib/docker/cli/user_info.rb