Class: Facter::Resolvers::BaseResolver
- Inherits:
-
Object
- Object
- Facter::Resolvers::BaseResolver
show all
- Defined in:
- lib/facter/resolvers/base_resolver.rb
Direct Known Subclasses
AioAgentVersion, Aix::Disks, Aix::Filesystem, Aix::LoadAverages, Aix::Memory, Aix::Mountpoints, Aix::Networking, Aix::Nim, Aix::OsLevel, Aix::Partitions, Aix::Processors, Aix::Serialnumber, Amzn::OsReleaseRpm, Architecture, Augeas, Az, Facter::Resolvers::Bsd::Processors, Containers, DMIBios, DMIComputerSystem, DebianVersion, DmiDecode, Ec2, EosRelease, Facterversion, Freebsd::DmiBios, Freebsd::FreebsdVersion, Freebsd::Geom, Freebsd::Processors, Freebsd::SwapMemory, Freebsd::SystemMemory, Freebsd::Virtual, Gce, Hardware, HardwareArchitecture, Hostname, Identity, Kernel, Linux::Disks, Linux::DmiBios, Linux::DockerUptime, Linux::Filesystems, Linux::FipsEnabled, Linux::Hostname, Linux::LoadAverages, Linux::Lscpu, Linux::Memory, Linux::Networking, Linux::Processors, LoadAverages, Lpar, LsbRelease, Lspci, Macosx::DmiBios, Macosx::Filesystems, Macosx::LoadAverages, Macosx::Mountpoints, Macosx::Processors, Macosx::SwapMemory, Macosx::SystemMemory, Macosx::SystemProfiler, Memory, Mountpoints, NetKVM, Networking, OpenVz, Openbsd::DmiBios, Openbsd::Mountpoints, Openbsd::Virtual, OsRelease, Partitions, Path, PosxIdentity, Processors, ProductRelease, RedHatRelease, ReleaseFromFirstLine, Ruby, SELinux, Solaris::Disks, Solaris::Dmi, Solaris::DmiSparc, Solaris::Filesystem, Solaris::Ipaddress, Solaris::Ldom, Solaris::Memory, Solaris::Mountpoints, Solaris::Networking, Solaris::OsRelease, Solaris::Processors, Solaris::Zone, Solaris::ZoneName, SpecificReleaseFile, Ssh, SuseRelease, SwVers, System32, Timezone, Uname, Uptime, VirtWhat, Vmware, WinOsDescription, Windows::AioAgentVersion, Windows::Fips, Windows::Networking, Windows::Ssh, Windows::Timezone, Windows::Uptime, Windows::Virtualization, Wpar, Xen, ZFS, Zpool
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.log ⇒ Object
7
8
9
|
# File 'lib/facter/resolvers/base_resolver.rb', line 7
def log
@log
end
|
Class Method Details
.cache_nil_for_unresolved_facts(fact_name) ⇒ Object
36
37
38
39
|
# File 'lib/facter/resolvers/base_resolver.rb', line 36
def self.cache_nil_for_unresolved_facts(fact_name)
@fact_list.fetch(fact_name) { @fact_list[fact_name] = nil }
@fact_list[fact_name]
end
|
.init_resolver ⇒ Object
14
15
16
17
18
|
# File 'lib/facter/resolvers/base_resolver.rb', line 14
def self.init_resolver
@fact_list = {}
@semaphore = Mutex.new
@log = Log.new(self)
end
|
.invalidate_cache ⇒ Object
10
11
12
|
# File 'lib/facter/resolvers/base_resolver.rb', line 10
def self.invalidate_cache
@fact_list = {}
end
|
.post_resolve(_fact_name, _options) ⇒ Object
41
42
43
|
# File 'lib/facter/resolvers/base_resolver.rb', line 41
def self.post_resolve(_fact_name, _options)
raise NotImplementedError, "You must implement post_resolve(fact_name, options) method in #{name}"
end
|
.resolve(fact_name, options = {}) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/facter/resolvers/base_resolver.rb', line 24
def self.resolve(fact_name, options = {})
@semaphore.synchronize do
subscribe_to_manager
post_resolve(fact_name, options)
cache_nil_for_unresolved_facts(fact_name)
end
rescue LoadError, NameError => e
log.error("Resolving fact #{fact_name}, but got #{e} at #{e.backtrace[0]}")
@fact_list[fact_name] = nil
end
|
.subscribe_to_manager ⇒ Object
20
21
22
|
# File 'lib/facter/resolvers/base_resolver.rb', line 20
def self.subscribe_to_manager
Facter::SessionCache.subscribe(self)
end
|