Sha256: 02b735260f5a6beef9e1ebd066949a4cd96375b6f12d374a47538274d3d53820

Contents?: true

Size: 913 Bytes

Versions: 7

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class SolarisZoneName < BaseResolver
      @log = Facter::Log.new(self)
      @semaphore = Mutex.new
      @fact_list ||= {}
      class << self
        private

        def post_resolve(fact_name)
          @fact_list.fetch(fact_name) { build_current_zone_name_fact(fact_name) }
        end

        def build_current_zone_name_fact(fact_name)
          zone_name_output, status = Open3.capture2('/bin/zonename')
          unless status.to_s.include?('exit 0')
            @log.debug("Command #{command} returned status: #{status}")
            return
          end
          if zone_name_output.empty?
            @log.debug("Command #{command} returned an empty result")
            return
          end
          @fact_list[:current_zone_name] = zone_name_output.chomp
          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
facter-4.0.13 lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.12 lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.11 lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.10.pre lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.9.pre lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.8.pre lib/resolvers/solaris/solaris_zone_name.rb
facter-4.0.7.pre lib/resolvers/solaris/solaris_zone_name.rb