facter 4.0.34 → 4.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/facts/aix/ssh.rb +3 -1
- data/lib/facter/facts/freebsd/augeas/version.rb +19 -0
- data/lib/facter/facts/freebsd/facterversion.rb +14 -0
- data/lib/facter/facts/freebsd/identity/gid.rb +16 -0
- data/lib/facter/facts/{solaris/solaris_zones/current.rb → freebsd/identity/group.rb} +6 -6
- data/lib/facter/facts/freebsd/identity/privileged.rb +16 -0
- data/lib/facter/facts/freebsd/identity/uid.rb +16 -0
- data/lib/facter/facts/freebsd/identity/user.rb +17 -0
- data/lib/facter/facts/freebsd/kernel.rb +14 -0
- data/lib/facter/facts/freebsd/kernelrelease.rb +14 -0
- data/lib/facter/facts/freebsd/mountpoints.rb +21 -0
- data/lib/facter/facts/freebsd/netmask6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/netmask_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/networking/dhcp.rb +17 -0
- data/lib/facter/facts/freebsd/networking/domain.rb +18 -0
- data/lib/facter/facts/freebsd/networking/fqdn.rb +18 -0
- data/lib/facter/facts/freebsd/networking/hostname.rb +18 -0
- data/lib/facter/facts/freebsd/networking/interfaces.rb +17 -0
- data/lib/facter/facts/freebsd/networking/ip.rb +18 -0
- data/lib/facter/facts/freebsd/networking/ip6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mac.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mtu.rb +17 -0
- data/lib/facter/facts/freebsd/networking/netmask.rb +18 -0
- data/lib/facter/facts/freebsd/networking/netmask6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/primary.rb +17 -0
- data/lib/facter/facts/freebsd/networking/scope6.rb +17 -0
- data/lib/facter/facts/freebsd/os/architecture.rb +18 -0
- data/lib/facter/facts/freebsd/os/hardware.rb +18 -0
- data/lib/facter/facts/freebsd/os/name.rb +18 -0
- data/lib/facter/facts/{bsd/bsd_example_fact.rb → freebsd/path.rb} +5 -4
- data/lib/facter/facts/freebsd/processors/isa.rb +17 -0
- data/lib/facter/facts/freebsd/puppet_version.rb +15 -0
- data/lib/facter/facts/freebsd/ruby/platform.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/sitedir.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/version.rb +18 -0
- data/lib/facter/facts/freebsd/ssh.rb +26 -0
- data/lib/facter/facts/freebsd/system_uptime/days.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/hours.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/seconds.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/uptime.rb +18 -0
- data/lib/facter/facts/freebsd/timezone.rb +15 -0
- data/lib/facter/facts/freebsd/zfs_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zfs_version.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featureflags.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_version.rb +14 -0
- data/lib/facter/facts/linux/mountpoints.rb +1 -1
- data/lib/facter/facts/linux/partitions.rb +1 -1
- data/lib/facter/facts/linux/ssh.rb +19 -9
- data/lib/facter/facts/linux/system_uptime/days.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/hours.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/seconds.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/uptime.rb +7 -1
- data/lib/facter/facts/macosx/dhcp_servers.rb +2 -2
- data/lib/facter/facts/macosx/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/dhcp.rb +1 -1
- data/lib/facter/facts/macosx/networking/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip6.rb +1 -1
- data/lib/facter/facts/macosx/networking/mac.rb +1 -1
- data/lib/facter/facts/macosx/networking/mtu.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask6.rb +1 -1
- data/lib/facter/facts/macosx/networking/network.rb +1 -1
- data/lib/facter/facts/macosx/networking/network6.rb +1 -1
- data/lib/facter/facts/macosx/networking/primary.rb +1 -1
- data/lib/facter/facts/macosx/networking/scope6.rb +1 -1
- data/lib/facter/facts/macosx/scope6_interfaces.rb +2 -2
- data/lib/facter/facts/macosx/ssh.rb +19 -11
- data/lib/facter/facts/solaris/current_zone.rb +16 -0
- data/lib/facter/facts/solaris/disks.rb +14 -0
- data/lib/facter/facts/solaris/dmi/bios/release_date.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/vendor.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/version.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/asset_tag.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/type.rb +24 -0
- data/lib/facter/facts/solaris/dmi/manufacturer.rb +25 -0
- data/lib/facter/facts/solaris/dmi/product/name.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/serial_number.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/uuid.rb +24 -0
- data/lib/facter/facts/solaris/mountpoints.rb +1 -1
- data/lib/facter/facts/solaris/os/release.rb +3 -3
- data/lib/facter/facts/solaris/ssh.rb +19 -9
- data/lib/facter/facts/solaris/zfs_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zfs_version.rb +1 -1
- data/lib/facter/facts/solaris/zones.rb +60 -0
- data/lib/facter/facts/solaris/zpool_featureflags.rb +1 -1
- data/lib/facter/facts/solaris/zpool_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zpool_version.rb +1 -1
- data/lib/facter/facts/windows/dhcp_servers.rb +2 -2
- data/lib/facter/facts/windows/interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network_interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/dhcp.rb +1 -1
- data/lib/facter/facts/windows/networking/domain.rb +1 -1
- data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
- data/lib/facter/facts/windows/networking/interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/ip.rb +1 -1
- data/lib/facter/facts/windows/networking/ip6.rb +1 -1
- data/lib/facter/facts/windows/networking/mac.rb +1 -1
- data/lib/facter/facts/windows/networking/mtu.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask6.rb +1 -1
- data/lib/facter/facts/windows/networking/network.rb +1 -1
- data/lib/facter/facts/windows/networking/network6.rb +1 -1
- data/lib/facter/facts/windows/networking/primary.rb +1 -1
- data/lib/facter/facts/windows/networking/scope6.rb +1 -1
- data/lib/facter/facts/windows/scope6_interfaces.rb +1 -1
- data/lib/facter/framework/cli/cli.rb +16 -4
- data/lib/facter/framework/config/fact_groups.rb +13 -0
- data/lib/facter/os_hierarchy.json +3 -6
- data/lib/facter/resolvers/base_resolver.rb +1 -1
- data/lib/facter/resolvers/ec2.rb +2 -2
- data/lib/facter/resolvers/filesystems_resolver.rb +1 -1
- data/lib/facter/resolvers/linux/docker_uptime.rb +45 -0
- data/lib/facter/resolvers/linux/load_averages.rb +0 -1
- data/lib/facter/resolvers/load_averages.rb +2 -0
- data/lib/facter/resolvers/mountpoints_resolver.rb +42 -44
- data/lib/facter/resolvers/networking_resolver.rb +106 -0
- data/lib/facter/resolvers/solaris/disks.rb +51 -0
- data/lib/facter/resolvers/solaris/dmi.rb +57 -0
- data/lib/facter/resolvers/solaris/dmi_sparc.rb +47 -0
- data/lib/facter/resolvers/solaris/{filesystems_resolver.rb → filesystems.rb} +0 -0
- data/lib/facter/resolvers/solaris/{ipaddress_resolver.rb → ipaddress.rb} +0 -0
- data/lib/facter/resolvers/solaris/{networking_resolver.rb → networking.rb} +0 -0
- data/lib/facter/resolvers/solaris/os_release.rb +44 -0
- data/lib/facter/resolvers/solaris/zone.rb +51 -0
- data/lib/facter/resolvers/solaris/zone_name.rb +31 -0
- data/lib/facter/resolvers/uptime_resolver.rb +1 -27
- data/lib/facter/resolvers/utils/uptime_helper.rb +32 -0
- data/lib/facter/resolvers/windows/networking_resolver.rb +100 -98
- data/lib/facter/resolvers/zfs.rb +32 -0
- data/lib/facter/resolvers/zpool.rb +34 -0
- data/lib/facter/version.rb +1 -1
- metadata +77 -16
- data/lib/facter/facts/freebsd/solaris_zones/current.rb +0 -15
- data/lib/facter/facts/freebsd/solaris_zones/zone.rb +0 -15
- data/lib/facter/facts/solaris/solaris_zones/zone.rb +0 -62
- data/lib/facter/resolvers/macosx/networking_resolver.rb +0 -108
- data/lib/facter/resolvers/solaris/solaris_os_release_resolver.rb +0 -42
- data/lib/facter/resolvers/solaris/solaris_zone_name.rb +0 -28
- data/lib/facter/resolvers/solaris/zfs_resolver.rb +0 -34
- data/lib/facter/resolvers/solaris/zone_resolver.rb +0 -48
- data/lib/facter/resolvers/solaris/zpool_resolver.rb +0 -36
@@ -6,7 +6,7 @@ module Facts
|
|
6
6
|
FACT_NAME = 'interfaces'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
fact_value = Facter::Resolvers::Networking.resolve(:interfaces)
|
9
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
10
10
|
|
11
11
|
Facter::ResolvedFact.new(FACT_NAME, fact_value ? fact_value.keys.join(',') : nil, :legacy)
|
12
12
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("macaddress_#{interface_name}", info[:mac], :legacy) if info[:mac]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("mtu_#{interface_name}", info[:mtu], :legacy) if info[:mtu]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("netmask6_#{interface_name}", info[:netmask6], :legacy) if info[:netmask6]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("netmask_#{interface_name}", info[:netmask], :legacy) if info[:netmask]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("network6_#{interface_name}", info[:network6], :legacy) if info[:network6]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
11
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("network_#{interface_name}", info[:network], :legacy) if info[:network]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'domain'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:domain)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:domain)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'fqdn'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
domain = Facter::Resolvers::Networking.resolve(:domain)
|
11
|
+
domain = Facter::Resolvers::Windows::Networking.resolve(:domain)
|
12
12
|
hostname = Facter::Resolvers::Hostname.resolve(:hostname)
|
13
13
|
return Facter::ResolvedFact.new(FACT_NAME, nil) if !hostname || hostname.empty?
|
14
14
|
|
@@ -7,7 +7,7 @@ module Facts
|
|
7
7
|
FACT_NAME = 'networking.interfaces'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
fact_value = Facter::Resolvers::Networking.resolve(:interfaces)
|
10
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
11
11
|
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
13
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'ipaddress'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:ip)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:ip)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'ipaddress6'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:ip6)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:ip6)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'macaddress'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:mac)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:mac)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'netmask'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:netmask)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:netmask)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'netmask6'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:netmask6)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:netmask6)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'network'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:network)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:network)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
ALIASES = 'network6'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
fact_value = Facter::Resolvers::Networking.resolve(:network6)
|
11
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:network6)
|
12
12
|
|
13
13
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
14
|
end
|
@@ -7,7 +7,7 @@ module Facts
|
|
7
7
|
FACT_NAME = 'networking.primary'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
fact_value = Facter::Resolvers::Networking.resolve(:primary_interface)
|
10
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:primary_interface)
|
11
11
|
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
13
|
end
|
@@ -7,7 +7,7 @@ module Facts
|
|
7
7
|
FACT_NAME = 'networking.scope6'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
fact_value = Facter::Resolvers::Networking.resolve(:scope6)
|
10
|
+
fact_value = Facter::Resolvers::Windows::Networking.resolve(:scope6)
|
11
11
|
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
13
|
end
|
@@ -9,7 +9,7 @@ module Facts
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
11
|
result = {}
|
12
|
-
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
12
|
+
interfaces = Facter::Resolvers::Windows::Networking.resolve(:interfaces)
|
13
13
|
interfaces&.each { |interface_name, info| result["scope6_#{interface_name}"] = info[:scope6] if info[:scope6] }
|
14
14
|
|
15
15
|
result.each { |fact, value| arr << Facter::ResolvedFact.new(fact, value, :legacy) }
|
@@ -138,14 +138,26 @@ module Facter
|
|
138
138
|
|
139
139
|
desc '--list-block-groups', 'List block groups', hide: true
|
140
140
|
map ['--list-block-groups'] => :list_block_groups
|
141
|
-
def list_block_groups(*
|
142
|
-
|
141
|
+
def list_block_groups(*args)
|
142
|
+
options = @options.map { |(k, v)| [k.to_sym, v] }.to_h
|
143
|
+
Facter::Options.init_from_cli(options, args)
|
144
|
+
|
145
|
+
block_groups = Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
|
146
|
+
block_groups.gsub!(/:\s*\n/, "\n")
|
147
|
+
|
148
|
+
puts block_groups
|
143
149
|
end
|
144
150
|
|
145
151
|
desc '--list-cache-groups', 'List cache groups', hide: true
|
146
152
|
map ['--list-cache-groups'] => :list_cache_groups
|
147
|
-
def list_cache_groups(*
|
148
|
-
|
153
|
+
def list_cache_groups(*args)
|
154
|
+
options = @options.map { |(k, v)| [k.to_sym, v] }.to_h
|
155
|
+
Facter::Options.init_from_cli(options, args)
|
156
|
+
|
157
|
+
cache_groups = Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
|
158
|
+
cache_groups.gsub!(/:\s*\n/, "\n")
|
159
|
+
|
160
|
+
puts cache_groups
|
149
161
|
end
|
150
162
|
|
151
163
|
def self.exit_on_failure?
|
@@ -13,6 +13,7 @@ module Facter
|
|
13
13
|
@groups_file_path = group_list_path || default_path
|
14
14
|
@groups ||= File.readable?(@groups_file_path) ? Hocon.load(@groups_file_path) : {}
|
15
15
|
load_groups
|
16
|
+
load_groups_from_options
|
16
17
|
end
|
17
18
|
|
18
19
|
# Breakes down blocked groups in blocked facts
|
@@ -42,6 +43,18 @@ module Facter
|
|
42
43
|
|
43
44
|
private
|
44
45
|
|
46
|
+
def load_groups_from_options
|
47
|
+
Options.external_dir.each do |dir|
|
48
|
+
next unless Dir.exist?(dir)
|
49
|
+
|
50
|
+
ext_facts = Dir.entries(dir)
|
51
|
+
ext_facts.reject! { |ef| ef =~ /^(\.|\.\.)$/ }
|
52
|
+
ext_facts.each do |ef|
|
53
|
+
@groups[ef] = nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
45
58
|
def load_groups
|
46
59
|
config = ConfigReader.init(Options[:config])
|
47
60
|
@block_list = config.block_list || {}
|
data/lib/facter/resolvers/ec2.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'net/http'
|
4
|
-
|
5
3
|
module Facter
|
6
4
|
module Resolvers
|
7
5
|
class Ec2 < BaseResolver
|
@@ -52,6 +50,8 @@ module Facter
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def get_data_from(url)
|
53
|
+
require 'net/http'
|
54
|
+
|
55
55
|
parsed_url = URI.parse(url)
|
56
56
|
http = Net::HTTP.new(parsed_url.host)
|
57
57
|
http.read_timeout = determine_session_timeout
|
@@ -22,7 +22,7 @@ module Facter
|
|
22
22
|
filesystems = []
|
23
23
|
output.each do |line|
|
24
24
|
tokens = line.split(' ')
|
25
|
-
filesystems << tokens if tokens.size == 1
|
25
|
+
filesystems << tokens if tokens.size == 1 && tokens.first != 'fuseblk'
|
26
26
|
end
|
27
27
|
@fact_list[:systems] = filesystems.sort.join(',')
|
28
28
|
@fact_list[fact_name]
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Linux
|
6
|
+
class DockerUptime < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
class << self
|
10
|
+
private
|
11
|
+
|
12
|
+
def post_resolve(fact_name)
|
13
|
+
@fact_list.fetch(fact_name) { detect_uptime(fact_name) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def detect_uptime(fact_name)
|
17
|
+
days, hours, minutes, seconds = extract_uptime_from_docker
|
18
|
+
total_seconds = convert_to_seconds(days, hours, minutes, seconds)
|
19
|
+
@fact_list = Utils::UptimeHelper.create_uptime_hash(total_seconds)
|
20
|
+
|
21
|
+
@fact_list[fact_name]
|
22
|
+
end
|
23
|
+
|
24
|
+
def extract_uptime_from_docker
|
25
|
+
# time format [dd-][hh:]mm:ss
|
26
|
+
time = Facter::Core::Execution.execute('ps -o etime= -p "1"', logger: log)
|
27
|
+
extracted_time = time.split(/[-:]/)
|
28
|
+
|
29
|
+
reversed_time = extracted_time.reverse
|
30
|
+
seconds = reversed_time[0].to_i
|
31
|
+
minutes = reversed_time[1].to_i
|
32
|
+
hours = reversed_time[2].to_i
|
33
|
+
days = reversed_time[3].to_i
|
34
|
+
|
35
|
+
[days, hours, minutes, seconds]
|
36
|
+
end
|
37
|
+
|
38
|
+
def convert_to_seconds(days, hours, minutes, seconds)
|
39
|
+
days * 24 * 3600 + hours * 3600 + minutes * 60 + seconds
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -14,6 +14,8 @@ module Facter
|
|
14
14
|
|
15
15
|
def read_load_averages(fact_name)
|
16
16
|
require_relative 'utils/ffi/load_averages'
|
17
|
+
|
18
|
+
log.debug('loading cpu load averages')
|
17
19
|
@fact_list[:load_averages] = %w[1m 5m 15m].zip(Utils::Ffi::LoadAverages.read_load_averages).to_h
|
18
20
|
|
19
21
|
@fact_list[fact_name]
|
@@ -2,59 +2,57 @@
|
|
2
2
|
|
3
3
|
module Facter
|
4
4
|
module Resolvers
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
5
|
+
class Mountpoints < BaseResolver
|
6
|
+
include Facter::FilesystemHelper
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
@log = Facter::Log.new(self)
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
def post_resolve(fact_name)
|
14
|
+
@fact_list.fetch(fact_name) { read_mounts }
|
15
|
+
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
def root_device
|
18
|
+
cmdline = Util::FileHelper.safe_read('/proc/cmdline')
|
19
|
+
match = cmdline.match(/root=([^\s]+)/)
|
20
|
+
match&.captures&.first
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
def compute_device(device)
|
24
|
+
# If the "root" device, lookup the actual device from the kernel options
|
25
|
+
# This is done because not all systems symlink /dev/root
|
26
|
+
device = root_device if device == '/dev/root'
|
27
|
+
device
|
28
|
+
end
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
def read_mounts # rubocop:disable Metrics/AbcSize
|
31
|
+
mounts = []
|
32
|
+
FilesystemHelper.read_mountpoints.each do |fs|
|
33
|
+
device = compute_device(fs.name)
|
34
|
+
filesystem = fs.mount_type
|
35
|
+
path = fs.mount_point
|
36
|
+
options = fs.options.split(',').map(&:strip)
|
38
37
|
|
39
|
-
|
38
|
+
next if path =~ %r{^/(proc|sys)} && filesystem != 'tmpfs' || filesystem == 'autofs'
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
stats = FilesystemHelper.read_mountpoint_stats(path)
|
41
|
+
size_bytes = stats.bytes_total.abs
|
42
|
+
available_bytes = stats.bytes_available.abs
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
used_bytes = stats.bytes_used.abs
|
45
|
+
total_bytes = used_bytes + available_bytes
|
46
|
+
capacity = FilesystemHelper.compute_capacity(used_bytes, total_bytes)
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
size = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(size_bytes)
|
49
|
+
available = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(available_bytes)
|
50
|
+
used = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(used_bytes)
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
@fact_list[:mountpoints] = mounts
|
52
|
+
mounts << Hash[FilesystemHelper::MOUNT_KEYS.zip(FilesystemHelper::MOUNT_KEYS
|
53
|
+
.map { |v| binding.local_variable_get(v) })]
|
57
54
|
end
|
55
|
+
@fact_list[:mountpoints] = mounts
|
58
56
|
end
|
59
57
|
end
|
60
58
|
end
|