facter 4.0.43 → 4.0.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/lib/docs/generate.rb +32 -0
  3. data/lib/docs/template.erb +34 -0
  4. data/lib/facter.rb +65 -9
  5. data/lib/facter/config.rb +385 -0
  6. data/lib/facter/custom_facts/core/aggregate.rb +7 -0
  7. data/lib/facter/custom_facts/core/execution.rb +28 -4
  8. data/lib/facter/custom_facts/core/execution/base.rb +33 -33
  9. data/lib/facter/custom_facts/util/collection.rb +1 -2
  10. data/lib/facter/custom_facts/util/directory_loader.rb +1 -1
  11. data/lib/facter/custom_facts/util/fact.rb +39 -3
  12. data/lib/facter/custom_facts/util/loader.rb +1 -1
  13. data/lib/facter/custom_facts/util/parser.rb +17 -3
  14. data/lib/facter/custom_facts/util/resolution.rb +2 -2
  15. data/lib/facter/facts/aix/disks.rb +1 -1
  16. data/lib/facter/facts/aix/interfaces.rb +1 -0
  17. data/lib/facter/facts/aix/memory/swap/available.rb +1 -1
  18. data/lib/facter/facts/aix/memory/swap/available_bytes.rb +1 -1
  19. data/lib/facter/facts/aix/memory/swap/total.rb +1 -1
  20. data/lib/facter/facts/aix/memory/swap/total_bytes.rb +1 -1
  21. data/lib/facter/facts/aix/memory/swap/used.rb +1 -1
  22. data/lib/facter/facts/aix/memory/system/available.rb +1 -1
  23. data/lib/facter/facts/aix/memory/system/available_bytes.rb +1 -1
  24. data/lib/facter/facts/aix/memory/system/total.rb +1 -1
  25. data/lib/facter/facts/aix/memory/system/total_bytes.rb +1 -1
  26. data/lib/facter/facts/aix/memory/system/used.rb +1 -1
  27. data/lib/facter/facts/aix/processors/speed.rb +1 -1
  28. data/lib/facter/facts/aix/ssh.rb +1 -1
  29. data/lib/facter/facts/aix/sshalgorithmkey.rb +1 -1
  30. data/lib/facter/facts/aix/sshfp_algorithm.rb +1 -1
  31. data/lib/facter/facts/bsd/processors/speed.rb +1 -1
  32. data/lib/facter/facts/freebsd/is_virtual.rb +25 -0
  33. data/lib/facter/facts/freebsd/memory/swap/available.rb +1 -1
  34. data/lib/facter/facts/freebsd/memory/swap/available_bytes.rb +1 -1
  35. data/lib/facter/facts/freebsd/memory/swap/total.rb +1 -1
  36. data/lib/facter/facts/freebsd/memory/swap/total_bytes.rb +1 -1
  37. data/lib/facter/facts/freebsd/memory/swap/used.rb +1 -1
  38. data/lib/facter/facts/freebsd/memory/system/available.rb +1 -1
  39. data/lib/facter/facts/freebsd/memory/system/available_bytes.rb +1 -1
  40. data/lib/facter/facts/freebsd/memory/system/total.rb +1 -1
  41. data/lib/facter/facts/freebsd/memory/system/total_bytes.rb +1 -1
  42. data/lib/facter/facts/freebsd/memory/system/used.rb +1 -1
  43. data/lib/facter/facts/freebsd/processors/speed.rb +1 -1
  44. data/lib/facter/facts/freebsd/ssh.rb +1 -1
  45. data/lib/facter/facts/freebsd/sshalgorithmkey.rb +1 -1
  46. data/lib/facter/facts/freebsd/sshfp_algorithm.rb +1 -1
  47. data/lib/facter/facts/freebsd/virtual.rb +22 -0
  48. data/lib/facter/facts/linux/dhcp_servers.rb +1 -0
  49. data/lib/facter/facts/linux/disks.rb +1 -1
  50. data/lib/facter/facts/linux/ec2_metadata.rb +1 -1
  51. data/lib/facter/facts/linux/ec2_userdata.rb +1 -1
  52. data/lib/facter/facts/linux/hypervisors/kvm.rb +1 -1
  53. data/lib/facter/facts/linux/hypervisors/xen.rb +1 -1
  54. data/lib/facter/facts/linux/interfaces.rb +1 -0
  55. data/lib/facter/facts/linux/is_virtual.rb +2 -2
  56. data/lib/facter/facts/linux/memory/swap/available.rb +1 -1
  57. data/lib/facter/facts/linux/memory/swap/available_bytes.rb +1 -1
  58. data/lib/facter/facts/linux/memory/swap/total.rb +1 -1
  59. data/lib/facter/facts/linux/memory/swap/total_bytes.rb +1 -1
  60. data/lib/facter/facts/linux/memory/swap/used.rb +1 -1
  61. data/lib/facter/facts/linux/memory/system/available.rb +1 -1
  62. data/lib/facter/facts/linux/memory/system/available_bytes.rb +1 -1
  63. data/lib/facter/facts/linux/memory/system/total.rb +1 -1
  64. data/lib/facter/facts/linux/memory/system/total_bytes.rb +1 -1
  65. data/lib/facter/facts/linux/memory/system/used.rb +1 -1
  66. data/lib/facter/facts/linux/os/family.rb +4 -2
  67. data/lib/facter/facts/linux/processors/speed.rb +1 -1
  68. data/lib/facter/facts/linux/ssh.rb +1 -1
  69. data/lib/facter/facts/linux/sshalgorithmkey.rb +1 -1
  70. data/lib/facter/facts/linux/sshfp_algorithm.rb +1 -1
  71. data/lib/facter/facts/linux/virtual.rb +1 -1
  72. data/lib/facter/facts/macosx/dhcp_servers.rb +1 -0
  73. data/lib/facter/facts/macosx/interfaces.rb +1 -0
  74. data/lib/facter/facts/macosx/memory/swap/available.rb +1 -1
  75. data/lib/facter/facts/macosx/memory/swap/available_bytes.rb +1 -1
  76. data/lib/facter/facts/macosx/memory/swap/total.rb +1 -1
  77. data/lib/facter/facts/macosx/memory/swap/total_bytes.rb +1 -1
  78. data/lib/facter/facts/macosx/memory/swap/used.rb +1 -1
  79. data/lib/facter/facts/macosx/memory/system/available.rb +1 -1
  80. data/lib/facter/facts/macosx/memory/system/available_bytes.rb +1 -1
  81. data/lib/facter/facts/macosx/memory/system/total.rb +1 -1
  82. data/lib/facter/facts/macosx/memory/system/total_bytes.rb +1 -1
  83. data/lib/facter/facts/macosx/memory/system/used.rb +1 -1
  84. data/lib/facter/facts/macosx/processors/speed.rb +1 -1
  85. data/lib/facter/facts/macosx/ssh.rb +1 -1
  86. data/lib/facter/facts/macosx/sshalgorithmkey.rb +1 -1
  87. data/lib/facter/facts/macosx/sshfp_algorithm.rb +1 -1
  88. data/lib/facter/facts/rhel/os/release.rb +1 -1
  89. data/lib/facter/facts/solaris/dhcp_servers.rb +1 -0
  90. data/lib/facter/facts/solaris/disks.rb +1 -1
  91. data/lib/facter/facts/solaris/hypervisors/ldom.rb +3 -0
  92. data/lib/facter/facts/solaris/interfaces.rb +1 -0
  93. data/lib/facter/facts/solaris/is_virtual.rb +2 -2
  94. data/lib/facter/facts/solaris/ldom.rb +34 -4
  95. data/lib/facter/facts/solaris/memory/swap/available.rb +1 -1
  96. data/lib/facter/facts/solaris/memory/swap/available_bytes.rb +1 -1
  97. data/lib/facter/facts/solaris/memory/swap/total.rb +1 -1
  98. data/lib/facter/facts/solaris/memory/swap/total_bytes.rb +1 -1
  99. data/lib/facter/facts/solaris/memory/swap/used.rb +1 -1
  100. data/lib/facter/facts/solaris/memory/system/available.rb +1 -1
  101. data/lib/facter/facts/solaris/memory/system/available_bytes.rb +1 -1
  102. data/lib/facter/facts/solaris/memory/system/total.rb +1 -1
  103. data/lib/facter/facts/solaris/memory/system/total_bytes.rb +1 -1
  104. data/lib/facter/facts/solaris/memory/system/used.rb +1 -1
  105. data/lib/facter/facts/solaris/processors/speed.rb +1 -1
  106. data/lib/facter/facts/solaris/ssh.rb +1 -1
  107. data/lib/facter/facts/solaris/sshalgorithmkey.rb +1 -1
  108. data/lib/facter/facts/solaris/sshfp_algorithm.rb +1 -1
  109. data/lib/facter/facts/solaris/virtual.rb +1 -1
  110. data/lib/facter/facts/windows/dhcp_servers.rb +1 -0
  111. data/lib/facter/facts/windows/interfaces.rb +1 -0
  112. data/lib/facter/facts/windows/memory/system/available.rb +1 -1
  113. data/lib/facter/facts/windows/memory/system/available_bytes.rb +1 -1
  114. data/lib/facter/facts/windows/memory/system/total.rb +1 -1
  115. data/lib/facter/facts/windows/memory/system/total_bytes.rb +1 -1
  116. data/lib/facter/facts/windows/memory/system/used.rb +1 -1
  117. data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
  118. data/lib/facter/facts/windows/os/release.rb +1 -1
  119. data/lib/facter/framework/benchmarking/timer.rb +4 -2
  120. data/lib/facter/framework/cli/cli.rb +20 -6
  121. data/lib/facter/framework/config/fact_groups.rb +10 -8
  122. data/lib/facter/framework/core/cache_manager.rb +62 -17
  123. data/lib/facter/framework/core/fact/internal/core_fact.rb +6 -1
  124. data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +38 -4
  125. data/lib/facter/framework/core/fact_augmenter.rb +1 -1
  126. data/lib/facter/framework/core/fact_loaders/external_fact_loader.rb +4 -2
  127. data/lib/facter/framework/core/fact_loaders/fact_loader.rb +17 -1
  128. data/lib/facter/framework/core/fact_manager.rb +15 -3
  129. data/lib/facter/framework/core/file_loader.rb +6 -2
  130. data/lib/facter/framework/core/options/config_file_options.rb +16 -5
  131. data/lib/facter/framework/core/options/option_store.rb +42 -20
  132. data/lib/facter/framework/detector/os_detector.rb +1 -0
  133. data/lib/facter/framework/detector/os_hierarchy.rb +5 -9
  134. data/lib/facter/framework/logging/logger.rb +3 -3
  135. data/lib/facter/models/fact_collection.rb +11 -1
  136. data/lib/facter/models/loaded_fact.rb +2 -1
  137. data/lib/facter/resolvers/aio_agent_version.rb +2 -2
  138. data/lib/facter/resolvers/aix/{architecture_resolver.rb → architecture.rb} +19 -4
  139. data/lib/facter/resolvers/aix/disks.rb +6 -5
  140. data/lib/facter/resolvers/aix/{filesystem_resolver.rb → filesystem.rb} +2 -2
  141. data/lib/facter/resolvers/aix/{hardware_resolver.rb → hardware.rb} +4 -3
  142. data/lib/facter/resolvers/aix/{load_averages_resolver.rb → load_averages.rb} +2 -1
  143. data/lib/facter/resolvers/aix/memory.rb +4 -3
  144. data/lib/facter/resolvers/aix/mountpoints.rb +6 -5
  145. data/lib/facter/resolvers/aix/{networking_resolver.rb → networking.rb} +4 -3
  146. data/lib/facter/resolvers/aix/nim.rb +1 -1
  147. data/lib/facter/resolvers/aix/os_level.rb +1 -1
  148. data/lib/facter/resolvers/aix/partitions.rb +7 -6
  149. data/lib/facter/resolvers/aix/processors.rb +5 -4
  150. data/lib/facter/resolvers/aix/serialnumber.rb +2 -2
  151. data/lib/facter/resolvers/{augeas_resolver.rb → augeas.rb} +8 -2
  152. data/lib/facter/resolvers/base_resolver.rb +14 -4
  153. data/lib/facter/resolvers/bsd/processors.rb +13 -8
  154. data/lib/facter/resolvers/cloud.rb +2 -2
  155. data/lib/facter/resolvers/containers.rb +5 -4
  156. data/lib/facter/resolvers/debian_version.rb +2 -2
  157. data/lib/facter/resolvers/{disk_resolver.rb → disk.rb} +17 -6
  158. data/lib/facter/resolvers/{dmi_resolver.rb → dmi.rb} +3 -2
  159. data/lib/facter/resolvers/dmi_decode.rb +1 -1
  160. data/lib/facter/resolvers/ec2.rb +5 -2
  161. data/lib/facter/resolvers/{eos_release_resolver.rb → eos_release.rb} +2 -2
  162. data/lib/facter/resolvers/{facterversion_resolver.rb → facterversion.rb} +1 -1
  163. data/lib/facter/resolvers/{filesystems_resolver.rb → filesystems.rb} +5 -2
  164. data/lib/facter/resolvers/{fips_enabled_resolver.rb → fips_enabled.rb} +5 -2
  165. data/lib/facter/resolvers/freebsd/{dmi_resolver.rb → dmi.rb} +1 -1
  166. data/lib/facter/resolvers/freebsd/{freebsd_version_resolver.rb → freebsd_version.rb} +9 -7
  167. data/lib/facter/resolvers/freebsd/{geom_resolver.rb → geom.rb} +15 -22
  168. data/lib/facter/resolvers/freebsd/processors.rb +13 -8
  169. data/lib/facter/resolvers/freebsd/{swap_memory_resolver.rb → swap_memory.rb} +5 -3
  170. data/lib/facter/resolvers/freebsd/{system_memory_resolver.rb → system_memory.rb} +4 -2
  171. data/lib/facter/resolvers/freebsd/virtual.rb +45 -0
  172. data/lib/facter/resolvers/gce.rb +3 -2
  173. data/lib/facter/resolvers/hostname.rb +92 -0
  174. data/lib/facter/resolvers/{identity_resolver.rb → identity.rb} +2 -1
  175. data/lib/facter/resolvers/linux/docker_uptime.rb +3 -2
  176. data/lib/facter/resolvers/linux/load_averages.rb +3 -2
  177. data/lib/facter/resolvers/load_averages.rb +5 -3
  178. data/lib/facter/resolvers/{lpar_resolver.rb → lpar.rb} +1 -1
  179. data/lib/facter/resolvers/{lsb_release_resolver.rb → lsb_release.rb} +1 -1
  180. data/lib/facter/resolvers/lspci.rb +1 -1
  181. data/lib/facter/resolvers/macosx/{dmi_resolver.rb → dmi.rb} +1 -1
  182. data/lib/facter/resolvers/macosx/{filesystems_resolver.rb → filesystems.rb} +1 -1
  183. data/lib/facter/resolvers/macosx/{load_averages_resolver.rb → load_averages.rb} +2 -1
  184. data/lib/facter/resolvers/macosx/{mountpoints_resolver.rb → mountpoints.rb} +9 -8
  185. data/lib/facter/resolvers/macosx/{processor_resolver.rb → processor.rb} +2 -1
  186. data/lib/facter/resolvers/macosx/{swap_memory_resolver.rb → swap_memory.rb} +2 -1
  187. data/lib/facter/resolvers/macosx/{system_memory_resolver.rb → system_memory.rb} +2 -1
  188. data/lib/facter/resolvers/macosx/{system_profiler_resolver.rb → system_profiler.rb} +4 -6
  189. data/lib/facter/resolvers/{memory_resolver.rb → memory.rb} +4 -2
  190. data/lib/facter/resolvers/mountpoints.rb +90 -0
  191. data/lib/facter/resolvers/{networking_resolver.rb → networking.rb} +9 -6
  192. data/lib/facter/resolvers/networking_linux.rb +296 -0
  193. data/lib/facter/resolvers/open_vz.rb +2 -4
  194. data/lib/facter/resolvers/{os_release_resolver.rb → os_release.rb} +2 -2
  195. data/lib/facter/resolvers/partitions.rb +67 -63
  196. data/lib/facter/resolvers/{path_resolver.rb → path.rb} +1 -1
  197. data/lib/facter/resolvers/{processors_resolver.rb → processors.rb} +6 -3
  198. data/lib/facter/resolvers/{redhat_release_resolver.rb → redhat_release.rb} +2 -2
  199. data/lib/facter/resolvers/{ruby_resolver.rb → ruby.rb} +1 -1
  200. data/lib/facter/resolvers/{selinux_resolver.rb → selinux.rb} +4 -4
  201. data/lib/facter/resolvers/solaris/disks.rb +2 -2
  202. data/lib/facter/resolvers/solaris/dmi.rb +3 -1
  203. data/lib/facter/resolvers/solaris/dmi_sparc.rb +1 -1
  204. data/lib/facter/resolvers/solaris/filesystems.rb +1 -1
  205. data/lib/facter/resolvers/solaris/ipaddress.rb +2 -1
  206. data/lib/facter/resolvers/solaris/ldom.rb +1 -3
  207. data/lib/facter/resolvers/solaris/memory.rb +4 -3
  208. data/lib/facter/resolvers/solaris/mountpoints.rb +13 -12
  209. data/lib/facter/resolvers/solaris/networking.rb +50 -43
  210. data/lib/facter/resolvers/solaris/os_release.rb +7 -5
  211. data/lib/facter/resolvers/solaris/processors.rb +2 -1
  212. data/lib/facter/resolvers/solaris/zone.rb +1 -1
  213. data/lib/facter/resolvers/solaris/zone_name.rb +1 -1
  214. data/lib/facter/resolvers/{ssh_resolver.rb → ssh.rb} +12 -8
  215. data/lib/facter/resolvers/{suse_release_resolver.rb → suse_release.rb} +2 -2
  216. data/lib/facter/resolvers/{sw_vers_resolver.rb → sw_vers.rb} +2 -2
  217. data/lib/facter/resolvers/{timezone_resolver.rb → timezone.rb} +1 -1
  218. data/lib/facter/resolvers/{uname_resolver.rb → uname.rb} +1 -1
  219. data/lib/facter/resolvers/{uptime_resolver.rb → uptime.rb} +3 -3
  220. data/lib/facter/resolvers/virt_what.rb +1 -1
  221. data/lib/facter/resolvers/vmware.rb +1 -1
  222. data/lib/facter/resolvers/windows/aio_agent_version.rb +2 -2
  223. data/lib/facter/resolvers/windows/{dmi_bios_resolver.rb → dmi_bios.rb} +2 -2
  224. data/lib/facter/resolvers/windows/{dmi_computersystem_resolver.rb → dmi_computersystem.rb} +2 -2
  225. data/lib/facter/resolvers/windows/{fips_resolver.rb → fips.rb} +2 -1
  226. data/lib/facter/resolvers/windows/{hardware_architecture_resolver.rb → hardware_architecture.rb} +2 -1
  227. data/lib/facter/resolvers/windows/{identity_resolver.rb → identity.rb} +2 -1
  228. data/lib/facter/resolvers/windows/{kernel_resolver.rb → kernel.rb} +3 -1
  229. data/lib/facter/resolvers/windows/{memory_resolver.rb → memory.rb} +7 -1
  230. data/lib/facter/resolvers/windows/{netkvm_resolver.rb → netkvm.rb} +2 -1
  231. data/lib/facter/resolvers/windows/{networking_resolver.rb → networking.rb} +18 -4
  232. data/lib/facter/resolvers/windows/{processors_resolver.rb → processors.rb} +3 -2
  233. data/lib/facter/resolvers/windows/{product_release_resolver.rb → product_release.rb} +2 -1
  234. data/lib/facter/resolvers/windows/ssh.rb +5 -3
  235. data/lib/facter/resolvers/windows/{system32_resolver.rb → system32.rb} +3 -1
  236. data/lib/facter/resolvers/windows/{uptime_resolver.rb → uptime.rb} +3 -2
  237. data/lib/facter/resolvers/windows/{virtualization_resolver.rb → virtualization.rb} +3 -2
  238. data/lib/facter/resolvers/windows/{win_os_description_resolver.rb → win_os_description.rb} +4 -2
  239. data/lib/facter/resolvers/{wpar_resolver.rb → wpar.rb} +1 -1
  240. data/lib/facter/resolvers/xen.rb +2 -2
  241. data/lib/facter/resolvers/zfs.rb +2 -1
  242. data/lib/facter/resolvers/zpool.rb +2 -1
  243. data/lib/facter/util/aix/info_extractor.rb +24 -0
  244. data/lib/facter/util/aix/odm_query.rb +46 -0
  245. data/lib/facter/util/api_debugger.rb +33 -29
  246. data/lib/facter/util/facts/facts_utils.rb +30 -0
  247. data/lib/facter/util/facts/unit_converter.rb +61 -0
  248. data/lib/facter/util/facts/uptime_parser.rb +128 -0
  249. data/lib/facter/util/facts/virtual_detector.rb +90 -0
  250. data/lib/facter/util/facts/windows_release_finder.rb +55 -0
  251. data/lib/facter/{resolvers/macosx/utils → util/macosx}/system_profile_executor.rb +1 -1
  252. data/lib/facter/util/resolvers/aws_token.rb +37 -0
  253. data/lib/facter/{resolvers/utils → util/resolvers}/ffi/load_averages.rb +2 -2
  254. data/lib/facter/util/resolvers/filesystem_helper.rb +47 -0
  255. data/lib/facter/util/resolvers/fingerprint.rb +15 -0
  256. data/lib/facter/{resolvers/utils → util/resolvers}/http.rb +17 -10
  257. data/lib/facter/util/resolvers/networking/dhcp.rb +21 -0
  258. data/lib/facter/util/resolvers/networking/networking.rb +109 -0
  259. data/lib/facter/util/resolvers/networking/primary_interface.rb +82 -0
  260. data/lib/facter/util/resolvers/ssh.rb +17 -0
  261. data/lib/facter/util/resolvers/ssh_helper.rb +31 -0
  262. data/lib/facter/{resolvers/utils → util/resolvers}/uptime_helper.rb +2 -2
  263. data/lib/facter/{framework/utils → util}/utils.rb +0 -0
  264. data/lib/facter/util/windows/win32ole.rb +30 -0
  265. data/lib/facter/version.rb +1 -1
  266. metadata +106 -119
  267. data/lib/facter/fact_groups.conf +0 -308
  268. data/lib/facter/facts/aix/puppet_version.rb +0 -15
  269. data/lib/facter/facts/freebsd/puppet_version.rb +0 -15
  270. data/lib/facter/facts/linux/puppet_version.rb +0 -15
  271. data/lib/facter/facts/macosx/puppet_version.rb +0 -15
  272. data/lib/facter/facts/solaris/puppet_version.rb +0 -15
  273. data/lib/facter/facts/windows/puppet_version.rb +0 -15
  274. data/lib/facter/facts_utils/facts_utils.rb +0 -12
  275. data/lib/facter/facts_utils/unit_converter.rb +0 -59
  276. data/lib/facter/facts_utils/uptime_parser.rb +0 -124
  277. data/lib/facter/facts_utils/virtual_detector.rb +0 -78
  278. data/lib/facter/facts_utils/windows_release_finder.rb +0 -51
  279. data/lib/facter/os_hierarchy.json +0 -36
  280. data/lib/facter/resolvers/aix/utils/info_extractor.rb +0 -20
  281. data/lib/facter/resolvers/aix/utils/odm_query.rb +0 -42
  282. data/lib/facter/resolvers/hostname_resolver.rb +0 -44
  283. data/lib/facter/resolvers/mountpoints_resolver.rb +0 -62
  284. data/lib/facter/resolvers/networking_linux_resolver.rb +0 -159
  285. data/lib/facter/resolvers/puppet_version_resolver.rb +0 -26
  286. data/lib/facter/resolvers/utils/filesystem_helper.rb +0 -43
  287. data/lib/facter/resolvers/utils/fingerprint.rb +0 -11
  288. data/lib/facter/resolvers/utils/networking.rb +0 -86
  289. data/lib/facter/resolvers/utils/ssh.rb +0 -13
  290. data/lib/facter/resolvers/utils/ssh_helper.rb +0 -27
  291. data/lib/facter/resolvers/windows/utils/win32ole.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02e89a2638e45004e55f6b0ec4d902946c844b5253ee4e27139ab01d1ee12a92
