facterdb 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +19 -17
  4. data/facts/1.6/debian-6-i386.facts +56 -54
  5. data/facts/1.6/debian-6-x86_64.facts +56 -54
  6. data/facts/1.6/debian-7-i386.facts +23 -21
  7. data/facts/1.6/debian-7-x86_64.facts +23 -21
  8. data/facts/1.6/ubuntu-15.10-i386.facts +74 -0
  9. data/facts/1.7/centos-7-i386.facts +18 -16
  10. data/facts/1.7/debian-6-i386.facts +73 -77
  11. data/facts/1.7/debian-6-x86_64.facts +73 -77
  12. data/facts/1.7/debian-7-i386.facts +32 -30
  13. data/facts/1.7/debian-7-x86_64.facts +32 -30
  14. data/facts/1.7/ubuntu-15.10-i386.facts +90 -0
  15. data/facts/2.0/centos-7-i386.facts +18 -16
  16. data/facts/2.0/debian-6-i386.facts +72 -76
  17. data/facts/2.0/debian-6-x86_64.facts +72 -76
  18. data/facts/2.0/debian-7-i386.facts +66 -64
  19. data/facts/2.0/debian-7-x86_64.facts +66 -64
  20. data/facts/2.0/ubuntu-15.10-i386.facts +91 -0
  21. data/facts/2.1/centos-7-i386.facts +19 -17
  22. data/facts/2.1/debian-6-i386.facts +77 -81
  23. data/facts/2.1/debian-6-x86_64.facts +77 -81
  24. data/facts/2.1/debian-7-i386.facts +74 -72
  25. data/facts/2.1/debian-7-x86_64.facts +74 -72
  26. data/facts/2.1/ubuntu-15.10-i386.facts +99 -0
  27. data/facts/2.2/centos-7-i386.facts +22 -20
  28. data/facts/2.2/debian-6-i386.facts +105 -109
  29. data/facts/2.2/debian-6-x86_64.facts +105 -109
  30. data/facts/2.2/debian-7-i386.facts +100 -98
  31. data/facts/2.2/debian-7-x86_64.facts +100 -98
  32. data/facts/2.2/ubuntu-14.04-i386.facts +85 -83
  33. data/facts/2.2/ubuntu-15.10-i386.facts +129 -0
  34. data/facts/2.3/centos-7-i386.facts +22 -20
  35. data/facts/2.3/debian-6-i386.facts +107 -111
  36. data/facts/2.3/debian-6-x86_64.facts +107 -111
  37. data/facts/2.3/debian-7-i386.facts +101 -99
  38. data/facts/2.3/debian-7-x86_64.facts +101 -99
  39. data/facts/2.3/ubuntu-14.04-i386.facts +85 -83
  40. data/facts/2.3/ubuntu-15.10-i386.facts +130 -0
  41. data/facts/2.4/centos-7-i386.facts +23 -21
  42. data/facts/2.4/debian-6-i386.facts +107 -111
  43. data/facts/2.4/debian-6-x86_64.facts +107 -111
  44. data/facts/2.4/debian-7-i386.facts +101 -99
  45. data/facts/2.4/debian-7-x86_64.facts +101 -99
  46. data/facts/2.4/ubuntu-14.04-i386.facts +85 -83
  47. data/facts/2.4/ubuntu-15.10-i386.facts +131 -0
  48. data/facts/3.0/debian-6-i386.facts +34 -34
  49. data/facts/3.0/debian-6-x86_64.facts +34 -34
  50. data/facts/3.0/debian-7-i386.facts +54 -85
  51. data/facts/3.0/debian-7-x86_64.facts +54 -85
  52. data/facts/3.0/ubuntu-14.04-i386.facts +134 -47
  53. data/facts/3.0/ubuntu-15.10-i386.facts +212 -0
  54. data/facts/3.1/debian-6-i386.facts +262 -0
  55. data/facts/3.1/debian-6-x86_64.facts +262 -0
  56. data/facts/3.1/debian-7-i386.facts +245 -0
  57. data/facts/3.1/debian-7-x86_64.facts +245 -0
  58. data/facts/3.1/ubuntu-15.10-i386.facts +255 -0
  59. data/facts/Vagrantfile +5 -22
  60. data/lib/facterdb/version.rb +1 -1
  61. data/lib/facterdb.rb +36 -7
  62. data/spec/facterdb_spec.rb +38 -0
  63. metadata +14 -1
@@ -0,0 +1,245 @@
1
+ {
2
+ "augeas": {
3
+ "version": "1.4.0"
4
+ },
5
+ "disks": {
6
+ "sda": {
7
+ "model": "VBOX HARDDISK",
8
+ "size": "9.90 GiB",
9
+ "size_bytes": 10632560640,
10
+ "vendor": "ATA"
11
+ }
12
+ },
13
+ "dmi": {
14
+ "bios": {
15
+ "release_date": "12/01/2006",
16
+ "vendor": "innotek GmbH",
17
+ "version": "VirtualBox"
18
+ },
19
+ "board": {
20
+ "manufacturer": "Oracle Corporation",
21
+ "product": "VirtualBox",
22
+ "serial_number": "0"
23
+ },
24
+ "chassis": {
25
+ "type": "Other"
26
+ },
27
+ "manufacturer": "innotek GmbH",
28
+ "product": {
29
+ "name": "VirtualBox",
30
+ "serial_number": "0",
31
+ "uuid": "E517E67A-D212-4EBD-BAB9-72394F835EEF"
32
+ }
33
+ },
34
+ "facterversion": "3.1.1",
35
+ "filesystems": "ext4",
36
+ "identity": {
37
+ "gid": 0,
38
+ "group": "root",
39
+ "uid": 0,
40
+ "user": "root"
41
+ },
42
+ "is_virtual": true,
43
+ "kernel": "Linux",
44
+ "kernelmajversion": "3.2",
45
+ "kernelrelease": "3.2.0-4-amd64",
46
+ "kernelversion": "3.2.0",
47
+ "load_averages": {
48
+ "15m": 0.02,
49
+ "1m": 0.0,
50
+ "5m": 0.02
51
+ },
52
+ "memory": {
53
+ "swap": {
54
+ "available": "462.00 MiB",
55
+ "available_bytes": 484438016,
56
+ "capacity": "0%",
57
+ "total": "462.00 MiB",
58
+ "total_bytes": 484438016,
59
+ "used": "0 bytes",
60
+ "used_bytes": 0
61
+ },
62
+ "system": {
63
+ "available": "444.89 MiB",
64
+ "available_bytes": 466497536,
65
+ "capacity": "10.48%",
66
+ "total": "496.96 MiB",
67
+ "total_bytes": 521101312,
68
+ "used": "52.07 MiB",
69
+ "used_bytes": 54603776
70
+ }
71
+ },
72
+ "mountpoints": {
73
+ "/": {
74
+ "available": "8.31 GiB",
75
+ "available_bytes": 8917893120,
76
+ "capacity": "10.69%",
77
+ "device": "/dev/disk/by-uuid/9dea98aa-91f6-4db4-9fab-23b07d1fe4e3",
78
+ "filesystem": "ext4",
79
+ "options": [
80
+ "rw",
81
+ "relatime",
82
+ "errors=remount-ro",
83
+ "user_xattr",
84
+ "barrier=1",
85
+ "data=ordered"
86
+ ],
87
+ "size": "9.30 GiB",
88
+ "size_bytes": 9985515520,
89
+ "used": "1018.16 MiB",
90
+ "used_bytes": 1067622400
91
+ }
92
+ },
93
+ "networking": {
94
+ "dhcp": "10.0.2.2",
95
+ "domain": "example.com",
96
+ "fqdn": "foo.example.com",
97
+ "hostname": "foo",
98
+ "interfaces": {
99
+ "eth0": {
100
+ "bindings": [
101
+ {
102
+ "address": "10.0.2.15",
103
+ "netmask": "255.255.255.0",
104
+ "network": "10.0.2.0"
105
+ }
106
+ ],
107
+ "bindings6": [
108
+ {
109
+ "address": "fe80::a00:27ff:fe79:b224",
110
+ "netmask": "ffff:ffff:ffff:ffff::",
111
+ "network": "fe80::"
112
+ }
113
+ ],
114
+ "dhcp": "10.0.2.2",
115
+ "ip": "10.0.2.15",
116
+ "ip6": "fe80::a00:27ff:fe79:b224",
117
+ "mac": "08:00:27:79:b2:24",
118
+ "mtu": 1500,
119
+ "netmask": "255.255.255.0",
120
+ "netmask6": "ffff:ffff:ffff:ffff::",
121
+ "network": "10.0.2.0",
122
+ "network6": "fe80::"
123
+ },
124
+ "lo": {
125
+ "bindings": [
126
+ {
127
+ "address": "127.0.0.1",
128
+ "netmask": "255.0.0.0",
129
+ "network": "127.0.0.0"
130
+ }
131
+ ],
132
+ "bindings6": [
133
+ {
134
+ "address": "::1",
135
+ "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
136
+ "network": "::1"
137
+ }
138
+ ],
139
+ "ip": "127.0.0.1",
140
+ "ip6": "::1",
141
+ "mtu": 16436,
142
+ "netmask": "255.0.0.0",
143
+ "netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
144
+ "network": "127.0.0.0",
145
+ "network6": "::1"
146
+ }
147
+ },
148
+ "ip": "10.0.2.15",
149
+ "ip6": "fe80::a00:27ff:fe79:b224",
150
+ "mac": "08:00:27:79:b2:24",
151
+ "mtu": 1500,
152
+ "netmask": "255.255.255.0",
153
+ "netmask6": "ffff:ffff:ffff:ffff::",
154
+ "network": "10.0.2.0",
155
+ "network6": "fe80::",
156
+ "primary": "eth0"
157
+ },
158
+ "os": {
159
+ "architecture": "amd64",
160
+ "distro": {
161
+ "codename": "wheezy",
162
+ "description": "Debian GNU/Linux 7.9 (wheezy)",
163
+ "id": "Debian",
164
+ "release": {
165
+ "full": "7.9",
166
+ "major": "7",
167
+ "minor": "9"
168
+ }
169
+ },
170
+ "family": "Debian",
171
+ "hardware": "x86_64",
172
+ "name": "Debian",
173
+ "release": {
174
+ "full": "7.9",
175
+ "major": "7",
176
+ "minor": "9"
177
+ },
178
+ "selinux": {
179
+ "enabled": false
180
+ }
181
+ },
182
+ "partitions": {
183
+ "/dev/sda1": {
184
+ "filesystem": "ext4",
185
+ "size": "9.45 GiB",
186
+ "size_bytes": 10144972800,
187
+ "uuid": "9dea98aa-91f6-4db4-9fab-23b07d1fe4e3"
188
+ },
189
+ "/dev/sda2": {
190
+ "size": "1.00 KiB",
191
+ "size_bytes": 1024
192
+ },
193
+ "/dev/sda5": {
194
+ "filesystem": "swap",
195
+ "size": "462.00 MiB",
196
+ "size_bytes": 484442112,
197
+ "uuid": "d02f8355-8d3a-4814-bce2-6718353d17f7"
198
+ }
199
+ },
200
+ "path": "/opt/puppetlabs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
201
+ "processors": {
202
+ "count": 1,
203
+ "isa": "unknown",
204
+ "models": [
205
+ "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz"
206
+ ],
207
+ "physicalcount": 1
208
+ },
209
+ "ruby": {
210
+ "platform": "x86_64-linux",
211
+ "sitedir": "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0",
212
+ "version": "2.1.7"
213
+ },
214
+ "ssh": {
215
+ "dsa": {
216
+ "fingerprints": {
217
+ "sha1": "SSHFP 2 1 e6de9389acdf6d852c8a281684841c8f43dc5fd9",
218
+ "sha256": "SSHFP 2 2 820b9edc387877d7b92abcf248ded50f0dbba1dc3b3275a0a0a807ab6d5f8c8e"
219
+ },
220
+ "key": "AAAAB3NzaC1kc3MAAACBAMyKdvaaL0OCUMyr/8sECFP92/xB8tvvPl4DsEfogwDHqtsykhKOyLkFaKXbRGhGwnCkUxuLfrYK0AEgGIgXvoP0UZRurt0d08nq7E+KWrdnLRa7kpYSlu16xzlBS33xCzuPpiYtLTRlwcURRcdyURhSN3b+oX55V+YNF2GdwyM1AAAAFQD9tobnL6FsaPH3sTvO7FLTmBzXDwAAAIBU7wloPzMF0v5ZAKaPN1h+A6pK3F72UdIJImo4GirU9YLH4Mp/HKKsl/tXds8sZxd6ZS9YfShwDr3n1X/drbX5/j3LL85NrBGSB7NFEQ1Yy1vH/Uu1OlMV01sm3ZyDt38aqA3Olkf19uPZgwEu7eUr4Fj24ghvKhx1ryshzYt5sQAAAIEAtBQ9chWwjpimzqDdozsb/d5kfhWq8Tw9UeS5fublLyi98Vxi0cOu0McHjMAZUn1Q2gaWMDKKlYAAWoSPDPIGl40u8fzWvqzqi4jtoUJXK/rhFoavokb2TuHNVcp6EtSvBYx/V7LfUPgsuBD3We1HsiKYU3XAnsWhMoPw8wMN9GI="
221
+ },
222
+ "ecdsa": {
223
+ "fingerprints": {
224
+ "sha1": "SSHFP 3 1 c26bc29a9e43be5445e0b95bd70b1ec86036b6b7",
225
+ "sha256": "SSHFP 3 2 c329becb9e67db2ea2949fd2e26f56a5e9362987e9b2bf04233a0be6d82fa340"
226
+ },
227
+ "key": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHfcSfdIJS1HprMCU+HIIGk9BWckYcghpGqVgBeAkkEM3wnDnlP8FrywOFEq/z8/ptGha0wTZSrip/TuweX6eeQ="
228
+ },
229
+ "rsa": {
230
+ "fingerprints": {
231
+ "sha1": "SSHFP 1 1 0549867ea04cc2424cc5cc89dc69eb87f0134c61",
232
+ "sha256": "SSHFP 1 2 0aa2ad9bc01d20cc37347b020bc159312d5101b90b3765d9a6e33518a3fa8695"
233
+ },
234
+ "key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDH93avWMWcsuW7oxhNeiKeFBtj5o2N8+1slU1tT4hDAKr6z3aYfdJz6/52AOkRMMz9jn+/62LqXFkp4ZB67lvBSy92gNtp7DnIE+smwYeFxXDvAU14dUMgdcQGD75VaqTs/glLGkQlP6auQWUpl0EpcamKquzk2KD7HlZrbuTjuemMPKwRif0JfsEM75/O9Fh0/cWmaoUJ1cyfU34rBaLpPCDKry4HkeFVX5V6ScFpKE5ZmsteY3QvmEw0pTllslm42XQsRGRrHcb1GPRMecXQXss3Bqrqap3TAit9kcEtzCDJAf0a3jg5ucti5wkBZ17qqdZvKljywDLNlAIH8Enh"
235
+ }
236
+ },
237
+ "system_uptime": {
238
+ "days": 0,
239
+ "hours": 0,
240
+ "seconds": 594,
241
+ "uptime": "0:09 hours"
242
+ },
243
+ "timezone": "GMT",
244
+ "virtual": "virtualbox"
245
+ }
@@ -0,0 +1,255 @@
1
+ {
2
+ "augeas": {
3
+ "version": "1.4.0"
4
+ },
5
+ "disks": {
6
+ "sda": {
7
+ "model": "VBOX HARDDISK",
8
+ "size": "40.00 GiB",
9
+ "size_bytes": 42949672960,
10
+ "vendor": "ATA"
11
+ }
12
+ },
13
+ "dmi": {
14
+ "bios": {
15
+ "release_date": "12/01/2006",
16
+ "vendor": "innotek GmbH",
17
+ "version": "VirtualBox"
18
+ },
19
+ "board": {
20
+ "manufacturer": "Oracle Corporation",
21
+ "product": "VirtualBox",
22
+ "serial_number": "0"
23
+ },
24
+ "chassis": {
25
+ "type": "Other"
26
+ },
27
+ "manufacturer": "innotek GmbH",
28
+ "product": {
29
+ "name": "VirtualBox",
30
+ "serial_number": "0",
31
+ "uuid": "FA4ED213-6351-4238-9DDE-E28CF955AF7C"
32
+ }
33
+ },
34
+ "facterversion": "3.1.1",
35
+ "filesystems": "ext2,ext3,ext4,vfat",
36
+ "identity": {
37
+ "gid": 0,
38
+ "group": "root",
39
+ "uid": 0,
40
+ "user": "root"
41
+ },
42
+ "is_virtual": true,
43
+ "kernel": "Linux",
44
+ "kernelmajversion": "4.2",
45
+ "kernelrelease": "4.2.0-16-generic",
46
+ "kernelversion": "4.2.0",
47
+ "load_averages": {
48
+ "15m": 0.04,
49
+ "1m": 0.55,
50
+ "5m": 0.13
51
+ },
52
+ "memory": {
53
+ "system": {
54
+ "available": "336.66 MiB",
55
+ "available_bytes": 353009664,
56
+ "capacity": "31.14%",
57
+ "total": "488.91 MiB",
58
+ "total_bytes": 512659456,
59
+ "used": "152.25 MiB",
60
+ "used_bytes": 159649792
61
+ }
62
+ },
63
+ "mountpoints": {
64
+ "/": {
65
+ "available": "37.21 GiB",
66
+ "available_bytes": 39953924096,
67
+ "capacity": "4.22%",
68
+ "device": "/dev/sda1",
69
+ "filesystem": "ext4",
70
+ "options": [
71
+ "rw",
72
+ "relatime",
73
+ "data=ordered"
74
+ ],
75
+ "size": "38.85 GiB",
76
+ "size_bytes": 41712922624,
77
+ "used": "1.64 GiB",
78
+ "used_bytes": 1758998528
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
+ "eth0": {
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::a00:27ff:fe03:8001",
98
+ "netmask": "ffff:ffff:ffff:ffff::",
99
+ "network": "fe80::"
100
+ }
101
+ ],
102
+ "dhcp": "10.0.2.2",
103
+ "ip": "10.0.2.15",
104
+ "ip6": "fe80::a00:27ff:fe03:8001",
105
+ "mac": "08:00:27:03:80:01",
106
+ "mtu": 1500,
107
+ "netmask": "255.255.255.0",
108
+ "netmask6": "ffff:ffff:ffff:ffff::",
109
+ "network": "10.0.2.0",
110
+ "network6": "fe80::"
111
+ },
112
+ "lo": {
113
+ "bindings": [
114
+ {
115
+ "address": "127.0.0.1",
116
+ "netmask": "255.0.0.0",
117
+ "network": "127.0.0.0"
118
+ }
119
+ ],
120
+ "bindings6": [
121
+ {
122
+ "address": "::1",
123
+ "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
124
+ "network": "::1"
125
+ }
126
+ ],
127
+ "ip": "127.0.0.1",
128
+ "ip6": "::1",
129
+ "mtu": 65536,
130
+ "netmask": "255.0.0.0",
131
+ "netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
132
+ "network": "127.0.0.0",
133
+ "network6": "::1"
134
+ },
135
+ "lxcbr0": {
136
+ "bindings": [
137
+ {
138
+ "address": "10.0.3.1",
139
+ "netmask": "255.255.255.0",
140
+ "network": "10.0.3.0"
141
+ }
142
+ ],
143
+ "bindings6": [
144
+ {
145
+ "address": "fe80::9859:61ff:feb0:e064",
146
+ "netmask": "ffff:ffff:ffff:ffff::",
147
+ "network": "fe80::"
148
+ }
149
+ ],
150
+ "ip": "10.0.3.1",
151
+ "ip6": "fe80::9859:61ff:feb0:e064",
152
+ "mac": "9a:59:61:b0:e0:64",
153
+ "mtu": 1500,
154
+ "netmask": "255.255.255.0",
155
+ "netmask6": "ffff:ffff:ffff:ffff::",
156
+ "network": "10.0.3.0",
157
+ "network6": "fe80::"
158
+ }
159
+ },
160
+ "ip": "10.0.2.15",
161
+ "ip6": "fe80::a00:27ff:fe03:8001",
162
+ "mac": "08:00:27:03:80:01",
163
+ "mtu": 1500,
164
+ "netmask": "255.255.255.0",
165
+ "netmask6": "ffff:ffff:ffff:ffff::",
166
+ "network": "10.0.2.0",
167
+ "network6": "fe80::",
168
+ "primary": "eth0"
169
+ },
170
+ "os": {
171
+ "architecture": "i386",
172
+ "distro": {
173
+ "codename": "wily",
174
+ "description": "Ubuntu 15.10",
175
+ "id": "Ubuntu",
176
+ "release": {
177
+ "full": "15.10",
178
+ "major": "15.10"
179
+ }
180
+ },
181
+ "family": "Debian",
182
+ "hardware": "i386",
183
+ "name": "Ubuntu",
184
+ "release": {
185
+ "full": "15.10",
186
+ "major": "15.10"
187
+ },
188
+ "selinux": {
189
+ "enabled": false
190
+ }
191
+ },
192
+ "partitions": {
193
+ "/dev/sda1": {
194
+ "filesystem": "ext4",
195
+ "label": "cloudimg-rootfs",
196
+ "mount": "/",
197
+ "partuuid": "0006d50e-01",
198
+ "size": "40.00 GiB",
199
+ "size_bytes": 42948607488,
200
+ "uuid": "20829231-1cab-41a3-9d95-4a0bc22b40c1"
201
+ }
202
+ },
203
+ "path": "/opt/puppetlabs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
204
+ "processors": {
205
+ "count": 1,
206
+ "isa": "i386",
207
+ "models": [
208
+ "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz"
209
+ ],
210
+ "physicalcount": 1
211
+ },
212
+ "ruby": {
213
+ "platform": "i386-linux",
214
+ "sitedir": "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0",
215
+ "version": "2.1.7"
216
+ },
217
+ "ssh": {
218
+ "dsa": {
219
+ "fingerprints": {
220
+ "sha1": "SSHFP 2 1 5a670a1c93514d6ee55a99dab5145a681b664ed0",
221
+ "sha256": "SSHFP 2 2 48908cee3e84531c8a2f08590fb9fabe04e99f3830481a0cf0affdb98690fb73"
222
+ },
223
+ "key": "AAAAB3NzaC1kc3MAAACBAJylejKGL25K+qM26k35UubUXs3YF20X2ARfoC16McT7kzRaJXhYbDqE5jfxrWaSiRH8dSfXWEbYCGdYBSGKbv4ksmNynE1ztmxCC8aSwmfPDXpWIEamnXwr0drW/puLfB8I6tZP1FwjeBkNKMb51vVW/BlBT3LnLWXDVpYKyim1AAAAFQCnBi/d6xxDrfFKz4biNWPvuyHYxwAAAIADtddNIuva+q7gDDmItd0WQGkQE/XxLlUCkRFmvND1mDnxWKRrS3Vqn4YQUPHpTwRSU6RukFh8oKKWvC/ckC+wgUnpH2rdepDshWDCp8933+QPZWWRuhFY99XUsZGlUtwuIjxs0iQqJBEjQ2f+ZX3tNMfSswt/BcfzqKLNTDU/kQAAAIBLnAca7OJWgrTStDbClKriP0forBmQq+sKenbY5gnnE6tUmHLLCjqvuzdpl2wAvXhcerks1wsvnebLe40pucx/1MjqqZgCu8ki3nW5yn4vLG/y2JW17oET3gSj5ixLqSKqIXHQlUNptrDsVCPL+MEhYgY5ktMy9RF/JACmScxp9w=="
224
+ },
225
+ "ecdsa": {
226
+ "fingerprints": {
227
+ "sha1": "SSHFP 3 1 099830f601f15c2055dd608dd77caa44515aa028",
228
+ "sha256": "SSHFP 3 2 6eb39571c7e7766b97ff2814f2204b12ba696650079d7e2db267c2d853ecd0bd"
229
+ },
230
+ "key": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMYtI5Sf67iAndcuuacxLqX2UM5m9qP81iZy7NDsI+HVA0yNV+T3OBQxYVlNq9UwX30I4J+Da20pM0iU4Ipn0xA="
231
+ },
232
+ "ed25519": {
233
+ "fingerprints": {
234
+ "sha1": "SSHFP 4 1 90655b7d1a5b0fd3ffb34fbbd4cde8bfdf0ec0bf",
235
+ "sha256": "SSHFP 4 2 574690e400a6291c17617aca181521d2d606198d24d9febf039fabfdcd28a83c"
236
+ },
237
+ "key": "AAAAC3NzaC1lZDI1NTE5AAAAIPTI/mTDnXgBs/nbiJ0zYHCfKrcBEVnckTg5pQsmzrUa"
238
+ },
239
+ "rsa": {
240
+ "fingerprints": {
241
+ "sha1": "SSHFP 1 1 997487332c9bc67b02c1536041c08c60fccdd403",
242
+ "sha256": "SSHFP 1 2 f8c898dcb8f0470058a25806def5775b318cd8c46320c7199c5feec45eb614f7"
243
+ },
244
+ "key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDZuid9vUZKhPJT3V6CC1DuyTOd4JbAjL83P66plKEKvWaml9RNry31AEsSRrD09cVFEbswv/z2kb2KKxTkMIg9EfPogAddh3XMOQOQgWbihFt0vRmJzG7MC8klxufs9nqaqGeQCyoXld3Xp1tvrY+izu/TaJvx2mrkl1XdtFGMDzRuPLNjmSNP4g6S47CfHA2c2foazz0I2/ERrpCCCf2DvYE/iIoDMZSUvu5Boa6xuRwAhZd3LBlr5GYffBGa920ZlJ+sq+9Nf5YT9EXkLRWQ09Uq8rvnLotQtaBUUZNx+YBDXw4k8gL+fBNZlh8xt6Jy0WuODjVe7DcNYARiV9eJ"
245
+ }
246
+ },
247
+ "system_uptime": {
248
+ "days": 0,
249
+ "hours": 0,
250
+ "seconds": 39,
251
+ "uptime": "0:00 hours"
252
+ },
253
+ "timezone": "UTC",
254
+ "virtual": "virtualbox"
255
+ }
data/facts/Vagrantfile CHANGED
@@ -10,53 +10,36 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
10
 
