facterdb 1.6.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +32 -0
  3. data/.github/workflows/test.yml +28 -0
  4. data/CHANGELOG.md +174 -121
  5. data/Gemfile +2 -2
  6. data/README.md +115 -99
  7. data/Rakefile +15 -4
  8. data/facterdb.gemspec +6 -7
  9. data/facts/1.6/debian-11-x86_64.facts +57 -0
  10. data/facts/1.6/freebsd-13-x86_64.facts +51 -0
  11. data/facts/1.6/oraclelinux-8-x86_64.facts +59 -0
  12. data/facts/1.7/centos-9-x86_64.facts +82 -0
  13. data/facts/1.7/debian-11-x86_64.facts +74 -0
  14. data/facts/1.7/freebsd-13-x86_64.facts +69 -0
  15. data/facts/1.7/oraclelinux-8-x86_64.facts +82 -0
  16. data/facts/2.0/centos-9-x86_64.facts +82 -0
  17. data/facts/2.0/debian-11-x86_64.facts +76 -0
  18. data/facts/2.0/freebsd-13-x86_64.facts +70 -0
  19. data/facts/2.0/oraclelinux-8-x86_64.facts +82 -0
  20. data/facts/2.1/centos-9-x86_64.facts +112 -0
  21. data/facts/2.1/debian-11-x86_64.facts +84 -0
  22. data/facts/2.1/freebsd-13-x86_64.facts +70 -0
  23. data/facts/2.1/oraclelinux-8-x86_64.facts +92 -0
  24. data/facts/2.2/centos-9-x86_64.facts +137 -0
  25. data/facts/2.2/debian-11-x86_64.facts +115 -0
  26. data/facts/2.2/freebsd-13-x86_64.facts +91 -0
  27. data/facts/2.2/oraclelinux-8-x86_64.facts +115 -0
  28. data/facts/2.3/centos-9-x86_64.facts +138 -0
  29. data/facts/2.3/debian-11-x86_64.facts +116 -0
  30. data/facts/2.3/freebsd-13-x86_64.facts +92 -0
  31. data/facts/2.3/oraclelinux-8-x86_64.facts +143 -0
  32. data/facts/2.4/centos-9-x86_64.facts +139 -0
  33. data/facts/2.4/debian-11-x86_64.facts +118 -0
  34. data/facts/2.4/freebsd-13-x86_64.facts +92 -0
  35. data/facts/2.4/oraclelinux-8-x86_64.facts +160 -0
  36. data/facts/2.5/debian-11-x86_64.facts +118 -0
  37. data/facts/2.5/freebsd-13-x86_64.facts +92 -0
  38. data/facts/2.5/oraclelinux-8-x86_64.facts +160 -0
  39. data/facts/3.11/oraclelinux-8-x86_64.facts +494 -0
  40. data/facts/3.11/redhat-8-x86_64.facts +128 -127
  41. data/facts/3.11/solaris-10-i86pc.facts +1 -4
  42. data/facts/3.11/solaris-11-i86pc.facts +1 -4
  43. data/facts/3.11/solaris-11-sun4v.facts +1 -4
  44. data/facts/3.11/ubuntu-18.04-x86_64.facts +216 -101
  45. data/facts/3.12/oraclelinux-8-x86_64.facts +400 -0
  46. data/facts/3.12/redhat-8-x86_64.facts +109 -105
  47. data/facts/3.13/oraclelinux-8-x86_64.facts +406 -0
  48. data/facts/3.13/redhat-8-x86_64.facts +111 -113
  49. data/facts/3.13/ubuntu-18.04-x86_64.facts +216 -101
  50. data/facts/3.14/almalinux-8-x86_64.facts +522 -0
  51. data/facts/3.14/darwin-19-x86_64.facts +412 -0
  52. data/facts/3.14/darwin-20-x86_64.facts +516 -0
  53. data/facts/3.14/debian-11-x86_64.facts +508 -0
  54. data/facts/3.14/freebsd-11-x86_64.facts +479 -0
  55. data/facts/3.14/freebsd-12-x86_64.facts +479 -0
  56. data/facts/3.14/freebsd-13-x86_64.facts +475 -0
  57. data/facts/3.14/oraclelinux-8-x86_64.facts +406 -0
  58. data/facts/3.14/redhat-8-x86_64.facts +111 -113
  59. data/facts/3.14/rocky-8-x86_64.facts +625 -0
  60. data/facts/3.14/solaris-11-i86pc.facts +1 -4
  61. data/facts/3.14/solaris-11-sun4v.facts +1 -4
  62. data/facts/3.14/ubuntu-18.04-x86_64.facts +91 -91
  63. data/facts/3.14/ubuntu-20.04-x86_64.facts +138 -184
  64. data/facts/3.9/solaris-10-i86pc.facts +0 -3
  65. data/facts/4.0/almalinux-8-x86_64.facts +307 -0
  66. data/facts/4.0/centos-7-x86_64.facts +706 -0
  67. data/facts/4.0/debian-10-x86_64.facts +1091 -0
  68. data/facts/4.0/debian-11-x86_64.facts +236 -0
  69. data/facts/4.0/freebsd-11-x86_64.facts +208 -0
  70. data/facts/4.0/freebsd-12-x86_64.facts +208 -0
  71. data/facts/4.0/freebsd-13-x86_64.facts +207 -0
  72. data/facts/4.0/redhat-8-x86_64.facts +230 -0
  73. data/facts/4.0/solaris-11-sun4v.facts +585 -0
  74. data/facts/4.0/ubuntu-18.04-x86_64.facts +241 -0
  75. data/facts/4.0/ubuntu-20.04-x86_64.facts +259 -0
  76. data/facts/4.1/debian-11-x86_64.facts +238 -0
  77. data/facts/4.1/freebsd-11-x86_64.facts +208 -0
  78. data/facts/4.1/freebsd-12-x86_64.facts +208 -0
  79. data/facts/4.1/freebsd-13-x86_64.facts +207 -0
  80. data/facts/4.1/redhat-8-x86_64.facts +232 -0
  81. data/facts/4.1/ubuntu-18.04-x86_64.facts +243 -0
  82. data/facts/4.1/ubuntu-20.04-x86_64.facts +261 -0
  83. data/facts/4.2/centos-7-x86_64.facts +593 -0
  84. data/facts/4.2/centos-8-x86_64.facts +591 -0
  85. data/facts/4.2/centos-9-x86_64.facts +291 -0
  86. data/facts/4.2/darwin-20-x86_64.facts +524 -0
  87. data/facts/4.2/debian-10-x86_64.facts +574 -0
  88. data/facts/4.2/debian-11-x86_64.facts +244 -0
  89. data/facts/4.2/debian-9-x86_64.facts +597 -0
  90. data/facts/4.2/freebsd-11-x86_64.facts +261 -0
  91. data/facts/4.2/freebsd-12-x86_64.facts +261 -0
  92. data/facts/4.2/freebsd-13-x86_64.facts +260 -0
  93. data/facts/4.2/oraclelinux-8-x86_64.facts +591 -0
  94. data/facts/4.2/redhat-8-x86_64.facts +232 -0
  95. data/facts/4.2/ubuntu-18.04-x86_64.facts +249 -0
  96. data/facts/4.2/ubuntu-20.04-x86_64.facts +267 -0
  97. data/facts/Gemfile +1 -0
  98. data/facts/Vagrantfile +33 -9
  99. data/facts/get_facts.sh +45 -13
  100. data/lib/facterdb/version.rb +1 -1
  101. data/lib/facterdb.rb +17 -2
  102. data/spec/facts_spec.rb +9 -2
  103. metadata +82 -27
  104. data/.travis.yml +0 -36