4
- data.tar.gz: bd4405449c4804a3c872510042a33c2cd6cf7fd588df8f95a99893fcb9248291
3
+ metadata.gz: 338a079461e5036ff9a33dd608e9b4f0e7472ec68c0351f73bea25a8a5fe0bf9
4
+ data.tar.gz: b1c9387025dca95f2b5c767885c8747d14569e80f3cb8eb4d6c49ac227b9c145
5
5
  SHA512:
6
- metadata.gz: 31feabfeb9c2008ae30f16b6469cdf689b78e8711d64e3b614481a3e98b41d8271822b6cb26511a56ba5e19394f2ea811552b29168484d8ee377dbd3697f6655
7
- data.tar.gz: f579f81b0dc6fedf937d016e531650c183bc4f89ce66c918f47932af01e97bfc19f0e0f012adcfe36a52e4a9a314685765055fe23bde5aa4cf5b2f92353a450c
6
+ metadata.gz: 844740e483fa5e3b60e6e12459625c064a505200cc76aba2aece98ccf21f04a855ed3961889eedbdff6e0bf6ac4e22b0ca0685a8738e6605deecae185bad08ff
7
+ data.tar.gz: 967d8b83f3e511c319c918eb305bb31929bb6d631e877774ec1332e8f394413ed8111d11d9fafb0bd3423a739eb324163d44feab34db1f5d6735f2b690dd8de4
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Generates a markdown file containing fact documentation.
5
+ # usage: ruby generate.rb > facts.md
6
+
7
+ require 'yaml'
8
+ require 'erb'
9
+ require 'ostruct'
10
+
11
+ PATH_TO_SCHEMA = File.join(File.dirname(__FILE__), '../schema/facter.yaml')
12
+ PATH_TO_TEMPLATE = File.join(File.dirname(__FILE__), 'template.erb')
13
+
14
+ schema = YAML.load_file(PATH_TO_SCHEMA)
15
+
16
+ def format_facts(fact_hash)
17
+ scope = OpenStruct.new({
18
+ facts: fact_hash
19
+ })
20
+
21
+ erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
22
+ ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
23
+ else
24
+ ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-')
25
+ end
26
+ erb.result(scope.instance_eval { binding })
27
+ end
28
+
29
+ print "## Modern Facts\n\n"
30
+ print format_facts(schema.reject { |_name, info| info['hidden'] == true })
31
+ print "## Legacy Facts\n\n"
32
+ print format_facts(schema.reject { |_name, info| info['hidden'].nil? || info['hidden'] == false })
@@ -0,0 +1,34 @@
1
+ <%# This template is used to generate a markdown file documenting facts. -%>
2
+ <%# Run 'ruby generate.rb > facts.md' to generate the markdown file. -%>
3
+ <%
4
+ def format_fact_element(name, info, indent = '')
5
+ subelements = (info['elements'] || {}).map{|n, i| format_fact_element(n, i, "#{indent} ")}.join('')
6
+
7
+ "#{indent}* `#{name}` (#{info['type']}) --- #{info['description']}\n#{subelements}"
8
+ end
9
+ -%>
10
+ <% facts.each do |name, schema| -%>
11
+ ### `<%= name %>`
12
+
13
+ <% if schema['hidden'] -%>
14
+ This legacy fact is hidden by default in Facter's command-line output.
15
+
16
+ <% end -%>
17
+ **Type:** <%= schema['type'] %>
18
+
19
+ **Purpose:**
20
+
21
+ <%= schema['description'] %>
22
+
23
+ <% if schema['elements'] -%>
24
+ **Elements:**
25
+
26
+ <%= schema['elements'].map{|name, info| format_fact_element(name, info)}.join('') %>
27
+ <% end -%>
28
+
29
+ <% if schema['details'] -%>
30
+ **Details:**
31
+
32
+ <%= schema['details'] %>
33
+ <% end -%>
34
+ <% end -%>
@@ -20,7 +20,7 @@ module Facter
20
20
  # Method used by puppet-agent to retrieve facts