11
11
  config.vm.define "debian-6-x86_64" do |host|
12
12
  host.vm.box = "puppetlabs/debian-6.0.10-64-nocm"
13
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y ruby rubygems"
14
13
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
15
14
  host.vm.provision "shell", path: "get_facts.sh"
16
15
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
17
16
  end
18
17
  config.vm.define "debian-7-x86_64" do |host|
19
- host.vm.box = "puppetlabs/debian-7.8-64-nocm"
20
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y ruby rubygems ruby-dev"
18
+ host.vm.box = "debian/wheezy64"
21
19
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
22
20
  host.vm.provision "shell", path: "get_facts.sh"
23
21
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
24
22
  end
25
23
  config.vm.define "debian-8-x86_64" do |host|
26
- host.vm.box = "camptocamp/debian-8-amd64"
27
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y curl"
28
- host.vm.provision "shell", inline: "curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \\curl -sSL https://get.rvm.io | bash -s stable"
29
- host.vm.provision "shell", inline: "source /etc/profile.d/rvm.sh && rvm install 1.9.3 && rvm use --create 1.9.3"
30
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
31
- host.vm.provision "shell", path: "get_facts.sh"
32
- host.vm.provision "shell", inline: "/sbin/shutdown -h now"
33
- end
34
- config.vm.define "ubuntu-10.04-x86_64" do |host|
35
- host.vm.box = "ubuntu-server-10044-x64-vbox4210-nocm"
36
- host.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box"
37
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y ruby ruby-dev rubygems libopenssl-ruby"
38
- host.vm.provision "shell", inline: "gem install rubygems-update && /var/lib/gems/1.8/bin/update_rubygems"
24
+ host.vm.box = "debian/jessie64"
39
25
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
40
26
  host.vm.provision "shell", path: "get_facts.sh"