@@ -0,0 +1,267 @@
1
+ {
2
+ "aio_agent_version": "6.24.0",
3
+ "augeas": {
4
+ "version": "1.12.0"
5
+ },
6
+ "disks": {
7
+ "sda": {
8
+ "model": "HARDDISK",
9
+ "size": "40.00 GiB",
10
+ "size_bytes": 42949672960,
11
+ "type": "hdd",
12
+ "vendor": "VBOX"
13
+ },
14
+ "sdb": {
15
+ "model": "HARDDISK",
16
+ "size": "10.00 MiB",
17
+ "size_bytes": 10485760,
18
+ "type": "hdd",
19
+ "vendor": "VBOX"
20
+ }
21
+ },
22
+ "dmi": {
23
+ "bios": {
24
+ "release_date": "12/01/2006",
25
+ "vendor": "innotek GmbH",
26
+ "version": "VirtualBox"
27
+ },
28
+ "board": {
29
+ "manufacturer": "Oracle Corporation",
30
+ "product": "VirtualBox",
31
+ "serial_number": "0"
32
+ },
33
+ "chassis": {
34
+ "type": "Other"
35
+ },
36
+ "manufacturer": "innotek GmbH",
37
+ "product": {
38
+ "name": "VirtualBox",
39
+ "serial_number": "0",
40
+ "uuid": "20900609-227b-df4c-8c9d-78b9c4fbacc7"
41
+ }
42
+ },
43
+ "facterversion": "4.2.4",
44
+ "filesystems": "btrfs,ext2,ext3,ext4,iso9660,squashfs,vfat",
45
+ "fips_enabled": false,
46
+ "gem_version": "~> 4.2.0",
47
+ "hypervisors": {
48
+ "virtualbox": {
49
+ "revision": "145957",
50
+ "version": "6.1.26"
51
+ }
52
+ },
53
+ "identity": {
54
+ "gid": 0,
55
+ "group": "root",
56
+ "privileged": true,
57
+ "uid": 0,
58
+ "user": "root"
59
+ },
60
+ "is_virtual": true,
61
+ "kernel": "Linux",
62
+ "kernelmajversion": "5.4",
63
+ "kernelrelease": "5.4.0-86-generic",
64
+ "kernelversion": "5.4.0",
65
+ "load_averages": {
66
+ "15m": 0.19,
67
+ "1m": 1.08,
68
+ "5m": 0.5
69
+ },
70
+ "memory": {
71
+ "system": {
72
+ "available": "641.32 MiB",
73
+ "available_bytes": 672473088,
74
+ "capacity": "34.63%",
75
+ "total": "981.04 MiB",
76
+ "total_bytes": 1028689920,
77
+ "used": "339.71 MiB",
78
+ "used_bytes": 356216832
79
+ }
80
+ },
81
+ "networking": {
82
+ "dhcp": "10.0.2.2",
83
+ "domain": "example.com",
84
+ "fqdn": "foo.example.com",
85
+ "hostname": "foo",
86
+ "interfaces": {
87
+ "enp0s3": {
88
+ "bindings": [
89
+ {
90
+ "address": "10.0.2.15",
91
+ "netmask": "255.255.255.0",
92
+ "network": "10.0.2.0"
93
+ }
94
+ ],
95
+ "bindings6": [
96
+ {
97
+ "address": "fe80::46:98ff:fed9:c9f4",
98
+ "netmask": "ffff:ffff:ffff:ffff::",
99
+ "network": "fe80::",
100
+ "scope6": "link",
101
+ "flags": [
102
+ "permanent"
103
+ ]
104
+ }
105
+ ],
106
+ "dhcp": "10.0.2.2",
107
+ "ip": "10.0.2.15",
108
+ "ip6": "fe80::46:98ff:fed9:c9f4",
109
+ "mac": "02:46:98:d9:c9:f4",
110
+ "mtu": 1500,
111
+ "netmask": "255.255.255.0",
112
+ "netmask6": "ffff:ffff:ffff:ffff::",
113
+ "network": "10.0.2.0",
114
+ "network6": "fe80::",
115
+ "scope6": "link"
116
+ },
117
+ "lo": {
118
+ "bindings": [
119
+ {
120
+ "address": "127.0.0.1",
121
+ "netmask": "255.0.0.0",
122
+ "network": "127.0.0.0"
123
+ }
124
+ ],
125
+ "bindings6": [
126
+ {
127
+ "address": "::1",
128
+ "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
129
+ "network": "::1",
130
+ "scope6": "host",
131
+ "flags": [
132
+ "permanent"
133
+ ]
134
+ }
135
+ ],
136
+ "ip": "127.0.0.1",
137
+ "ip6": "::1",
138
+ "mtu": 65536,
139
+ "netmask": "255.0.0.0",
140
+ "netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
141
+ "network": "127.0.0.0",
142
+ "network6": "::1",
143
+ "scope6": "host"
144
+ }
145
+ },
146
+ "ip": "10.0.2.15",
147
+ "ip6": "fe80::46:98ff:fed9:c9f4",
148
+ "mac": "02:46:98:d9:c9:f4",
149
+ "mtu": 1500,
150
+ "netmask": "255.255.255.0",
151
+ "netmask6": "ffff:ffff:ffff:ffff::",
152
+ "network": "10.0.2.0",
153
+ "network6": "fe80::",
154
+ "primary": "enp0s3",
155
+ "scope6": "link"
156
+ },
157
+ "os": {
158
+ "architecture": "amd64",
159
+ "distro": {
160
+ "codename": "focal",
161
+ "description": "Ubuntu 20.04.3 LTS",
162
+ "id": "Ubuntu",
163
+ "release": {
164
+ "full": "20.04",
165
+ "major": "20.04"
166
+ }
167
+ },
168
+ "family": "Debian",
169
+ "hardware": "x86_64",
170
+ "name": "Ubuntu",
171
+ "release": {
172
+ "full": "20.04",
173
+ "major": "20.04"
174
+ },
175
+ "selinux": {
176
+ "enabled": false
177
+ }
178
+ },
179
+ "partitions": {
180
+ "/dev/loop0": {
181
+ "backing_file": "/var/lib/snapd/snaps/core20_1081.snap",
182
+ "filesystem": "squashfs",
183
+ "size": "61.77 MiB",
184
+ "size_bytes": 64770048
185
+ },
186
+ "/dev/loop1": {
187
+ "backing_file": "/var/lib/snapd/snaps/lxd_21545.snap",
188
+ "filesystem": "squashfs",
189
+ "size": "67.25 MiB",
190
+ "size_bytes": 70516736
191
+ },
192
+ "/dev/loop2": {
193
+ "backing_file": "/var/lib/snapd/snaps/snapd_12883.snap",
194
+ "filesystem": "squashfs",
195
+ "size": "32.30 MiB",
196
+ "size_bytes": 33869824
197
+ },
198
+ "/dev/sda1": {
199
+ "filesystem": "ext4",
200
+ "label": "cloudimg-rootfs",
201
+ "partuuid": "bbed7fa6-01",
202
+ "size": "40.00 GiB",
203
+ "size_bytes": 42948607488,
204
+ "uuid": "167d8723-2972-4ac5-869e-c16609de3e76"
205
+ }
206
+ },
207
+ "path": "/home/vagrant/vendor/bundler/ruby/2.5.0/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin",
208
+ "processors": {
209
+ "cores": 2,
210
+ "count": 2,
211
+ "isa": "x86_64",
212
+ "models": [
213
+ "AMD Ryzen 7 PRO 4750U with Radeon Graphics",
214
+ "AMD Ryzen 7 PRO 4750U with Radeon Graphics"
215
+ ],
216
+ "physicalcount": 1,
217
+ "speed": "1.70 GHz",
218
+ "threads": 1
219
+ },
220
+ "ruby": {
221
+ "platform": "x86_64-linux",
222
+ "sitedir": "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0",
223
+ "version": "2.5.9"
224
+ },
225
+ "ssh": {
226
+ "dsa": {
227
+ "fingerprints": {
228
+ "sha1": "SSHFP 2 1 18325a14254dc680e869c0c1457ce059267e6103",
229
+ "sha256": "SSHFP 2 2 4cebdf45493df91ee9eb244aa41094bf7b7fefbad79a3dd74596516b9267caf1"
230
+ },
231
+ "key": "AAAAB3NzaC1kc3MAAACBAMH2b2w5mLFY74z64UlktrtaFVFhf99YuxboH3SNtenbX6Kfm1LqT9aTgvac2g1DVBFywQl/aspONf36UMMNpA8DAbHFHYSBKOBzzB18XctJ0AvgGBs1HOCrEsvHzAahwHtSLzXjPxGq4krsCLkxYN9qTZYGJUFtit/bh8oNCobtAAAAFQC87ZmuYGWJtPG/zC6Azm8NOkcM0wAAAIBMkEEAi5od8QrGiTZ3fTXdUCPQl3YEx2PXWpc1QSMnQFv96kmRfOGl8J6IuWjNAm2pPosbOrdIKfpyALQhXQG4XzcBzw+Pt4/blGKNkNoNK47lTdHgW6THWGQ/LeaNfEHic6pijTUdAJVuy+ml96ljX+Up2Dyq6SN/9nY4ztn92wAAAIEAoFeU5R3bsVw0+rOP8RoU6yOhybFPu1I3YrdvbEORp9SpBhxEUdrZXzIByXxL1bDl7wZTIn57952aJc6jYLAYRM5dhFjfKzrS3lrEiO2msskXkVvYgoefBXKvwuOHhrqzGZuo4aqDWWP5clJYedHVgCVag7Q5ZbF8R+04uF5Q4wg=",
232
+ "type": "ssh-dss"
233
+ },
234
+ "ecdsa": {
235
+ "fingerprints": {
236
+ "sha1": "SSHFP 3 1 359f47ecbe281e8a3e175249c4ef46db156c0b55",
237
+ "sha256": "SSHFP 3 2 5ec3008ca9c6e0d0b761f2d1dfd89fbcf3dc4d19383bb49ef4d015f6acf47311"
238
+ },
239
+ "key": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPFcXtgXA8xYWa2INIoOJ+VrNvBgr2iwLJ2LoHpMLNOx6ykRuGasmcmx20huVTQSQgM0GFLZB2wrG9pd0QJForo=",
240
+ "type": "ecdsa-sha2-nistp256"
241
+ },
242
+ "ed25519": {
243
+ "fingerprints": {
244
+ "sha1": "SSHFP 4 1 15d83e2f036c4c1a6474e6ccb7d8c149e2d2ea9f",
245
+ "sha256": "SSHFP 4 2 11a98b5150cc41d3c66f268fc32c8663df431a35851dbb1d10f2b7204a134532"
246
+ },
247
+ "key": "AAAAC3NzaC1lZDI1NTE5AAAAIM4Q2KY/Qo2UJXcbx2bYK1C22cHsupThHGbYf7Lk2gpe",
248
+ "type": "ssh-ed25519"
249
+ },
250
+ "rsa": {
251
+ "fingerprints": {
252
+ "sha1": "SSHFP 1 1 d3540c138c56a8446b4a57b7be2136c2ae024d2b",
253
+ "sha256": "SSHFP 1 2 b93587fe58a49c106594e2dc4e9090eb972674b10237aba1501c3af190065ccf"
254
+ },
255
+ "key": "AAAAB3NzaC1yc2EAAAADAQABAAABgQD0M14x9dPiCKdjzmtbBKJzVi9R+e3Is/mu75NXO/hbhwFZisP1tL3Cqt4oaCR/x6DgAr9PE4MnXtUErTdqz9IhDOfuWnns+Y+o3j8m8Vbn0FoN3z92ygZXbXHWQRejgdK1l2KOiSAeWuBtsPU5pENFbjt8v7mfo1/q5hoDfxVbusfHahF0uUzfw+uqkBoPsy/KddMi4INgGxBw7rFmnqyG9fhL74F+oZSZpY5p58dg4liG+eHJwDHo2HVGOZqonYgm978hWFAqeXx930w94jSYzFyN2He7+H7JEdptRmcFwhYA/4D5RXGzu7yAFYHh1ZstTu1xkr+GnycKn1pmS86Ld8GRCrEQsiTHFiXYPsMqouhZgDNOE1LDloUHWFmfl0/m+DHKFvn46xqY7YnKzf2Dbqk02MvNJF+r7rN+UWUQm44Zl1pG1qIDCtJM9h0jMJxKyBBC2FfwsQsa4oAddEJlwNDoIpcll8D1jmpkYZ7JJAGbkcRYDzYT4ctluAgvcDs=",
256
+ "type": "ssh-rsa"
257
+ }
258
+ },
259
+ "system_uptime": {
260
+ "days": 0,
261
+ "hours": 0,
262
+ "seconds": 147,
263
+ "uptime": "0:02 hours"
264
+ },
265
+ "timezone": "UTC",
266
+ "virtual": "virtualbox"
267
+ }
data/facts/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
2
 