21
21
  # @param args_as_string [string] facter cli arguments
22
22
  #
23
- # @return nil
23
+ # @return query result
24
24
  #
25
25
  # @api private
26
26
  def resolve(args_as_string)
@@ -42,7 +42,6 @@ module Facter
42
42
  else
43
43
  cli.invoke(:arg_parser)
44
44
  end
45
- nil
46
45
  end
47
46
 
48
47
  # Alias method for Facter.fact()
@@ -178,6 +177,18 @@ module Facter
178
177
  Facter::Options[:debug] = debug_bool
179
178
  end
180
179
 
180
+ def enable_sequential
181
+ Facter::Options[:sequential] = true
182
+ end
183
+
184
+ def disable_sequential
185
+ Facter::Options[:sequential] = false
186
+ end
187
+
188
+ def sequential?
189
+ Facter::Options[:sequential]
190
+ end
191
+
181
192
  # Iterates over fact names and values
182
193
  #
183
194
  # @yieldparam [String] name the fact name
@@ -228,6 +239,18 @@ module Facter
228
239
  nil
229
240
  end
230
241
 
242
+ # Flushes cached values for all facts. This does not cause code to be
243
+ # reloaded; it only clears the cached results.
244
+ #
245
+ # @return [void]
246
+ #
247
+ # @api public
248
+ def flush
249
+ LegacyFacter.flush
250
+ SessionCache.invalidate_all_caches
251
+ nil
252
+ end
253
+
231
254
  # Loads all facts