41
27
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
42
28
  end
43
29
  config.vm.define "ubuntu-12.04-x86_64" do |host|
44
- host.vm.box = "puppetlabs/ubuntu-12.04-64-nocm"
45
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y rubygems"
30
+ host.vm.box = "ubuntu/precise64"
46
31
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
47
32
  host.vm.provision "shell", path: "get_facts.sh"
48
33
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
49
34
  end
50
35
  config.vm.define "ubuntu-14.04-x86_64" do |host|
51
- host.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
52
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y ruby ruby-dev"
36
+ host.vm.box = "ubuntu/trusty64"
53
37
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
54
38
  host.vm.provision "shell", path: "get_facts.sh"
55
39
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
56
40
  end
57
41
  config.vm.define "ubuntu-14.10-x86_64" do |host|
58
- host.vm.box = "chef/ubuntu-14.10"
59
- host.vm.provision "shell", inline: "apt-get update && apt-get install -y ruby ruby-dev"
42
+ host.vm.box = "ubuntu/utopic64"
60
43
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
61
44
  host.vm.provision "shell", path: "get_facts.sh"
62
45
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
@@ -1,5 +1,5 @@
1
1
  module FacterDB
2
2
  module Version
3
- STRING = '0.2.2'
3
+ STRING = '0.3.0'
4
4
  end