3
3
  gem 'json', :require => false
4
+ gem 'ffi'
4
5
 
5
6
  if facterversion = ENV['FACTER_GEM_VERSION']
6
7
  gem 'facter', facterversion, :require => false
data/facts/Vagrantfile CHANGED
@@ -48,6 +48,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
48
48
  host.vm.provision "shell", path: "get_facts.sh"
49
49
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
50
50
  end
51
+ config.vm.define "debian-11-x86_64" do |host|
52
+ host.vm.box = "boxomatic/debian-11"
53
+ host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
54
+ host.vm.provision "shell", path: "get_facts.sh"
55
+ host.vm.provision "shell", inline: "/sbin/shutdown -h now"
56
+ end
51
57
  config.vm.define "ubuntu-10.04-x86_64" do |host|
52
58
  host.vm.box = "ubuntu-server-10044-x64-vbox4210-nocm"
53
59
  host.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box"
@@ -150,7 +156,22 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
150
156
  host.vm.provision "shell", path: "get_facts.sh"
151
157
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
152
158
  end
153
-
159
+ config.vm.define "almalinux-8-x86_64" do |host|
160
+ host.vm.box = "almalinux/8"
161
+ host.vm.synced_folder ".", "/vagrant"
162
+ host.vm.provision "shell", inline: "dnf -y install wget make gcc net-tools"
163
+ host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
164
+ host.vm.provision "shell", path: "get_facts.sh"
165
+ host.vm.provision "shell", inline: "/sbin/shutdown -h now"
166
+ end
167
+ config.vm.define "rockylinux-8-x86_64" do |host|
168
+ host.vm.box = "https://github.com/anoncam/rocky-linux-vagrant/blob/main/rockylinux.box"
169
+ host.vm.synced_folder ".", "/vagrant"
170
+ host.vm.provision "shell", inline: "dnf -y install wget make gcc net-tools"
171
+ host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
172
+ host.vm.provision "shell", path: "get_facts.sh"
173
+ host.vm.provision "shell", inline: "/sbin/shutdown -h now"
174
+ end
154
175
  config.vm.define "redhat-8-x86_64" do |host|