232
255
  #
233
256
  # @return [nil]
@@ -238,6 +261,26 @@ module Facter
238
261
  nil
239
262
  end
240
263
 
264
+ # Enables/Disables external facts.
265
+ # @param enable_external [boolean]
266
+ #
267
+ # @return nil
268
+ #
269
+ # @api public
270
+ def load_external(enable_external)
271
+ # enable_external param needs negation because behind the scene
272
+ # no_external_facts= method is negating the parameter again.
273
+ Options[:no_external_facts] = !enable_external
274
+
275
+ if enable_external
276
+ logger.debug('Facter.load_external(true) called. External facts will be loaded')
277
+ else
278
+ logger.debug('Facter.load_external(false) called. External facts will NOT be loaded')
279
+ end
280
+
281
+ nil
282
+ end
283
+
241
284
  # Register directories to be searched for custom facts. The registered directories
242
285
  # must be absolute paths or they will be ignored.
243
286
  # @param dirs [Array<String>] An array of searched directories
@@ -287,9 +330,12 @@ module Facter
287
330
  # @api public
288
331
  def to_hash
289
332
  log_blocked_facts
333
+ logger.debug("Facter version: #{Facter::VERSION}")
290
334
 
291
335
  resolved_facts = Facter::FactManager.instance.resolve_facts
