Class Facter::Util::SolarisZones
In: lib/facter/util/solaris_zones.rb
Parent: Object

Provide a set of utility methods to interact with Solaris zones. This class is expected to be instantiated once per set of resolutions in order to cache the output of the zoneadm command, which can be quite expensive.

@api private

Methods

Attributes

zone_hash  [R] 
zoneadm_cmd  [R] 
zoneadm_keys  [R] 
zoneadm_output  [R] 

Public Class methods

add_facts defines all of the facts for solaris zones, for example `zones`, `zone_global_id`, `zone_global_status`, etc… This method defines the static fact named `zones`. The value of this fact is the numver of zones reported by the zoneadm system command. The `zones` fact also defines all of the dynamic facts describing the following seven attribute values for each zone.

Zones may be added to the system while Facter is loaded. In order to define new dynamic facts that reflect this new information, the `virtual` will define new facts as a side effect of refreshing it‘s own value.

@api private

@param [Hash] opts the options to create the instance with @option opts [String] :zoneadm_cmd (’/usr/sbin/zoneadm list -cp’) the

  system command to inspect zones

@option opts [String] :zoneadm_output (nil) the cached output of the

  zoneadm_cmd

Public Instance methods

add_dynamic_facts defines all of the dynamic facts derived from parsing the output of the zoneadm command. The zone facts are dynamic, so this method has the behavior of figuring out what dynamic zone facts need to be defined and how they should be resolved.

@param model [SolarisZones] the model used to store data from the system

@api private

count returns the number of running zones, including the global zone. This method is intended to be used from the setcode block of the `zones` fact.

@api private

@return [Fixnum, nil] the number of running zones or nil if the number

  could not be determined.

flush! purges the saved data from the zoneadm_cmd output

@api private

flushed? returns true if the instance has no parsed data accessible via the {zone_hash} method.

@api private

@return [Boolean] true if there is no parsed data, false otherwise

refresh executes the zoneadm_cmd and stores the output data.

@api private

@return [Hash] the parsed output of the zoneadm command

[Validate]