155
176
  host.vm.box = "generic/rhel8"
156
177
  host.vm.synced_folder ".", "/vagrant"
@@ -298,20 +319,26 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
298
319
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
299
320
  host.vm.provision "shell", path: "get_facts.sh"
300
321
  end
322
+ config.vm.define "freebsd-11-x86_64" do |host|
323
+ host.vm.box = "bento/freebsd-11"
324
+ host.vm.synced_folder ".", "/vagrant"
325
+ host.vm.provision "shell", inline: "pkg install -y bash devel/ruby-gems"
326
+ host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
327
+ host.vm.provision "shell", path: "get_facts.sh"
328
+ host.vm.provision "shell", inline: "/sbin/shutdown -p now"
329
+ end
301
330
  config.vm.define "freebsd-12-x86_64" do |host|
302
- host.vm.box = "bento/freebsd-12.0"
331
+ host.vm.box = "bento/freebsd-12"
303
332
  host.vm.synced_folder ".", "/vagrant"
304
333
  host.vm.provision "shell", inline: "pkg install -y bash devel/ruby-gems"
305
- host.vm.provision "shell", inline: "ln -sf /usr/local/bin/bash /bin/bash"
306
334
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
307
335
  host.vm.provision "shell", path: "get_facts.sh"
308
336
  host.vm.provision "shell", inline: "/sbin/shutdown -p now"
