facter 4.0.50 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/lib/docs/generate_cli.rb +7 -0
  3. data/lib/facter.rb +90 -56
  4. data/lib/facter/config.rb +2 -0
  5. data/lib/facter/custom_facts/core/aggregate.rb +9 -0
  6. data/lib/facter/custom_facts/core/execution/base.rb +7 -3
  7. data/lib/facter/custom_facts/core/execution/popen3.rb +13 -1
  8. data/lib/facter/custom_facts/core/execution/posix.rb +2 -2
  9. data/lib/facter/custom_facts/core/execution/windows.rb +1 -1
  10. data/lib/facter/custom_facts/core/resolvable.rb +11 -0
  11. data/lib/facter/custom_facts/util/collection.rb +5 -0
  12. data/lib/facter/custom_facts/util/directory_loader.rb +1 -1
  13. data/lib/facter/custom_facts/util/normalization.rb +7 -2
  14. data/lib/facter/custom_facts/util/resolution.rb +2 -0
  15. data/lib/facter/custom_facts/util/windows_root.rb +2 -1
  16. data/lib/facter/facts/aix/processors/cores.rb +16 -0
  17. data/lib/facter/facts/aix/processors/threads.rb +16 -0
  18. data/lib/facter/facts/amzn/lsbdistcodename.rb +16 -0
  19. data/lib/facter/facts/amzn/lsbdistdescription.rb +16 -0
  20. data/lib/facter/facts/amzn/lsbdistid.rb +16 -0
  21. data/lib/facter/facts/amzn/os/distro/codename.rb +24 -0
  22. data/lib/facter/facts/amzn/os/distro/description.rb +21 -0
  23. data/lib/facter/facts/amzn/os/distro/id.rb +21 -0
  24. data/lib/facter/facts/amzn/os/distro/release.rb +32 -0
  25. data/lib/facter/facts/freebsd/is_virtual.rb +1 -5
  26. data/lib/facter/facts/freebsd/virtual.rb +1 -2
  27. data/lib/facter/facts/linux/az_metadata.rb +23 -0
  28. data/lib/facter/facts/linux/cloud/provider.rb +20 -0
  29. data/lib/facter/facts/linux/dhcp_servers.rb +2 -2
  30. data/lib/facter/facts/linux/ec2_metadata.rb +1 -5
  31. data/lib/facter/facts/linux/ec2_userdata.rb +1 -5
  32. data/lib/facter/facts/linux/hypervisors/xen.rb +1 -4
  33. data/lib/facter/facts/linux/interfaces.rb +1 -1
  34. data/lib/facter/facts/linux/ipaddress6_interfaces.rb +1 -1
  35. data/lib/facter/facts/linux/ipaddress_interfaces.rb +1 -1
  36. data/lib/facter/facts/linux/is_virtual.rb +1 -5
  37. data/lib/facter/facts/linux/macaddress_interfaces.rb +1 -1
  38. data/lib/facter/facts/linux/mtu_interfaces.rb +1 -1
  39. data/lib/facter/facts/linux/netmask6_interfaces.rb +1 -1
  40. data/lib/facter/facts/linux/netmask_interfaces.rb +1 -1
  41. data/lib/facter/facts/linux/network6_interfaces.rb +1 -1
  42. data/lib/facter/facts/linux/network_interfaces.rb +1 -1
  43. data/lib/facter/facts/linux/networking/dhcp.rb +1 -1
  44. data/lib/facter/facts/linux/networking/domain.rb +1 -1
  45. data/lib/facter/facts/linux/networking/fqdn.rb +1 -1
  46. data/lib/facter/facts/linux/networking/hostname.rb +1 -1
  47. data/lib/facter/facts/linux/networking/interfaces.rb +1 -1
  48. data/lib/facter/facts/linux/networking/ip.rb +1 -1
  49. data/lib/facter/facts/linux/networking/ip6.rb +1 -1
  50. data/lib/facter/facts/linux/networking/mac.rb +1 -1
  51. data/lib/facter/facts/linux/networking/mtu.rb +1 -1
  52. data/lib/facter/facts/linux/networking/netmask.rb +1 -1
  53. data/lib/facter/facts/linux/networking/netmask6.rb +1 -1
  54. data/lib/facter/facts/linux/networking/network.rb +1 -1
  55. data/lib/facter/facts/linux/networking/network6.rb +1 -1
  56. data/lib/facter/facts/linux/networking/primary.rb +1 -1
  57. data/lib/facter/facts/linux/networking/scope6.rb +1 -1
  58. data/lib/facter/facts/linux/processors/cores.rb +16 -0
  59. data/lib/facter/facts/linux/processors/threads.rb +16 -0
  60. data/lib/facter/facts/linux/scope6_interfaces.rb +1 -1
  61. data/lib/facter/facts/linux/virtual.rb +1 -2
  62. data/lib/facter/facts/macosx/os/macosx/version.rb +15 -4
  63. data/lib/facter/facts/macosx/processors/cores.rb +16 -0
  64. data/lib/facter/facts/macosx/processors/threads.rb +16 -0
  65. data/lib/facter/facts/rhel/lsbdistcodename.rb +16 -0
  66. data/lib/facter/facts/rhel/lsbdistdescription.rb +16 -0
  67. data/lib/facter/facts/rhel/lsbdistid.rb +16 -0
  68. data/lib/facter/facts/rhel/os/distro/codename.rb +2 -4
  69. data/lib/facter/facts/rhel/os/distro/description.rb +2 -4
  70. data/lib/facter/facts/rhel/os/distro/id.rb +2 -4
  71. data/lib/facter/facts/rhel/os/distro/release.rb +13 -12
  72. data/lib/facter/facts/sles/lsbdistcodename.rb +16 -0
  73. data/lib/facter/facts/sles/lsbdistdescription.rb +16 -0
  74. data/lib/facter/facts/sles/lsbdistid.rb +16 -0
  75. data/lib/facter/facts/sles/os/distro/codename.rb +3 -4
  76. data/lib/facter/facts/sles/os/distro/description.rb +2 -5
  77. data/lib/facter/facts/sles/os/distro/id.rb +6 -5
  78. data/lib/facter/facts/sles/os/distro/release.rb +17 -12
  79. data/lib/facter/facts/solaris/hypervisors/ldom.rb +1 -1
  80. data/lib/facter/facts/solaris/hypervisors/zone.rb +1 -1
  81. data/lib/facter/facts/solaris/mountpoints.rb +1 -1
  82. data/lib/facter/facts/solaris/processors/cores.rb +16 -0
  83. data/lib/facter/facts/solaris/processors/threads.rb +16 -0
  84. data/lib/facter/facts/ubuntu/lsbdistrelease.rb +2 -2
  85. data/lib/facter/facts/windows/az_metadata.rb +23 -0
  86. data/lib/facter/facts/windows/cloud/provider.rb +21 -0
  87. data/lib/facter/facts/windows/ec2_metadata.rb +1 -1
  88. data/lib/facter/facts/windows/ec2_userdata.rb +1 -1
  89. data/lib/facter/facts/windows/gce.rb +1 -1
  90. data/lib/facter/facts/windows/hypervisors/hyperv.rb +1 -1
  91. data/lib/facter/facts/windows/hypervisors/kvm.rb +2 -1
  92. data/lib/facter/facts/windows/hypervisors/virtualbox.rb +2 -2
  93. data/lib/facter/facts/windows/hypervisors/vmware.rb +1 -1
  94. data/lib/facter/facts/windows/hypervisors/xen.rb +3 -1
  95. data/lib/facter/facts/windows/is_virtual.rb +15 -0
  96. data/lib/facter/facts/windows/{virtualization/is_virtual.rb → processors/cores.rb} +4 -4
  97. data/lib/facter/facts/windows/{virtualization/virtual.rb → processors/threads.rb} +4 -4
  98. data/lib/facter/facts/windows/virtual.rb +15 -0
  99. data/lib/facter/framework/cli/cli.rb +6 -8
  100. data/lib/facter/framework/config/config_reader.rb +2 -0
  101. data/lib/facter/framework/config/fact_groups.rb +25 -2
  102. data/lib/facter/framework/core/cache_manager.rb +7 -3
  103. data/lib/facter/framework/core/fact/external/external_fact_manager.rb +0 -1
  104. data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +41 -39
  105. data/lib/facter/framework/core/fact_filter.rb +5 -15
  106. data/lib/facter/framework/core/fact_loaders/external_fact_loader.rb +9 -6
  107. data/lib/facter/framework/core/fact_loaders/fact_loader.rb +39 -37
  108. data/lib/facter/framework/core/fact_manager.rb +84 -14
  109. data/lib/facter/framework/core/file_loader.rb +1 -1
  110. data/lib/facter/framework/core/options.rb +1 -2
  111. data/lib/facter/framework/core/options/config_file_options.rb +7 -0
  112. data/lib/facter/framework/core/options/option_store.rb +12 -6
  113. data/lib/facter/framework/formatters/formatter_helper.rb +3 -5
  114. data/lib/facter/framework/logging/logger.rb +4 -4
  115. data/lib/facter/framework/parsers/query_parser.rb +5 -12
  116. data/lib/facter/models/fact_collection.rb +48 -5
  117. data/lib/facter/models/resolved_fact.rb +2 -3
  118. data/lib/facter/models/searched_fact.rb +2 -3
  119. data/lib/facter/resolvers/aix/ffi/ffi_helper.rb +1 -1
  120. data/lib/facter/resolvers/aix/processors.rb +4 -0
  121. data/lib/facter/resolvers/az.rb +39 -0
  122. data/lib/facter/resolvers/base_resolver.rb +2 -2
  123. data/lib/facter/resolvers/dmi_decode.rb +0 -1
  124. data/lib/facter/resolvers/linux/hostname.rb +126 -0
  125. data/lib/facter/resolvers/linux/networking.rb +124 -0
  126. data/lib/facter/resolvers/macosx/mountpoints.rb +14 -1
  127. data/lib/facter/resolvers/macosx/processor.rb +16 -1
  128. data/lib/facter/resolvers/mountpoints.rb +16 -8
  129. data/lib/facter/resolvers/networking.rb +3 -2
  130. data/lib/facter/resolvers/partitions.rb +1 -1
  131. data/lib/facter/resolvers/processors_lscpu.rb +44 -0
  132. data/lib/facter/resolvers/redhat_release.rb +28 -12
  133. data/lib/facter/resolvers/ruby.rb +1 -1
  134. data/lib/facter/resolvers/selinux.rb +5 -7
  135. data/lib/facter/resolvers/solaris/ffi/functions.rb +1 -1
  136. data/lib/facter/resolvers/solaris/ffi/structs.rb +12 -0
  137. data/lib/facter/resolvers/solaris/mountpoints.rb +22 -16
  138. data/lib/facter/resolvers/solaris/networking.rb +20 -5
  139. data/lib/facter/resolvers/solaris/processors.rb +7 -0
  140. data/lib/facter/resolvers/solaris/zone.rb +0 -1
  141. data/lib/facter/resolvers/windows/ffi/identity_ffi.rb +5 -0
  142. data/lib/facter/resolvers/windows/identity.rb +1 -6
  143. data/lib/facter/resolvers/windows/processors.rb +41 -4
  144. data/lib/facter/resolvers/windows/uptime.rb +3 -22
  145. data/lib/facter/resolvers/windows/virtualization.rb +46 -44
  146. data/lib/facter/resolvers/xen.rb +6 -1
  147. data/lib/facter/templates/man.erb +13 -5
  148. data/lib/facter/util/facts/posix/virtual_detector.rb +74 -0
  149. data/lib/facter/util/facts/unit_converter.rb +2 -2
  150. data/lib/facter/util/linux/dhcp.rb +86 -0
  151. data/lib/facter/util/linux/if_inet6.rb +73 -0
  152. data/lib/facter/util/linux/routing_table.rb +60 -0
  153. data/lib/facter/util/linux/socket_parser.rb +114 -0
  154. data/lib/facter/util/resolvers/ffi/hostname.rb +70 -0
  155. data/lib/facter/util/resolvers/http.rb +7 -1
  156. data/lib/facter/util/resolvers/networking/primary_interface.rb +11 -5
  157. data/lib/facter/util/utils.rb +18 -1
  158. data/lib/facter/version.rb +1 -1
  159. metadata +63 -13
  160. data/lib/facter/facts/linux/cloud.rb +0 -15
  161. data/lib/facter/framework/core/fact_augmenter.rb +0 -37
  162. data/lib/facter/resolvers/cloud.rb +0 -39
  163. data/lib/facter/resolvers/networking_linux.rb +0 -296
  164. data/lib/facter/util/facts/virtual_detector.rb +0 -90
