Sha256: eef793079b6287a579c6d7e2513cbcd7081ead813a3e714ed2d156d2c2220a26
Contents?: true
Size: 746 Bytes
Versions: 4
Compression:
Stored size: 746 Bytes
Contents
# frozen_string_literal: true module Facter module Resolvers class PosxIdentity < BaseResolver @log = Facter::Log.new(self) init_resolver class << self private def post_resolve(fact_name) @fact_list.fetch(fact_name) { retrieve_identity(fact_name) } end def retrieve_identity(fact_name) require 'etc' login_info = Etc.getpwuid @fact_list[:gid] = login_info.gid @fact_list[:group] = Etc.getgrgid(login_info.gid).name @fact_list[:privileged] = login_info.uid.zero? @fact_list[:uid] = login_info.uid @fact_list[:user] = login_info.name @fact_list[fact_name] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems