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, Architecture, Augeas, Facter::Resolvers::Bsd::Processors, Cloud, 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::Disk, Linux::DmiBios, Linux::DockerUptime, Linux::Filesystems, Linux::FipsEnabled, Linux::LoadAverages, Linux::Memory, 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, NetworkingLinux, OpenVz, 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, Virtualization, Vmware, WinOsDescription, Windows::AioAgentVersion, Windows::Fips, Windows::Networking, Windows::Ssh, Windows::Uptime, Wpar, Xen, ZFS, Zpool
Class Method Summary
collapse
Class Method Details
.cache_nil_for_unresolved_facts(fact_name) ⇒ Object
38
39
40
41
|
# File 'lib/facter/resolvers/base_resolver.rb', line 38
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
|
# File 'lib/facter/resolvers/base_resolver.rb', line 14
def self.init_resolver
@fact_list = {}
@semaphore = Mutex.new
end
|
.invalidate_cache ⇒ Object
10
11
12
|
# File 'lib/facter/resolvers/base_resolver.rb', line 10
def self.invalidate_cache
@fact_list = {}
end
|
.log ⇒ Object
6
7
8
|
# File 'lib/facter/resolvers/base_resolver.rb', line 6
def self.log
@log ||= Log.new(self)
end
|
.post_resolve(_fact_name, _options) ⇒ Object
43
44
45
|
# File 'lib/facter/resolvers/base_resolver.rb', line 43
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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/facter/resolvers/base_resolver.rb', line 23
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 NoMethodError => e
log.debug("Could not resolve #{fact_name}, got #{e}")
@fact_list[fact_name] = nil
rescue LoadError, NameError => e
log.debug("resolving fact #{fact_name}, but #{e}")
@fact_list[fact_name] = nil
end
|
.subscribe_to_manager ⇒ Object
19
20
21
|
# File 'lib/facter/resolvers/base_resolver.rb', line 19
def self.subscribe_to_manager
Facter::SessionCache.subscribe(self)
end
|