facterdb 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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": "amd64",
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": "x86_64",
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": "x86_64",
207
+ "models": [
208
+ "Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz"
209
+ ],
210
+ "physicalcount": 1
211
+ },
212
+ "ruby": {
213
+ "platform": "x86_64-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
@@ -4,20 +4,6 @@
4
4
  # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
5
  VAGRANTFILE_API_VERSION = "2"
6
6
 
7
- $install_rvm = <<SCRIPT
8
- # Install mpapis public key
9
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 ||
10
- curl -sSL https://rvm.io/mpapis.asc | gpg --import - &&
11
-
12
- # Run the installer
13
- \\curl -sSL https://get.rvm.io | bash -s stable &&
14
-
15
- # Install Ruby
16
- source /etc/profile.d/rvm.sh &&
17
- rvm install 1.9.3 &&
18
- rvm use --create 1.9.3
19
- SCRIPT
20
-
21
7
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
22
8
 
23
9
  config.vm.hostname = "foo.example.com"
@@ -77,29 +63,30 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
77
63
  end
78
64
  config.vm.define "ubuntu-15.04-x86_64" do |host|
79
65
  host.vm.box = "ubuntu/vivid64"
80
- host.vm.provision "shell", inline: $install_rvm
66
+ host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
67
+ host.vm.provision "shell", path: "get_facts.sh"
68
+ host.vm.provision "shell", inline: "/sbin/shutdown -h now"
69
+ end
70
+ config.vm.define "ubuntu-15.10-x86_64" do |host|
71
+ host.vm.box = "ubuntu/wily64"
81
72
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
82
73
  host.vm.provision "shell", path: "get_facts.sh"
83
74
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
84
75
  end
85
76
  config.vm.define "centos-5-x86_64" do |host|
86
77
  host.vm.box = "puppetlabs/centos-5.11-64-nocm"
87
- host.vm.provision "shell", inline: "curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \\curl -sSL https://get.rvm.io | bash -s stable"
88
- host.vm.provision "shell", inline: "source /etc/profile.d/rvm.sh && rvm install 1.9.3 && rvm use --create 1.9.3"
89
78
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
90
79
  host.vm.provision "shell", path: "get_facts.sh"
91
80
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
92
81
  end
93
82
  config.vm.define "centos-6-x86_64" do |host|
94
83
  host.vm.box = "puppetlabs/centos-6.6-64-nocm"
95
- host.vm.provision "shell", inline: "yum -y install ruby-devel rubygems"
96
84
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
97
85
  host.vm.provision "shell", path: "get_facts.sh"
98
86
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
99
87
  end
100
88
  config.vm.define "centos-7-x86_64" do |host|
101
89
  host.vm.box = "puppetlabs/centos-7.0-64-nocm"
102
- host.vm.provision "shell", inline: "yum -y install ruby ruby-devel"
103
90
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
104
91
  host.vm.provision "shell", path: "get_facts.sh"
105
92
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
@@ -159,7 +146,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
159
146
  config.vm.define "gentoo-x86_64" do |host|
160
147
  host.vm.box = "cmiles/gentoo-amd64-minimal"
161
148
  host.vm.provision "shell", inline: "emerge-webrsync && emerge app-crypt/gnupg net-misc/curl"
162
- host.vm.provision "shell", inline: $install_rvm
163
149
  host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
164
150
  host.vm.provision "shell", path: "get_facts.sh"
165
151
  host.vm.provision "shell", inline: "/sbin/shutdown -h now"
data/facts/get_facts.sh CHANGED
@@ -1,84 +1,61 @@
1
1
  #!/bin/bash
2
2
 
3
- set -e
4
-
5
- # Make Solaris use GNU tools by default
6
- export PATH=/usr/gnu/bin:$PATH
3
+ export PATH=/opt/puppetlabs/bin:$PATH
4
+
5
+ if test -f /usr/bin/apt-get; then
6
+ lsbdistcodename=$(lsb_release -sc)
7
+ operatingsystem=$(lsb_release -si)
8
+ operatingsystemmajrelease=$(lsb_release -sr)
9
+ osfamily='Debian'
10
+ elif test -f /usr/bin/yum; then
11
+ operatingsystemmajrelease=$(cat /etc/redhat-release | cut -d' ' -f4 | cut -c1)
12
+ osfamily='RedHat'
13
+ else
14
+ echo 'Could not detect OS family, aborting!'
15
+ exit 1
16
+ fi
17
+
18
+ case "${osfamily}" in
19
+ 'RedHat')
20
+ wget "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-${operatingsystemmajrelease}.noarch.rpm" -O /tmp/puppetlabs-release-pc1.rpm
21
+ rpm -ivh /tmp/puppetlabs-release-pc1.rpm
22
+ for puppet_agent_version in 1.2.2 1.2.7; do
23
+ yum install -y puppet-agent-${puppet_agent_version}
24
+ output_file="/vagrant/$(facter --version | cut -c1-3)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-$(facter hardwaremodel).facts"
25
+ mkdir -p $(dirname ${output_file})
26
+ facter -j | tee ${output_file}
27
+ done
28
+ ;;
29
+
30
+ 'Debian')
31
+ if [[ "wily" =~ ${lsbdistcodename} ]]; then
32
+ lsbdistcodename='trusty'
33
+ fi
34
+ wget "https://apt.puppetlabs.com/puppetlabs-release-pc1-${lsbdistcodename}.deb" -O /tmp/puppetlabs-release-pc1.deb
35
+ dpkg --install /tmp/puppetlabs-release-pc1.deb
36
+ apt-get update
37
+ for puppet_agent_version in 1.2.2 1.2.7; do
38
+ apt-get -y --force-yes install puppet-agent=${puppet_agent_version}*
39
+ output_file="/vagrant/$(facter --version | cut -c1-3)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-$(facter hardwaremodel).facts"
40
+ mkdir -p $(dirname ${output_file})
41
+ facter -j | tee ${output_file}
42
+ done
43
+ ;;
44
+ esac
7
45
 