292
- Facter::FactCollection.new.build_fact_collection!(resolved_facts)
336
+ resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }
337
+ collection = Facter::FactCollection.new.build_fact_collection!(resolved_facts)
338
+ Hash[collection]
293
339
  end
294
340
 
295
341
  # Check whether printing stack trace is enabled
@@ -328,14 +374,16 @@ module Facter
328
374
  # @param options [Hash] parameters for the fact - attributes
329
375
  # of {Facter::Util::Fact} and {Facter::Util::Resolution} can be
330
376
  # supplied here
331
- # @param user_queries [String] the fact names
377
+ # @param user_queries [Array] the fact names
332
378
  #
333
379
  # @return [FactCollection] hash with fact names and values
334
380
  #
335
381
  # @api public
336
382
  def values(options, user_queries)
337
383
  init_cli_options(options, user_queries)
384
+ log_blocked_facts
338
385
  resolved_facts = Facter::FactManager.instance.resolve_facts(user_queries)
386
+ resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }
339
387
 
340
388
  if user_queries.count.zero?
341
389
  Facter::FactCollection.new.build_fact_collection!(resolved_facts)
@@ -361,13 +409,13 @@ module Facter
361
409
  def to_user_output(cli_options, *args)
362
410
  init_cli_options(cli_options, args)