@@ -10,7 +10,7 @@ module Facter
10
10
  CONNECTION_TIMEOUT = 0.6
11
11
  SESSION_TIMEOUT = 5
12
12
 
13
- # Makes a GET http request and returns it's response.
13
+ # Makes a GET http request and returns its response.
14
14
  #
15
15
  # Params:
16
16
  # url: String which contains the address to which the request will be made
@@ -40,6 +40,12 @@ module Facter
40
40
  http = http_obj(uri, timeouts)
41
41
  request = request_obj(headers, uri, request_type)
42
42
 
43
+ # The Windows implementation of sockets does not respect net/http
44
+ # timeouts, so check if the target is reachable in a different way
45
+ if Gem.win_platform?
46
+ Socket.tcp(uri.host, uri.port, connect_timeout: timeouts[:connection] || CONNECTION_TIMEOUT)
47
+ end
48
+
43
49
  # Make the request
44
50
  response = http.request(request)
45
51
  response.uri = url
@@ -37,11 +37,8 @@ module Facter
37
37
  next if index.zero?
38
38
 
39
39
  route = line.strip.split("\t")
40
- if route.count > 7 &&
41
- route[ROUTE_TABLE_MAPPING['Destination']] == '00000000' &&
42
- route[ROUTE_TABLE_MAPPING['Mask']] == '00000000'
43
- return route[ROUTE_TABLE_MAPPING['Iface']]
44
- end
40
+
41
+ return route[ROUTE_TABLE_MAPPING['Iface']] if valid_default_route?(route)
45
42
  end