5
5
  end
data/lib/facterdb.rb CHANGED
@@ -3,21 +3,50 @@ require 'jgrep'
3
3
 
4
4
  module FacterDB
5
5
 
6
+ def self.database
7
+ @database ||= "[#{Dir.glob("#{File.expand_path(File.join(File.dirname(__FILE__), '../facts'))}/*/*.facts").map { |f| File.read(f) }.join(',')}]\n"
8
+ end
9
+
6
10
  def self.get_os_facts(facter_version='*', filter=[])
11
+ if facter_version == '*'
12
+ if filter.is_a?(Array)
13
+ filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')
14
+ elsif filter.is_a?(Hash)
15
+ filter_str = filter.map { |k,v | "#{k}=#{v}" }.join(' and ')
16
+ elsif filter.is_a?(String)
17
+ filter_str = filter
18
+ else
19
+ raise 'filter must be either an Array a Hash or a String'
20
+ end
21
+ else
22
+ if filter.is_a?(Array)
23
+ filter_str = "facterversion=/^#{facter_version}/ and (#{filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')})"
24
+ elsif filter.is_a?(Hash)
25
+ filter_str = "facterversion=/^#{facter_version}/ and (#{filter.map { |k,v | "#{k}=#{v}" }.join(' and ')})"
26
+ elsif filter.is_a?(String)
27
+ filter_str = "facterversion=/^#{facter_version}/ and (#{filter})"
28
+ else
29
+ raise 'filter must be either an Array a Hash or a String'
30
+ end
31
+ end
32
+
33
+ warn "[DEPRECATION] `get_os_facts` is deprecated. Please use `get_facts(#{filter_str})` instead."
34
+
35
+ get_facts(filter_str)
36
+ end
37
+
38
+ def self.get_facts(filter=nil)
7
39
  if filter.is_a?(Array)