8
- # Fix for squeeze, el7, arch, opensuse12, opensuse13 and solaris
9
- export PATH=$PATH:/var/lib/gems/1.8/bin/:/usr/local/bin:/root/.gem/ruby/2.1.0/bin:/usr/lib64/ruby/gems/1.9.1/gems/bundler-1.7.12/bin:/usr/lib64/ruby/gems/2.0.0/gems/bundler-1.7.12/bin:/usr/ruby/1.9/bin
46
+ operatingsystem=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
47
+ operatingsystemmajrelease=$(facter operatingsystemmajrelease)
48
+ hardwaremodel=$(facter hardwaremodel)
10
49
 
11
- # Install latest version of facter
50
+ PATH=/opt/puppetlabs/puppet/bin:$PATH
12
51
  gem install bundler --no-ri --no-rdoc --no-format-executable
13
52
  bundle install --path vendor/bundler
14
- operatingsystem=$(bundle exec facter operatingsystem | tr '[:upper:]' '[:lower:]')
15
- operatingsystemrelease=$(bundle exec facter operatingsystemrelease)
16
- operatingsystemmajrelease=$(bundle exec facter operatingsystemmajrelease)
17
- lsbdistcodename=$(bundle exec facter lsbdistcodename)
18
- hardwaremodel=$(bundle exec facter hardwaremodel)
19
-
20
- # Fix for FreeBSD
21
- [ "${hardwaremodel}" = 'amd64' ] && hardwaremodel='x86_64'
22
-
23
- # Fix for Solaris
24
- [ "${hardwaremodel}" = 'i86pc' ] && hardwaremodel='x86_64'
25
53
 
26
54
  for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0; do
27
55
  FACTER_GEM_VERSION="~> ${version}" bundle update
28
- minor_version=$(echo $version | cut -c1-3)
29
- output_dir="/vagrant/${minor_version}"
30
- mkdir -p $output_dir
31
- case "${operatingsystem}" in
32
- archlinux|gentoo)
33
- output_file="${output_dir}/${operatingsystem}-${hardwaremodel}.facts"
34
- ;;
35
- openbsd)
36
- output_file="${output_dir}/${operatingsystem}-${operatingsystemrelease}-${hardwaremodel}.facts"
37
- ;;
38
- *)
39
- output_file="${output_dir}/${operatingsystem}-${operatingsystemmajrelease}-${hardwaremodel}.facts"
40
- ;;
41
- esac
56
+ output_file="/vagrant/$(bundle exec facter --version | cut -c1-3)/${operatingsystem}-${operatingsystemmajrelease}-${hardwaremodel}.facts"
57
+ mkdir -p $(dirname $output_file)
42
58
  echo $version | grep -q -E '^1\.' &&