46
43
 
47
44
  nil
@@ -74,6 +71,15 @@ module Facter
74
71
 
75
72
  nil
76
73
  end
74
+
75
+ private
76
+
77
+ def valid_default_route?(route)
78
+ route.count > 7 &&
79
+ route[ROUTE_TABLE_MAPPING['Destination']] == '00000000' &&
80
+ route[ROUTE_TABLE_MAPPING['Mask']] == '00000000' &&
81
+ route[ROUTE_TABLE_MAPPING['Iface']] != '*' # `*` represents blackhole and not a valid interface
82
+ end
77
83
  end
78
84
  end
79
85
  end
@@ -4,7 +4,7 @@ module Facter
4
4
  module Utils
5
5
  # Sort nested hash.
6
6
  def self.sort_hash_by_key(hash, recursive = true, &block)
7
- hash.keys.sort(&block).each_with_object({}) do |key, seed|
7
+ hash.keys.sort(&block).each_with_object(hash.class.new) do |key, seed|
8
8
  seed[key] = hash[key]
9
9
  seed[key] = sort_hash_by_key(seed[key], true, &block) if recursive && seed[key].is_a?(Hash)
10
10
 
@@ -29,5 +29,22 @@ module Facter
29
29
  object
30
30
  end
31
31
  end