8
- filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')
40
+ filter_str = '(' + filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(') or (') + ')'
9
41
  elsif filter.is_a?(Hash)
10
42
  filter_str = filter.map { |k,v | "#{k}=#{v}" }.join(' and ')
11
43
  elsif filter.is_a?(String)
12
44
  filter_str = filter
45
+ elsif filter == nil
46
+ filter_str = ''
13
47
  else
14
48
  raise 'filter must be either an Array a Hash or a String'
15
49
  end
16
-
17
- facts_dir = File.expand_path(File.join(File.dirname(__FILE__), '../facts'))
18
-
19
- jsons = Dir.glob("#{facts_dir}/#{facter_version}/*.facts").map { |f| File.read(f) }
20
- json = "[#{jsons.join(',')}]\n"
21
- JGrep.jgrep(json, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
50
+ JGrep.jgrep(database, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
22
51
  end
23
52
  end
@@ -48,4 +48,42 @@ describe 'FacterDB' do
48
48
  end
49
49
  end
50
50
  end
51
+
52
+ describe '#get_facts' do
53
+ context 'without parameters' do
54
+ subject { FacterDB.get_facts() }
55
+ it "Should return an array of hashes with at least 1 element" do
56
+ expect(subject.class).to eq Array
57
+ expect(subject.size).not_to eq(0)
58
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
59
+ end
60
+ end
61
+
62
+ context 'with an Array filter' do
63
+ subject { FacterDB.get_facts([{:osfamily => 'Debian'}]) }
64
+ it "Should return an array of hashes with at least 1 element" do
65
+ expect(subject.class).to eq Array
66
+ expect(subject.size).not_to eq(0)
67
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
68
+ end
69
+ end
70
+
71
+ context 'with a Hash filter' do
72
+ subject { FacterDB.get_facts({:osfamily => 'Debian'}) }
73
+ it "Should return an array of hashes with at least 1 element" do
74
+ expect(subject.class).to eq Array
75
+ expect(subject.size).not_to eq(0)
76
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
77
+ end
78
+ end
79
+
80
+ context 'with a String filter' do
81
+ subject { FacterDB.get_facts('osfamily=Debian') }
82
+ it "Should return an array of hashes with at least 1 element" do
83
+ expect(subject.class).to eq Array
84
+ expect(subject.size).not_to eq(0)
85
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
86
+ end
87
+ end
88
+ end
51
89
  end