309
337
  end
310
- config.vm.define "freebsd-11-x86_64" do |host|
311
- host.vm.box = "bento/freebsd-11.2"
338
+ config.vm.define "freebsd-13-x86_64" do |host|
339
+ host.vm.box = "bento/freebsd-13"
312
340
  host.vm.synced_folder ".", "/vagrant"
313
341
  host.vm.provision "shell", inline: "pkg install -y bash devel/ruby-gems"
314
- host.vm.provision "shell", inline: "ln -sf /usr/local/bin/bash /bin/bash"
315
342
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
316
343
  host.vm.provision "shell", path: "get_facts.sh"
317
344
  host.vm.provision "shell", inline: "/sbin/shutdown -p now"
@@ -340,7 +367,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
340
367
  . ~/.profile
341
368
 
342
369
  pkg_info -qe 'bash->=0' || pkg_add -I bash
343
- ln -sf /usr/local/bin/bash /bin
344
370
  SCRIPT
345
371
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
346
372
  host.vm.provision "shell", path: "get_facts.sh"
@@ -354,7 +380,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
354
380
  . ~/.profile
355
381
 
356
382
  pkg_info -qe 'bash->=0' || pkg_add -I bash
357
- ln -sf /usr/local/bin/bash /bin
358
383
  SCRIPT