32
+
33
+ def self.try_to_bool(value)
34
+ case value.to_s
35
+ when 'true'
36
+ true
37
+ when 'false'
38
+ false
39
+ else
40
+ value
41
+ end
42
+ end
43
+
44
+ def self.try_to_int(value)
45
+ Integer(value)
46
+ rescue ArgumentError, TypeError
47
+ value
48
+ end
32
49
  end
33
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Facter
4
- VERSION = '4.0.50' unless defined?(VERSION)
4
+ VERSION = '4.2.0' unless defined?(VERSION)
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.50
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.12'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.12'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: yard
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +170,7 @@ dependencies:
156
170
  - - "<"
157
171
  - !ruby/object:Gem::Version
158
172
  version: '2.0'
159
- description: New version of Facter
173
+ description: You can prove anything with facts!
160
174
  email:
161
175
  - team-nw@puppet.com
162
176
  executables:
@@ -166,6 +180,7 @@ extra_rdoc_files: []
166
180
  files:
167
181
  - bin/facter
168
182
  - lib/docs/generate.rb
183
+ - lib/docs/generate_cli.rb
169
184
  - lib/docs/template.erb
170
185
  - lib/facter.rb
171
186
  - lib/facter/config.rb
@@ -259,10 +274,12 @@ files:
259
274
  - lib/facter/facts/aix/partitions.rb
260
275
  - lib/facter/facts/aix/path.rb
261
276
  - lib/facter/facts/aix/processor.rb
277
+ - lib/facter/facts/aix/processors/cores.rb
262
278
  - lib/facter/facts/aix/processors/count.rb