43
59
  FACTER_GEM_VERSION="~> ${version}" bundle exec facter -j | bundle exec ruby -e 'require "json"; jj JSON.parse gets' | tee $output_file ||
44
60
  FACTER_GEM_VERSION="~> ${version}" bundle exec facter -j | tee $output_file
45
61
  done
46
-
47
- minor_version=3.0
48
- output_dir="/vagrant/${minor_version}"
49
- mkdir -p $output_dir
50
- case "${operatingsystem}" in
51
- archlinux|gentoo)
52
- output_file="${output_dir}/${operatingsystem}-${hardwaremodel}.facts"
53
- ;;
54
- openbsd)
55
- output_file="${output_dir}/${operatingsystem}-${operatingsystemrelease}-${hardwaremodel}.facts"
56
- ;;
57
- *)
58
- output_file="${output_dir}/${operatingsystem}-${operatingsystemmajrelease}-${hardwaremodel}.facts"
59
- ;;
60
- esac
61
-
62
- case "${operatingsystem}" in
63
- redhat)
64
- case "${operatingsystemmajrelease}" in
65
- 5)
66
- curl "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-${operatingsystemmajrelease}.noarch.rpm" > /tmp/puppetlabs-release-pc1.rpm
67
- rpm -ivh /tmp/puppetlabs-release-pc1.rpm ;;
68
- *)
69
- rpm -ivh "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-${operatingsystemmajrelease}.noarch.rpm"
70
- yum -y install puppet-agent
71
- ;;
72
- esac
73
-
74
- /opt/puppetlabs/bin/facter -j | tee $output_file
75
- ;;
76
- debian|ubuntu)
77
- [ $lsbdistcodename = "lucid" ] && exit # puppet-agent is not supported on lucid
78
- wget "https://apt.puppetlabs.com/puppetlabs-release-pc1-${lsbdistcodename}.deb" -O /tmp/puppetlabs-release-pc1.deb
79
- dpkg --install /tmp/puppetlabs-release-pc1.deb
80
- apt-get update
81
- apt-get -y install puppet-agent
82
- /opt/puppetlabs/bin/facter -j | tee $output_file
83
- ;;
84
- esac
@@ -1,5 +1,5 @@
1
1
  module FacterDB
2
2
  module Version
3
- STRING = '0.2.1'
3
+ STRING = '0.2.2'
4
4
  end
5
5
  end
@@ -11,5 +11,41 @@ describe 'FacterDB' do
11
11
  expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
12
12
  end
13
13
  end
14
+
15
+ context 'without parameters' do
16
+ subject { FacterDB.get_os_facts() }
17
+ it "Should return an array of hashes with at least 1 element" do
18
+ expect(subject.class).to eq Array
19
+ expect(subject.size).not_to eq(0)
20
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
21
+ end
22
+ end
23
+
24
+ context 'with an Array filter' do
25
+ subject { FacterDB.get_os_facts('*', [{:osfamily => 'Debian'}]) }
26
+ it "Should return an array of hashes with at least 1 element" do
27
+ expect(subject.class).to eq Array
28
+ expect(subject.size).not_to eq(0)
29
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
30
+ end
31
+ end
32
+
33
+ context 'with a Hash filter' do
34
+ subject { FacterDB.get_os_facts('*', {:osfamily => 'Debian'}) }
35
+ it "Should return an array of hashes with at least 1 element" do
36
+ expect(subject.class).to eq Array
37
+ expect(subject.size).not_to eq(0)
38
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
39
+ end
40
+ end
41
+
42
+ context 'with a String filter' do
43
+ subject { FacterDB.get_os_facts('*', 'osfamily=Debian') }
44
+ it "Should return an array of hashes with at least 1 element" do
45
+ expect(subject.class).to eq Array
46
+ expect(subject.size).not_to eq(0)
47
+ expect(subject.select { |facts| facts.class != Hash }.size).to eq(0)
48
+ end
49
+ end
14
50
  end
15
51
  end