359
384
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
360
385
  host.vm.provision "shell", path: "get_facts.sh"
@@ -369,7 +394,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
369
394
  . ~/.profile
370
395
 
371
396
  pkg_info -qe 'bash->=0' || pkg_add bash
372
- ln -sf /usr/local/bin/bash /bin
373
397
  pkg_add facter puppet-5.5.6
374
398
  ln -sf /usr/local/bin/gem24 /usr/bin/gem
375
399
  ln -sf /usr/local/bin/ruby24 /usr/bin/ruby
data/facts/get_facts.sh CHANGED
@@ -1,4 +1,4 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
 
3
3
  export PATH=/opt/puppetlabs/bin:$PATH
4
4
 
@@ -31,12 +31,18 @@ elif test -f /usr/bin/apt-get; then
31
31
  elif test -f /etc/redhat-release ; then
32
32
  operatingsystemmajrelease=$(rpm -qf /etc/redhat-release --queryformat '%{version}' | cut -f1 -d'.')
33
33
  case $(rpm -qf /etc/redhat-release --queryformat '%{name}') in
34
+ almalinux*)
35
+ osfamily='AlmaLinux'
36
+ ;;
34
37
  centos*|redhat*)
35
38
  osfamily='RedHat'
36
39
  ;;
37
40
  fedora*)