263
279
  - lib/facter/facts/aix/processors/isa.rb
264
280
  - lib/facter/facts/aix/processors/models.rb
265
281
  - lib/facter/facts/aix/processors/speed.rb
282
+ - lib/facter/facts/aix/processors/threads.rb
266
283
  - lib/facter/facts/aix/ruby/platform.rb
267
284
  - lib/facter/facts/aix/ruby/sitedir.rb
268
285
  - lib/facter/facts/aix/ruby/version.rb
@@ -277,6 +294,13 @@ files:
277
294
  - lib/facter/facts/aix/system_uptime/uptime.rb
278
295
  - lib/facter/facts/aix/timezone.rb
279
296
  - lib/facter/facts/alpine/os/release.rb
297
+ - lib/facter/facts/amzn/lsbdistcodename.rb
298
+ - lib/facter/facts/amzn/lsbdistdescription.rb
299
+ - lib/facter/facts/amzn/lsbdistid.rb
300
+ - lib/facter/facts/amzn/os/distro/codename.rb
301
+ - lib/facter/facts/amzn/os/distro/description.rb
302
+ - lib/facter/facts/amzn/os/distro/id.rb
303
+ - lib/facter/facts/amzn/os/distro/release.rb
280
304
  - lib/facter/facts/amzn/os/release.rb
281
305
  - lib/facter/facts/bsd/kernelmajversion.rb
282
306
  - lib/facter/facts/bsd/kernelversion.rb
@@ -379,7 +403,8 @@ files:
379
403
  - lib/facter/facts/gentoo/os/release.rb
380
404
  - lib/facter/facts/linux/aio_agent_version.rb
381
405
  - lib/facter/facts/linux/augeas/version.rb
382
- - lib/facter/facts/linux/cloud.rb
406
+ - lib/facter/facts/linux/az_metadata.rb
407
+ - lib/facter/facts/linux/cloud/provider.rb
383
408
  - lib/facter/facts/linux/dhcp_servers.rb
384
409
  - lib/facter/facts/linux/disks.rb
385
410
  - lib/facter/facts/linux/dmi/bios/release_date.rb
@@ -480,11 +505,13 @@ files:
480
505
  - lib/facter/facts/linux/partitions.rb
481
506
  - lib/facter/facts/linux/path.rb
482
507
  - lib/facter/facts/linux/processor.rb
508
+ - lib/facter/facts/linux/processors/cores.rb
483
509
  - lib/facter/facts/linux/processors/count.rb
484
510
  - lib/facter/facts/linux/processors/isa.rb
485
511
  - lib/facter/facts/linux/processors/models.rb
486
512
  - lib/facter/facts/linux/processors/physicalcount.rb
487
513
  - lib/facter/facts/linux/processors/speed.rb
514
+ - lib/facter/facts/linux/processors/threads.rb
488
515
  - lib/facter/facts/linux/ruby/platform.rb
489
516
  - lib/facter/facts/linux/ruby/sitedir.rb
490
517
  - lib/facter/facts/linux/ruby/version.rb
@@ -567,11 +594,13 @@ files:
567
594
  - lib/facter/facts/macosx/os/name.rb
568
595
  - lib/facter/facts/macosx/os/release.rb
569
596
  - lib/facter/facts/macosx/path.rb
597
+ - lib/facter/facts/macosx/processors/cores.rb
570
598
  - lib/facter/facts/macosx/processors/count.rb
571
599
  - lib/facter/facts/macosx/processors/isa.rb
572
600
  - lib/facter/facts/macosx/processors/models.rb
573
601
  - lib/facter/facts/macosx/processors/physicalcount.rb
574
602
  - lib/facter/facts/macosx/processors/speed.rb
603
+ - lib/facter/facts/macosx/processors/threads.rb
575
604
  - lib/facter/facts/macosx/ruby/platform.rb
576
605
  - lib/facter/facts/macosx/ruby/sitedir.rb
577
606
  - lib/facter/facts/macosx/ruby/version.rb
@@ -613,6 +642,9 @@ files:
613
642
  - lib/facter/facts/openwrt/os/release.rb
614
643
  - lib/facter/facts/ovs/os/release.rb
615
644
  - lib/facter/facts/photon/os/release.rb