363
411
  logger.info("executed with command line: #{ARGV.drop(1).join(' ')}")
412
+ logger.debug("Facter version: #{Facter::VERSION}")
364
413
  log_blocked_facts
365
- resolved_facts = Facter::FactManager.instance.resolve_facts(args)
414
+ resolved_facts = resolve_facts_for_user_query(args)
366
415
  fact_formatter = Facter::FormatterFactory.build(Facter::Options.get)
367
-
368
416
  status = error_check(resolved_facts)
369
417
 
370
- [fact_formatter.format(resolved_facts), status || 0]
418
+ [fact_formatter.format(resolved_facts), status]
371
419
  end
372
420
 
373
421
  # Logs an exception and an optional message
@@ -421,6 +469,15 @@ module Facter
421
469
 
422
470
  private
423
471
 
472
+ def resolve_facts_for_user_query(user_query)
473
+ resolved_facts = Facter::FactManager.instance.resolve_facts(user_query)
474
+ user_querie = resolved_facts.uniq(&:user_query).map(&:user_query).first
475
+
476
+ resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? } if user_querie&.empty?
477
+
478
+ resolved_facts
479
+ end
480
+
424
481
  def parse_exception(exception, error_message)
425
482
  if exception.is_a?(Exception)
426
483
  error_message << exception.message if error_message.empty?
@@ -479,14 +536,13 @@ module Facter
479
536
  #
480
537
  # @api private
481
538
  def error_check(resolved_facts)
539
+ status = 0
482
540
  if Options[:strict]
483
541
  missing_names = resolved_facts.select { |fact| fact.type == :nil }.map(&:user_query)
484
542
 