38
41
  osfamily='Fedora'
39
42
  ;;
43
+ rocky-*)
44
+ osfamily='RockyLinux'
45
+ ;;
40
46
  *)
41
47
  echo 'Failed to determine osfamily from /etc/redhat-release'
42
48
  exit 1
@@ -150,6 +156,14 @@ case "${osfamily}" in
150
156
  yum remove -y puppet6-release
151
157
  fi
152
158
  ;;
159
+ 'RockyLinux'|'AlmaLinux')
160
+ dnf localinstall -y "http://yum.puppetlabs.com/puppet6-release-el-${operatingsystemmajrelease}.noarch.rpm"
161
+ if dnf install -y puppet-agent; then
162
+ output_file="/vagrant/$(facter --version | cut -d. -f1,2)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-$(facter hardwaremodel).facts"
163
+ mkdir -p $(dirname ${output_file})
164
+ facter --show-legacy -p -j | tee ${output_file}
165
+ fi
166
+ ;;
153
167
 
154
168
  'Debian')
155
169
  if [[ "serena" =~ ${lsbdistcodename} ]]; then
@@ -211,15 +225,20 @@ case "${osfamily}" in
211
225
  ;;
212
226
  'FreeBSD')
213
227
  pkg update
214
- pkg install -y sysutils/puppet5 sysutils/facter sysutils/rubygem-bundler
215
- # something about the pkg update process causes the shared folder mount to
216
- # get into an unusable state, so we remount it here before generating any
217
- # fact sets.
218
- umount /vagrant
219
- mount -t vboxvfs Vagrant /vagrant
220
- output_file="/vagrant/$(facter --version | cut -d. -f1,2)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-$(facter hardwaremodel).facts"
221
- mkdir -p $(dirname ${output_file})
222
- [ ! -f ${output_file} ] && facter --show-legacy -p -j | tee ${output_file}
228
+ for facter_package in facter rubygem-facter ; do
229
+ pkg install -fy ${facter_package}
230
+
231
+ # something about the pkg update process causes the shared folder mount to
232
+ # get into an unusable state, so we remount it here before generating any
233
+ # fact sets.
234
+ umount /vagrant
235
+ mount -t vboxvfs Vagrant /vagrant
236
+ hardwaremodel=$(facter hardwaremodel)
237
+ [ "${hardwaremodel}" = 'amd64' ] && hardwaremodel=x86_64
238
+ output_file="/vagrant/$(facter --version | cut -d. -f1,2)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-${hardwaremodel}.facts"
239
+ mkdir -p $(dirname ${output_file})
240
+ [ ! -f ${output_file} ] && facter --show-legacy -p -j | tee ${output_file}
241
+ done
223
242
  ;;
224
243
  'OpenBSD')
225
244
  hardwaremodel=$(facter hardwaremodel)
@@ -290,16 +309,26 @@ hardwaremodel=$(facter hardwaremodel)
290
309
 
291
310
  PATH=/opt/puppetlabs/puppet/bin:$PATH
292
311
 
293
- if ruby -e 'puts RUBY_VERSION' | grep -e '^2\.3'; then
294
- gem install bundler --no-ri --no-rdoc --no-format-executable
312
+ if [ "$(ruby -e 'puts Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3")')" = "true" ]; then
313
+ gem install bundler --no-document --no-format-executable
295
314
  else
296
315
  gem install bundler --version '~> 1.0' --no-ri --no-rdoc --no-format-executable
297
316
  fi
298
317
  bundle install --path vendor/bundler
299
318
 