645
+ - lib/facter/facts/rhel/lsbdistcodename.rb
646
+ - lib/facter/facts/rhel/lsbdistdescription.rb
647
+ - lib/facter/facts/rhel/lsbdistid.rb
616
648
  - lib/facter/facts/rhel/os/distro/codename.rb
617
649
  - lib/facter/facts/rhel/os/distro/description.rb
618
650
  - lib/facter/facts/rhel/os/distro/id.rb
@@ -621,6 +653,9 @@ files:
621
653
  - lib/facter/facts/rhel/os/name.rb
622
654
  - lib/facter/facts/rhel/os/release.rb
623
655
  - lib/facter/facts/slackware/os/release.rb
656
+ - lib/facter/facts/sles/lsbdistcodename.rb
657
+ - lib/facter/facts/sles/lsbdistdescription.rb
658
+ - lib/facter/facts/sles/lsbdistid.rb
624
659
  - lib/facter/facts/sles/os/distro/codename.rb
625
660
  - lib/facter/facts/sles/os/distro/description.rb
626
661
  - lib/facter/facts/sles/os/distro/id.rb
@@ -701,11 +736,13 @@ files:
701
736
  - lib/facter/facts/solaris/os/name.rb
702
737
  - lib/facter/facts/solaris/os/release.rb
703
738
  - lib/facter/facts/solaris/path.rb
739
+ - lib/facter/facts/solaris/processors/cores.rb
704
740
  - lib/facter/facts/solaris/processors/count.rb
705
741
  - lib/facter/facts/solaris/processors/isa.rb
706
742
  - lib/facter/facts/solaris/processors/models.rb
707
743
  - lib/facter/facts/solaris/processors/physicalcount.rb
708
744
  - lib/facter/facts/solaris/processors/speed.rb
745
+ - lib/facter/facts/solaris/processors/threads.rb
709
746
  - lib/facter/facts/solaris/ruby/platform.rb
710
747
  - lib/facter/facts/solaris/ruby/sitedir.rb
711
748
  - lib/facter/facts/solaris/ruby/version.rb
@@ -729,6 +766,8 @@ files:
729
766
  - lib/facter/facts/ubuntu/os/release.rb
730
767
  - lib/facter/facts/windows/aio_agent_version.rb
731
768
  - lib/facter/facts/windows/augeas/version.rb
769
+ - lib/facter/facts/windows/az_metadata.rb
770
+ - lib/facter/facts/windows/cloud/provider.rb
732
771
  - lib/facter/facts/windows/dhcp_servers.rb
733
772
  - lib/facter/facts/windows/dmi/manufacturer.rb
734
773
  - lib/facter/facts/windows/dmi/product/name.rb
@@ -749,6 +788,7 @@ files:
749
788
  - lib/facter/facts/windows/interfaces.rb
750
789
  - lib/facter/facts/windows/ipaddress6_interfaces.rb
751
790
  - lib/facter/facts/windows/ipaddress_interfaces.rb
791
+ - lib/facter/facts/windows/is_virtual.rb
752
792
  - lib/facter/facts/windows/kernel.rb
753
793
  - lib/facter/facts/windows/kernelmajversion.rb
754
794
  - lib/facter/facts/windows/kernelrelease.rb
@@ -793,10 +833,12 @@ files:
793
833
  - lib/facter/facts/windows/os/windows/system32.rb
794
834
  - lib/facter/facts/windows/path.rb
795
835
  - lib/facter/facts/windows/processor.rb
836
+ - lib/facter/facts/windows/processors/cores.rb
796
837
  - lib/facter/facts/windows/processors/count.rb
797
838
  - lib/facter/facts/windows/processors/isa.rb
798
839
  - lib/facter/facts/windows/processors/models.rb
799
840
  - lib/facter/facts/windows/processors/physicalcount.rb
841
+ - lib/facter/facts/windows/processors/threads.rb
800
842
  - lib/facter/facts/windows/ruby/platform.rb
801
843
  - lib/facter/facts/windows/ruby/sitedir.rb
802
844
  - lib/facter/facts/windows/ruby/version.rb
@@ -809,8 +851,7 @@ files:
809
851
  - lib/facter/facts/windows/system_uptime/seconds.rb
810
852
  - lib/facter/facts/windows/system_uptime/uptime.rb
811
853
  - lib/facter/facts/windows/timezone.rb