485
543
  if missing_names.count.positive?
486
544
  status = 1
487
545
  log_errors(missing_names)
488
- else
489
- status = nil
490
546
  end
491
547
  end
492
548
 
@@ -0,0 +1,385 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facter
4
+ module Config
5
+ unless defined?(OS_HIERARCHY)
6
+ OS_HIERARCHY = [
7
+ {
8
+ 'Linux' => [
9
+ {
10
+ 'Debian' => %w[
11
+ Elementary
12
+ Ubuntu
13
+ Raspbian
14
+ ]
15
+ },
16
+ {
17
+ 'Rhel' => %w[
18
+ Fedora
19
+ Amzn
20
+ Centos
21
+ Ol
22
+ Scientific
23
+ ]
24
+ },
25
+ {
26
+ 'Sles' => [
27
+ 'Opensuse'
28
+ ]
29
+ }
30
+ ]
31
+ },
32
+ {
33
+ 'Bsd' => [
34
+ 'Freebsd'
35
+ ]
36
+ },
37
+ 'Solaris',
38
+ 'Macosx',
39
+ 'Windows',
40
+ 'Aix'
41
+ ].freeze
42
+ end
43
+ unless defined? FACT_GROUPS
44
+ FACT_GROUPS = {
45
+ 'AIX NIM type' => [
46
+ 'nim_type'
47
+ ],
48
+ 'EC2' => %w[
49
+ ec2_metadata
50
+ ec2_userdata
51
+ ],
52
+ 'GCE' => [
53
+ 'gce'
54
+ ],
55
+ 'Xen' => %w[
56
+ xen
57
+ xendomains
58
+ ],
59
+ 'augeas' => %w[
60
+ augeas
61
+ augeasversion
62
+ ],
63
+ 'desktop management interface' => %w[
64
+ dmi
65
+ bios_vendor
66
+ bios_version
67
+ bios_release_date
68
+ boardassettag
69
+ boardmanufacturer
70
+ boardproductname
71
+ boardserialnumber
72
+ chassisassettag
73
+ manufacturer
74
+ productname
75
+ serialnumber
76
+ uuid
77
+ chassistype
78
+ ],
79
+ 'disks' => %w[
80
+ blockdevices
81
+ disks
82
+ ],
83
+ 'file system' => %w[
84
+ mountpoints
85
+ filesystems
86
+ partitions
87
+ ],
88
+ 'fips' => [
89
+ 'fips_enabled'
90
+ ],
91
+ 'hypervisors' => [
92
+ 'hypervisors'
93
+ ],
94
+ 'id' => %w[
95
+ id
96
+ gid
97
+ identity
98
+ ],
99
+ 'kernel' => %w[
100
+ kernel
101
+ kernelversion
102
+ kernelrelease
103
+ kernelmajversion
104
+ ],
105
+ 'load_average' => [
106
+ 'load_averages'
107
+ ],
108
+ 'memory' => %w[
109
+ memory
110
+ memoryfree
111
+ memoryfree_mb
112
+ memorysize
113
+ memorysize_mb
114
+ swapfree
115
+ swapfree_mb
116
+ swapsize
117
+ swapsize_mb
118
+ swapencrypted
119
+ ],
120
+ 'networking' => %w[
121
+ networking
122
+ hostname
123
+ ipaddress
124
+ ipaddress6
125
+ netmask
126
+ netmask6
127
+ network
128
+ network6
129
+ scope6
130
+ macaddress
131
+ interfaces
132
+ domain
133
+ fqdn
134
+ dhcp_servers
135
+ ],
136
+ 'operating system' => %w[
137
+ os
138
+ operatingsystem
139
+ osfamily
140
+ operatingsystemrelease
141
+ operatingsystemmajrelease
142
+ hardwaremodel
143
+ architecture
144
+ lsbdistid
145
+ lsbdistrelease
146
+ lsbdistcodename
147
+ lsbdistdescription
148
+ lsbmajdistrelease
149
+ lsbminordistrelease
150
+ lsbrelease
151
+ macosx_buildversion
152
+ macosx_productname
153
+ macosx_productversion
154
+ macosx_productversion_major
155
+ macosx_productversion_minor
156
+ windows_edition_id
157
+ windows_installation_type
158
+ windows_product_name
159
+ windows_release_id
160
+ system32
161
+ selinux
162
+ selinux_enforced
163
+ selinux_policyversion
164
+ selinux_current_mode
165
+ selinux_config_mode
166
+ selinux_config_policy
167
+ ],
168
+ 'path' => [
169
+ 'path'
170
+ ],
171
+ 'processor' => %w[
172
+ processors
173
+ processorcount
174
+ physicalprocessorcount
175
+ hardwareisa
176
+ ],
177
+ 'ssh' => %w[
178
+ ssh
179
+ sshdsakey
180
+ sshrsakey
181
+ sshecdsakey
182
+ sshed25519key
183
+ sshfp_dsa
184
+ sshfp_rsa
185
+ sshfp_ecdsa
186
+ sshfp_ed25519
187
+ ],
188
+ 'system profiler' => %w[
189
+ system_profiler
190
+ sp_boot_mode
191
+ sp_boot_rom_version
192
+ sp_boot_volume
193
+ sp_cpu_type
194
+ sp_current_processor_speed
195
+ sp_kernel_version
196
+ sp_l2_cache_core
197
+ sp_l3_cache
198
+ sp_local_host_name
199
+ sp_machine_model
200
+ sp_machine_name
201
+ sp_number_processors
202
+ sp_os_version
203
+ sp_packages
204
+ sp_physical_memory
205
+ sp_platform_uuid
206
+ sp_secure_vm
207
+ sp_serial_number
208
+ sp_smc_version_system
209
+ sp_uptime
210
+ sp_user_name
211
+ ],
212
+ 'timezone' => [
213
+ 'timezone'
214
+ ],
215
+ 'uptime' => %w[
216
+ system_uptime
217
+ uptime
218
+ uptime_days
219
+ uptime_hours
220
+ uptime_seconds
221
+ ],
222
+ 'virtualization' => %w[
223
+ virtual
224
+ is_virtual
225
+ cloud
226
+ ],
227
+ 'ldom' => [
228
+ 'ldom'
229
+ ],
230
+ 'Solaris zone' => %w[
231
+ zones
232
+ zonename
233
+ solaris_zones
234
+ ],
235
+ 'ZFS' => %w[
236
+ zfs_version
237
+ zfs_featurenumbers
238
+ ],
239
+ 'ZFS storage pool' => %w[
240
+ zpool_version
241
+ zpool_featureflags
242
+ zpool_featurenumbers
243
+ ],
244
+ 'legacy' => [
245
+ 'architecture',
246
+ 'augeasversion',
247
+ 'bios_release_date',
248
+ 'bios_vendor',
249
+ 'bios_version',
250
+ 'blockdevice_*_model',
251
+ 'blockdevice_*_size',
252
+ 'blockdevice_*_vendor',
253
+ 'blockdevices',
254
+ 'boardassettag',
255
+ 'boardmanufacturer',
256
+ 'boardproductname',
257
+ 'boardserialnumber',
258
+ 'chassisassettag',
259
+ 'chassistype',
260
+ 'dhcp_servers',
261
+ 'domain',
262
+ 'fqdn',
263
+ 'gid',
264
+ 'hardwareisa',
265
+ 'hardwaremodel',
266
+ 'hostname',
267
+ 'id',
268
+ 'interfaces',
269
+ 'ipaddress',
270
+ 'ipaddress_.*',
271
+ 'ipaddress_*',
272
+ 'ipaddress6',
273
+ 'ipaddress6_.*',
274
+ 'ipaddress6_*',
275
+ 'ldom_*',
276
+ 'lsbdistcodename',
277
+ 'lsbdistdescription',
278
+ 'lsbdistid',
279
+ 'lsbdistrelease',
280
+ 'lsbmajdistrelease',
281
+ 'lsbminordistrelease',
282
+ 'lsbrelease',
283
+ 'macaddress',
284
+ 'macaddress_.*',
285
+ 'macaddress_*',
286
+ 'macosx_buildversion',
287
+ 'macosx_productname',
288
+ 'macosx_productversion',
289
+ 'macosx_productversion_major',
290
+ 'macosx_productversion_minor',
291
+ 'manufacturer',
292
+ 'memoryfree',
293
+ 'memoryfree_mb',
294
+ 'memorysize',
295
+ 'memorysize_mb',
296
+ 'mtu_.*',
297
+ 'mtu_*',
298
+ 'netmask',
299
+ 'netmask_.*',
300
+ 'netmask_*',
301
+ 'netmask6',
302
+ 'netmask6_.*',
303
+ 'netmask6_*',
304
+ 'network',
305
+ 'network_.*',
306
+ 'network_*',
307
+ 'network6',
308
+ 'network6_.*',
309
+ 'network6_*',
310
+ 'operatingsystem',
311
+ 'operatingsystemmajrelease',
312
+ 'operatingsystemrelease',
313
+ 'osfamily',
314
+ 'physicalprocessorcount',
315
+ 'processor[0-9]+.*',
316
+ 'processorcount',
317
+ 'productname',
318
+ 'rubyplatform',
319
+ 'rubysitedir',
320
+ 'rubyversion',
321
+ 'scope6',
322
+ 'scope6_.*',
323
+ 'selinux',
324
+ 'selinux_config_mode',
325
+ 'selinux_config_policy',
326
+ 'selinux_current_mode',
327
+ 'selinux_enforced',
328
+ 'selinux_policyversion',
329
+ 'serialnumber',
330
+ 'sp_*',
331
+ 'sp_boot_mode',
332
+ 'sp_boot_rom_version',
333
+ 'sp_boot_volume',
334
+ 'sp_cpu_type',
335
+ 'sp_current_processor_speed',
336
+ 'sp_kernel_version',
337
+ 'sp_l2_cache_core',
338
+ 'sp_l3_cache',
339
+ 'sp_local_host_name',
340
+ 'sp_machine_model',
341
+ 'sp_machine_name',
342
+ 'sp_number_processors',
343
+ 'sp_os_version',
344
+ 'sp_packages',
345
+ 'sp_physical_memory',
346
+ 'sp_platform_uuid',
347
+ 'sp_secure_vm',
348
+ 'sp_serial_number',
349
+ 'sp_smc_version_system',
350
+ 'sp_uptime',
351
+ 'sp_user_name',
352
+ 'ssh.*key',
353
+ 'ssh*key',
354
+ 'sshfp_.*',
355
+ 'sshfp_*',
356
+ 'swapencrypted',
357
+ 'swapfree',
358
+ 'swapfree_mb',
359
+ 'swapsize',
360
+ 'swapsize_mb',
361
+ 'system32',
362
+ 'uptime',
363
+ 'uptime_days',
364
+ 'uptime_hours',
365
+ 'uptime_seconds',
366
+ 'uuid',
367
+ 'windows_edition_id',
368
+ 'windows_installation_type',
369
+ 'windows_product_name',
370
+ 'windows_release_id',
371
+ 'xendomains',
372
+ 'zone_*_brand',
373
+ 'zone_*_id',
374
+ 'zone_*_iptype',
375
+ 'zone_*_name',
376
+ 'zone_*_path',
377
+ 'zone_*_status',
378
+ 'zone_*_uuid',
379
+ 'zonename',
380
+ 'zones'
381
+ ]
382
+ }.freeze
383
+ end
384
+ end
385
+ end