300
- for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0; do
319
+ for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 4.0.0 4.1.0 4.2.0; do
301
320
  FACTER_GEM_VERSION="~> ${version}" bundle update
321
+
322
+ # This is another workaround for shared folder on FreeBSD. "Accessing"
323
+ # /vagrant helps to not encounter a bug where we try to access files in
324
+ # /vagrant/subdir/file
325
+ ls -d /vagrant > /dev/null
326
+ ls -l /vagrant > /dev/null
327
+
302
328
  case "${operatingsystem}" in
329
+ almalinux|rocky)
330
+ break
331
+ ;;
303
332
  openbsd)
304
333
  output_file="/vagrant/$(bundle exec facter --version | cut -d. -f1,2)/${operatingsystem}-${operatingsystemrelease}-${hardwaremodel}.facts"
305
334
  ;;
@@ -310,6 +339,9 @@ for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0; do
310
339
  output_file="/vagrant/$(bundle exec facter --version | cut -d. -f1,2)/${operatingsystem}-${operatingsystemmajrelease}-${hardwaremodel}.facts"
311
340
  ;;
312
341
  esac
342
+ if [ -f $output_file ]; then
343
+ continue
344
+ fi
313
345
  mkdir -p $(dirname $output_file)
314
346
  echo $version | grep -q -E '^1\.' &&
315
347
  FACTER_GEM_VERSION="~> ${version}" bundle exec facter -j | bundle exec ruby -e 'require "json"; jj JSON.parse gets' | tee $output_file ||
@@ -1,5 +1,5 @@
1
1
  module FacterDB
2
2
  module Version
3
- STRING = '1.6.0'
3
+ STRING = '1.10.0'
4
4
  end
5
5
  end
data/lib/facterdb.rb CHANGED
@@ -11,6 +11,13 @@ module FacterDB
11
11
  @database ||= "[#{facterdb_fact_files.map { |f| read_json_file(f) }.join(',')}]\n"
12
12
  end
13
13
 
14
+ # @note Call this method at the end of test suite, for example via after(:suite), to reclaim back the memory required to hold json data and filter cache
15
+ def self.cleanup
16
+ @database = nil
17
+ Thread.current[:facterdb_last_filter_seen] = nil
18
+ Thread.current[:facterdb_last_facts_seen] = nil
19
+ end
20
+
14
21
  # @return [Boolean] - returns true if we should use the default facterdb database, false otherwise
15
22
  # @note If the user passes anything to the FACTERDB_SKIP_DEFAULTDB environment variable we assume
16
23
  # they want to skip the default db
@@ -123,8 +130,16 @@ module FacterDB
123
130
 
124
131
  # @return [Array] - array of hashes of facts
125
132
  # @param filter [Object] - The filter to convert to jgrep string
126
- def self.get_facts(filter=nil)
133
+ def self.get_facts(filter=nil, cache=true)
134
+ if cache && filter && filter == Thread.current[:facterdb_last_filter_seen]
135
+ return Thread.current[:facterdb_last_facts_seen]
136
+ end
127
137
  filter_str = generate_filter_str(filter)
128
- JGrep.jgrep(database, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
138
+ result = JGrep.jgrep(database, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
139
+ if cache
140
+ Thread.current[:facterdb_last_filter_seen] = filter
141
+ Thread.current[:facterdb_last_facts_seen] = result
142
+ end
143
+ result
129
144
  end
130
145
  end
data/spec/facts_spec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'digest'
3
+ require 'pathname'
3
4
 
4
5
  RSpec::Matchers.define :have_a_unique_hash do
5
6
  match do |actual|
@@ -99,9 +100,15 @@ describe 'Default Facts' do
99
100
  expect(content['facterversion']).to have_facter_version(facter_dir_path, filepath)
100
101
  end
101
102
 
102
- it 'contains an ipaddress fact' do
103
+ it 'contains an ipaddress or networking.ip fact' do
103
104
  pending KNOWN_IPADDRESS_PENDING[relative_path] if KNOWN_IPADDRESS_PENDING.key?(relative_path)
104
- expect(content['ipaddress']).to not_be_nil.and not_be_empty
105
+ case content['facterversion']
106
+ when /^[1-3]/
107
+ expect(content['ipaddress']).to not_be_nil.and not_be_empty
108
+ else
109
+ expect(content['networking']['ip']).to not_be_nil.and not_be_empty
110
+ end
111
+
105
112
  end
106
113
  end
107
114
  end