812
- - lib/facter/facts/windows/virtualization/is_virtual.rb
813
- - lib/facter/facts/windows/virtualization/virtual.rb
854
+ - lib/facter/facts/windows/virtual.rb
814
855
  - lib/facter/framework/benchmarking/timer.rb
815
856
  - lib/facter/framework/cli/cli.rb
816
857
  - lib/facter/framework/cli/cli_launcher.rb
@@ -820,7 +861,6 @@ files:
820
861
  - lib/facter/framework/core/fact/external/external_fact_manager.rb
821
862
  - lib/facter/framework/core/fact/internal/core_fact.rb
822
863
  - lib/facter/framework/core/fact/internal/internal_fact_manager.rb
823
- - lib/facter/framework/core/fact_augmenter.rb
824
864
  - lib/facter/framework/core/fact_filter.rb
825
865
  - lib/facter/framework/core/fact_loaders/class_discoverer.rb
826
866
  - lib/facter/framework/core/fact_loaders/external_fact_loader.rb
@@ -867,10 +907,10 @@ files:
867
907
  - lib/facter/resolvers/aix/processors.rb
868
908
  - lib/facter/resolvers/aix/serialnumber.rb
869
909
  - lib/facter/resolvers/augeas.rb
910
+ - lib/facter/resolvers/az.rb
870
911
  - lib/facter/resolvers/base_resolver.rb
871
912
  - lib/facter/resolvers/bsd/ffi/ffi_helper.rb
872
913
  - lib/facter/resolvers/bsd/processors.rb
873
- - lib/facter/resolvers/cloud.rb
874
914
  - lib/facter/resolvers/containers.rb
875
915
  - lib/facter/resolvers/debian_version.rb
876
916
  - lib/facter/resolvers/disk.rb
@@ -893,7 +933,9 @@ files:
893
933
  - lib/facter/resolvers/hostname.rb
894
934
  - lib/facter/resolvers/identity.rb
895
935
  - lib/facter/resolvers/linux/docker_uptime.rb
936
+ - lib/facter/resolvers/linux/hostname.rb
896
937
  - lib/facter/resolvers/linux/load_averages.rb
938
+ - lib/facter/resolvers/linux/networking.rb
897
939
  - lib/facter/resolvers/load_averages.rb
898
940
  - lib/facter/resolvers/lpar.rb
899
941
  - lib/facter/resolvers/lsb_release.rb
@@ -909,12 +951,12 @@ files:
909
951
  - lib/facter/resolvers/memory.rb
910
952
  - lib/facter/resolvers/mountpoints.rb
911
953
  - lib/facter/resolvers/networking.rb
912
- - lib/facter/resolvers/networking_linux.rb
913
954
  - lib/facter/resolvers/open_vz.rb
914
955
  - lib/facter/resolvers/os_release.rb
915
956
  - lib/facter/resolvers/partitions.rb
916
957
  - lib/facter/resolvers/path.rb
917
958
  - lib/facter/resolvers/processors.rb
959
+ - lib/facter/resolvers/processors_lscpu.rb
918
960
  - lib/facter/resolvers/redhat_release.rb
919
961
  - lib/facter/resolvers/release_from_first_line.rb
920
962
  - lib/facter/resolvers/ruby.rb
@@ -982,13 +1024,18 @@ files:
982
1024
  - lib/facter/util/aix/odm_query.rb
983
1025
  - lib/facter/util/api_debugger.rb
984
1026
  - lib/facter/util/facts/facts_utils.rb
1027
+ - lib/facter/util/facts/posix/virtual_detector.rb
985
1028
  - lib/facter/util/facts/unit_converter.rb
986
1029
  - lib/facter/util/facts/uptime_parser.rb
987
- - lib/facter/util/facts/virtual_detector.rb
988
1030
  - lib/facter/util/facts/windows_release_finder.rb
989
1031
  - lib/facter/util/file_helper.rb
1032
+ - lib/facter/util/linux/dhcp.rb
1033
+ - lib/facter/util/linux/if_inet6.rb
1034
+ - lib/facter/util/linux/routing_table.rb
1035
+ - lib/facter/util/linux/socket_parser.rb
990
1036
  - lib/facter/util/macosx/system_profile_executor.rb
991
1037
  - lib/facter/util/resolvers/aws_token.rb
1038
+ - lib/facter/util/resolvers/ffi/hostname.rb
992
1039
  - lib/facter/util/resolvers/ffi/load_averages.rb
