Class: Facts::Solaris::Hypervisors::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/solaris/hypervisors/zone.rb

Constant Summary collapse

FACT_NAME =
'hypervisors.zone'

Instance Method Summary collapse

Constructor Details

#initializeZone

Returns a new instance of Zone.



9
10
11
# File 'lib/facter/facts/solaris/hypervisors/zone.rb', line 9

def initialize
  @log = Facter::Log.new(self)
end

Instance Method Details

#call_the_resolverObject



13
14
15
16
17
# File 'lib/facter/facts/solaris/hypervisors/zone.rb', line 13

def call_the_resolver
  fact_value = current_zone

  Facter::ResolvedFact.new(FACT_NAME, fact_value)
end

#current_zoneObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/facter/facts/solaris/hypervisors/zone.rb', line 19

def current_zone
  current_zone_name = Facter::Resolvers::Solaris::ZoneName.resolve(:current_zone_name)
  return unless current_zone_name

  zones = Facter::Resolvers::Solaris::Zone.resolve(:zone)
  return nil unless zones

  current_zone = zones.find { |r| r[:name] == current_zone_name }

  {
    brand: current_zone[:brand],
    id: current_zone[:id],
    ip_type: current_zone[:iptype],
    name: current_zone[:name],
    uuid: current_zone[:uuid]
  }
end