993
1040
  - lib/facter/util/resolvers/filesystem_helper.rb
994
1041
  - lib/facter/util/resolvers/fingerprint.rb
@@ -1002,7 +1049,7 @@ files:
1002
1049
  - lib/facter/util/utils.rb
1003
1050
  - lib/facter/util/windows/win32ole.rb
1004
1051
  - lib/facter/version.rb
1005
- homepage:
1052
+ homepage: https://github.com/puppetlabs/facter
1006
1053
  licenses:
1007
1054
  - MIT
1008
1055
  metadata: {}
@@ -1012,9 +1059,12 @@ require_paths:
1012
1059
  - lib
1013
1060
  required_ruby_version: !ruby/object:Gem::Requirement
1014
1061
  requirements:
1015
- - - "~>"
1062
+ - - ">="
1016
1063
  - !ruby/object:Gem::Version
1017
1064
  version: '2.3'
1065
+ - - "<"
1066
+ - !ruby/object:Gem::Version
1067
+ version: '4.0'
1018
1068
  required_rubygems_version: !ruby/object:Gem::Requirement
1019
1069
  requirements:
1020
1070
  - - ">="
@@ -1024,5 +1074,5 @@ requirements: []
1024
1074
  rubygems_version: 3.0.8
1025
1075
  signing_key:
1026
1076
  specification_version: 4
1027
- summary: New version of Facter
1077
+ summary: Facter, a system inventory tool
1028
1078
  test_files: []
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Facts
4
- module Linux
5
- class Cloud
6
- FACT_NAME = 'cloud'
7
-
8
- def call_the_resolver
9
- cloud_provider = Facter::Resolvers::Cloud.resolve(:cloud_provider)
10
-
11
- Facter::ResolvedFact.new(FACT_NAME, cloud_provider)
12
- end
13
- end
14
- end
15
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Facter
4
- module FactAugmenter
5
- def self.augment_resolved_facts(searched_facts, resolved_facts)
6
- augumented_resolved_facts = []
7
- searched_facts.each do |searched_fact|
8
- matched_facts = get_resolved_facts_for_searched_fact(searched_fact, resolved_facts)
9
- augment_resolved_fact_for_user_query!(searched_fact, matched_facts)
10
- augumented_resolved_facts.concat(matched_facts)
11
- end
12
-
13
- augumented_resolved_facts
14
- end
15
-
16
- private_class_method def self.get_resolved_facts_for_searched_fact(searched_fact, resolved_facts)
17
- if searched_fact.name.include?('.*')
18
- resolved_facts
19
- .select { |resolved_fact| resolved_fact.name.match(searched_fact.name) }
20
- .reject(&:user_query)
21
- .uniq(&:name)
22
- else
23
- resolved_facts
24
- .select { |resolved_fact| searched_fact.name.eql?(resolved_fact.name) }
25
- .reject(&:user_query)
26
- .uniq(&:name)
27
- end
28
- end
29
-
30
- private_class_method def self.augment_resolved_fact_for_user_query!(searched_fact, matched_facts)
31
- matched_facts.each do |matched_fact|
32
- matched_fact.user_query = searched_fact.user_query
33
- matched_fact.filter_tokens = searched_fact.filter_tokens
34
- end
35
- end
36
- end
37
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Facter
4
- module Resolvers
5
- class Cloud < BaseResolver
6
- # cloud_provider
7
-
8
- init_resolver
9
-
10
- class << self
11
- private
12
-
13
- def post_resolve(fact_name, _options)
14
- @fact_list.fetch(fact_name) { detect_azure(fact_name) }
15
- end
16
-
17
- def detect_azure(fact_name)
18
- search_dirs = %w[/var/lib/dhcp /var/lib/NetworkManager]
19
- search_dirs.each do |path|
20
- next if !File.readable?(path) || !File.directory?(path)
21
-
22
- files = Dir.entries(path)
23
- files.select! { |filename| filename =~ /^dhclient.*lease.*$/ }
24
- files.each do |file|
25
- path = File.join([path, file])
26
- output = Facter::Util::FileHelper.safe_read(path)
27
-
28
- if output.include?('option unknown-245') || output.include?('option 245')
29
- @fact_list[:cloud_provider] = 'azure'
30
- return @fact_list[fact_name]
31
- end
32
- end
33
- end
34
- nil
35
- end
36
- end
37
- end
38
- end
39
- end