ohai 14.15.0 → 15.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/ohai/application.rb +0 -4
- data/lib/ohai/common/dmi.rb +43 -43
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/loader.rb +32 -47
- data/lib/ohai/mixin/dmi_decode.rb +29 -32
- data/lib/ohai/mixin/os.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +5 -5
- data/lib/ohai/plugins/aix/virtualization.rb +4 -4
- data/lib/ohai/plugins/bsd/virtualization.rb +10 -12
- data/lib/ohai/plugins/c.rb +0 -20
- data/lib/ohai/plugins/elixir.rb +13 -13
- data/lib/ohai/plugins/filesystem.rb +10 -10
- data/lib/ohai/plugins/gce.rb +42 -8
- data/lib/ohai/plugins/go.rb +11 -11
- data/lib/ohai/plugins/groovy.rb +12 -12
- data/lib/ohai/plugins/hostname.rb +9 -2
- data/lib/ohai/plugins/linux/fips.rb +2 -9
- data/lib/ohai/plugins/linux/memory.rb +5 -0
- data/lib/ohai/plugins/linux/network.rb +1 -1
- data/lib/ohai/plugins/linux/platform.rb +84 -83
- data/lib/ohai/plugins/linux/systemd_paths.rb +0 -3
- data/lib/ohai/plugins/linux/virtualization.rb +10 -20
- data/lib/ohai/plugins/lua.rb +13 -13
- data/lib/ohai/plugins/mono.rb +23 -23
- data/lib/ohai/plugins/nodejs.rb +13 -13
- data/lib/ohai/plugins/openstack.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -28
- data/lib/ohai/plugins/perl.rb +17 -17
- data/lib/ohai/plugins/php.rb +22 -22
- data/lib/ohai/plugins/powershell.rb +30 -30
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +15 -15
- data/lib/ohai/plugins/rust.rb +11 -11
- data/lib/ohai/plugins/solaris2/dmi.rb +48 -48
- data/lib/ohai/plugins/solaris2/virtualization.rb +8 -10
- data/lib/ohai/plugins/virtualbox.rb +21 -21
- data/lib/ohai/plugins/windows/filesystem.rb +2 -2
- data/lib/ohai/plugins/windows/fips.rb +2 -21
- data/lib/ohai/plugins/windows/virtualization.rb +9 -35
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +0 -17
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +2 -2
- data/spec/data/plugins/rpmquery.output +0 -2
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +2 -2
- data/spec/functional/plugins/powershell_spec.rb +2 -2
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +2 -2
- data/spec/ohai_spec.rb +1 -1
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +1 -1
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +12 -12
- data/spec/unit/mixin/azure_metadata_spec.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +1 -1
- data/spec/unit/mixin/dmi_decode.rb +68 -0
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/abort_spec.rb +9 -9
- data/spec/unit/plugins/aix/cpu_spec.rb +4 -4
- data/spec/unit/plugins/aix/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +1 -1
- data/spec/unit/plugins/aix/network_spec.rb +6 -6
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +4 -4
- data/spec/unit/plugins/bsd/virtualization_spec.rb +3 -3
- data/spec/unit/plugins/c_spec.rb +1 -53
- data/spec/unit/plugins/chef_spec.rb +1 -1
- data/spec/unit/plugins/cloud_spec.rb +1 -1
- data/spec/unit/plugins/darwin/cpu_spec.rb +2 -2
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +3 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
- data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
- data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/docker_spec.rb +1 -1
- data/spec/unit/plugins/ec2_spec.rb +1 -1
- data/spec/unit/plugins/elixir_spec.rb +1 -1
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
- data/spec/unit/plugins/fail_spec.rb +28 -28
- data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +1 -1
- data/spec/unit/plugins/hostname_spec.rb +68 -1
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +1 -1
- data/spec/unit/plugins/joyent_spec.rb +3 -3
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linode_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +6 -6
- data/spec/unit/plugins/linux/filesystem_spec.rb +21 -21
- data/spec/unit/plugins/linux/fips_spec.rb +13 -45
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +8 -8
- data/spec/unit/plugins/linux/lsb_spec.rb +3 -3
- data/spec/unit/plugins/linux/lspci_spec.rb +2 -2
- data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +2 -2
- data/spec/unit/plugins/linux/memory_spec.rb +26 -1
- data/spec/unit/plugins/linux/network_spec.rb +37 -37
- data/spec/unit/plugins/linux/platform_spec.rb +580 -837
- data/spec/unit/plugins/linux/sessions_spec.rb +2 -2
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +1 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +28 -227
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +11 -11
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/openstack_spec.rb +8 -4
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +1 -21
- data/spec/unit/plugins/passwd_spec.rb +1 -1
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +6 -6
- data/spec/unit/plugins/platform_spec.rb +1 -1
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +2 -2
- data/spec/unit/plugins/root_group_spec.rb +1 -11
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/rust_spec.rb +1 -1
- data/spec/unit/plugins/scala_spec.rb +1 -1
- data/spec/unit/plugins/scsi_spec.rb +2 -2
- data/spec/unit/plugins/shard_spec.rb +1 -1
- data/spec/unit/plugins/shells_spec.rb +1 -1
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +4 -4
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +6 -6
- data/spec/unit/plugins/solaris2/platform_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +41 -69
- data/spec/unit/plugins/ssh_host_keys_spec.rb +3 -3
- data/spec/unit/plugins/sysconf_spec.rb +2 -2
- data/spec/unit/plugins/timezone_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/vmware_spec.rb +1 -1
- data/spec/unit/plugins/windows/cpu_spec.rb +1 -2
- data/spec/unit/plugins/windows/filesystem_spec.rb +2 -2
- data/spec/unit/plugins/windows/fips_spec.rb +17 -77
- data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +2 -2
- data/spec/unit/plugins/windows/network_spec.rb +1 -1
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +1 -1
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +20 -238
- data/spec/unit/plugins/zpools_spec.rb +7 -7
- data/spec/unit/provides_map_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +1 -1
- data/spec/unit/system_spec.rb +10 -77
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +1 -1
- metadata +6 -9
- data/lib/ohai/plugins/darwin/system_profiler.rb +0 -72
- data/lib/ohai/util/win32/group_helper.rb +0 -76
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -79524
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +0 -40
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
16
|
+
require "spec_helper"
|
17
17
|
|
18
18
|
describe Ohai::System, "plugin go" do
|
19
19
|
let(:plugin) { get_plugin("go") }
|
@@ -16,7 +16,9 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
|
+
require "wmi-lite/wmi"
|
21
|
+
require "socket"
|
20
22
|
|
21
23
|
describe Ohai::System, "hostname plugin" do
|
22
24
|
before(:each) do
|
@@ -88,3 +90,68 @@ describe Ohai::System, "hostname plugin" do
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
end
|
93
|
+
|
94
|
+
describe Ohai::System, "hostname plugin for windows", :windows_only do
|
95
|
+
let(:success) { true }
|
96
|
+
|
97
|
+
let(:host) do
|
98
|
+
{
|
99
|
+
"name" => "local",
|
100
|
+
"dnshostname" => "local",
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
let(:info) do
|
105
|
+
[
|
106
|
+
"local",
|
107
|
+
[],
|
108
|
+
23,
|
109
|
+
"address1",
|
110
|
+
"address2",
|
111
|
+
"address3",
|
112
|
+
"address4"
|
113
|
+
]
|
114
|
+
end
|
115
|
+
|
116
|
+
let(:local_hostent) do
|
117
|
+
[
|
118
|
+
"local",
|
119
|
+
[],
|
120
|
+
23,
|
121
|
+
"address"
|
122
|
+
]
|
123
|
+
end
|
124
|
+
|
125
|
+
let(:fqdn_hostent) do
|
126
|
+
[
|
127
|
+
"local.dx.internal.cloudapp.net",
|
128
|
+
[],
|
129
|
+
23,
|
130
|
+
"address"
|
131
|
+
]
|
132
|
+
end
|
133
|
+
|
134
|
+
before(:each) do
|
135
|
+
@plugin = get_plugin("hostname")
|
136
|
+
allow(WmiLite::Wmi).to receive(:new).and_return(success)
|
137
|
+
allow(success).to receive(:first_of).with("Win32_ComputerSystem").and_return(host)
|
138
|
+
allow(Socket).to receive(:gethostname).and_return("local")
|
139
|
+
allow(Socket).to receive(:gethostbyname).with(anything()).and_return(info)
|
140
|
+
end
|
141
|
+
|
142
|
+
context "when hostname is not set for the machine" do
|
143
|
+
it "should return short machine name" do
|
144
|
+
allow(Socket).to receive(:gethostbyaddr).with(anything()).and_return(local_hostent)
|
145
|
+
@plugin.run
|
146
|
+
expect(@plugin[:fqdn]).to eq("local")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "when hostname is set for the machine" do
|
151
|
+
it "should return the fqdn of the machine" do
|
152
|
+
allow(Socket).to receive(:gethostbyaddr).with(anything()).and_return(fqdn_hostent)
|
153
|
+
@plugin.run
|
154
|
+
expect(@plugin[:fqdn]).to eq("local.dx.internal.cloudapp.net")
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
|
17
|
+
require "spec_helper"
|
18
18
|
|
19
19
|
describe Ohai::System, "plugin joyent" do
|
20
20
|
let(:plugin) { get_plugin("joyent") }
|
@@ -65,14 +65,14 @@ describe Ohai::System, "plugin joyent" do
|
|
65
65
|
Name: Joyent Instance
|
66
66
|
Image: pkgbuild 16.3.1
|
67
67
|
Documentation: https://docs.joyent.com/images/smartos/pkgbuild
|
68
|
-
|
68
|
+
EOS
|
69
69
|
|
70
70
|
pkg_install_conf = <<~EOS
|
71
71
|
GPG_KEYRING_VERIFY=/opt/local/etc/gnupg/pkgsrc.gpg
|
72
72
|
GPG_KEYRING_PKGVULN=/opt/local/share/gnupg/pkgsrc-security.gpg
|
73
73
|
PKG_PATH=https://pkgsrc.joyent.com/packages/SmartOS/2016Q3/x86_64/All
|
74
74
|
VERIFIED_INSTALLATION=trusted
|
75
|
-
|
75
|
+
EOS
|
76
76
|
|
77
77
|
allow(::File).to receive(:read).with("/etc/product").and_return(etc_product)
|
78
78
|
allow(::File).to receive(:read).with("/opt/local/etc/pkg_install.conf").and_return(pkg_install_conf)
|
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "tempfile"
|
20
|
-
|
20
|
+
require "spec_helper"
|
21
21
|
|
22
22
|
shared_examples "Common cpu info" do |total_cpu, real_cpu|
|
23
23
|
describe "cpu" do
|
@@ -92,12 +92,12 @@ describe Ohai::System, "General Linux cpu plugin" do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
after(:each) do
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
|
96
|
+
tempfile.close
|
97
|
+
tempfile.unlink
|
98
|
+
rescue
|
99
99
|
# really do not care
|
100
|
-
|
100
|
+
|
101
101
|
end
|
102
102
|
|
103
103
|
context "with old kernel that doesn't include cores in /proc/cpuinfo" do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux filesystem plugin" do
|
22
22
|
let(:plugin) { get_plugin("filesystem") }
|
@@ -69,7 +69,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
69
69
|
/dev/mapper/sys.vg-usr.lv 19223252 5479072 12767696 31% /usr
|
70
70
|
/dev/mapper/sys.vg-var.lv 19223252 3436556 14810212 19% /var
|
71
71
|
/dev/md0 960492 36388 875312 4% /boot
|
72
|
-
DF
|
72
|
+
DF
|
73
73
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @stdout, ""))
|
74
74
|
|
75
75
|
@inode_stdout = <<~DFI
|
@@ -79,7 +79,7 @@ DF
|
|
79
79
|
tmpfs 126922 273 126649 1% /run
|
80
80
|
none 126922 1 126921 1% /run/lock
|
81
81
|
none 126922 1 126921 1% /run/shm
|
82
|
-
DFI
|
82
|
+
DFI
|
83
83
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
84
84
|
end
|
85
85
|
|
@@ -148,7 +148,7 @@ DFI
|
|
148
148
|
/dev/md0 on /boot type ext3 (rw,noatime,errors=remount-ro)
|
149
149
|
fusectl on /sys/fs/fuse/connections type fusectl (rw)
|
150
150
|
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
|
151
|
-
MOUNT
|
151
|
+
MOUNT
|
152
152
|
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
|
153
153
|
end
|
154
154
|
|
@@ -189,7 +189,7 @@ MOUNT
|
|
189
189
|
/dev/mapper/sys.vg-usr.lv 19223252 5479072 12767696 31% /usr
|
190
190
|
/dev/mapper/sys.vg-var.lv 19223252 3436556 14810212 19% /var
|
191
191
|
/dev/md0 960492 36388 875312 4% /boot
|
192
|
-
DF
|
192
|
+
DF
|
193
193
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
194
194
|
|
195
195
|
@inode_stdout = <<~DFI
|
@@ -199,7 +199,7 @@ DF
|
|
199
199
|
tmpfs 126922 273 126649 1% /run
|
200
200
|
none 126922 1 126921 1% /run/lock
|
201
201
|
none 126922 1 126921 1% /run/shm
|
202
|
-
DFI
|
202
|
+
DFI
|
203
203
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
204
204
|
|
205
205
|
@stdout = <<~BLKID_TYPE
|
@@ -215,7 +215,7 @@ DFI
|
|
215
215
|
/dev/mapper/sys.vg-usr.lv: LABEL=\"/usr\" UUID=\"26ec33c5-d00b-4f88-a550-492def013bbc\" TYPE=\"ext4\"
|
216
216
|
/dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
|
217
217
|
/dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
|
218
|
-
BLKID_TYPE
|
218
|
+
BLKID_TYPE
|
219
219
|
allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
|
220
220
|
end
|
221
221
|
|
@@ -245,7 +245,7 @@ BLKID_TYPE
|
|
245
245
|
/dev/mapper/sys.vg-usr.lv 19223252 5479072 12767696 31% /usr
|
246
246
|
/dev/mapper/sys.vg-var.lv 19223252 3436556 14810212 19% /var
|
247
247
|
/dev/md0 960492 36388 875312 4% /boot
|
248
|
-
DF
|
248
|
+
DF
|
249
249
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
250
250
|
|
251
251
|
@inode_stdout = <<~DFI
|
@@ -255,7 +255,7 @@ DF
|
|
255
255
|
tmpfs 126922 273 126649 1% /run
|
256
256
|
none 126922 1 126921 1% /run/lock
|
257
257
|
none 126922 1 126921 1% /run/shm
|
258
|
-
DFI
|
258
|
+
DFI
|
259
259
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
260
260
|
|
261
261
|
allow(plugin).to receive(:which).with("lsblk").and_return("/sbin/lsblk")
|
@@ -274,7 +274,7 @@ DFI
|
|
274
274
|
NAME=\"sys.vg-var.lv\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/var\" FSTYPE=\"ext4\"
|
275
275
|
NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
|
276
276
|
NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
|
277
|
-
BLKID_TYPE
|
277
|
+
BLKID_TYPE
|
278
278
|
allow(plugin).to receive(:shell_out)
|
279
279
|
.with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60)
|
280
280
|
.and_return(mock_shell_out(0, @stdout, ""))
|
@@ -312,7 +312,7 @@ BLKID_TYPE
|
|
312
312
|
/dev/mapper/sys.vg-usr.lv 19223252 5479072 12767696 31% /usr
|
313
313
|
/dev/mapper/sys.vg-var.lv 19223252 3436556 14810212 19% /var
|
314
314
|
/dev/md0 960492 36388 875312 4% /boot
|
315
|
-
DF
|
315
|
+
DF
|
316
316
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
317
317
|
|
318
318
|
@inode_stdout = <<~DFI
|
@@ -322,7 +322,7 @@ DF
|
|
322
322
|
tmpfs 126922 273 126649 1% /run
|
323
323
|
none 126922 1 126921 1% /run/lock
|
324
324
|
none 126922 1 126921 1% /run/shm
|
325
|
-
DFI
|
325
|
+
DFI
|
326
326
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
327
327
|
|
328
328
|
allow(plugin).to receive(:which).with("lsblk").and_return("/sbin/lsblk")
|
@@ -341,7 +341,7 @@ DFI
|
|
341
341
|
NAME=\"sys.vg-var.lv\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/var\" FSTYPE=\"ext4\"
|
342
342
|
NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/BADhome\" FSTYPE=\"xfs\"
|
343
343
|
NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
|
344
|
-
BLKID_TYPE
|
344
|
+
BLKID_TYPE
|
345
345
|
allow(plugin).to receive(:shell_out)
|
346
346
|
.with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60)
|
347
347
|
.and_return(mock_shell_out(0, @stdout, ""))
|
@@ -358,7 +358,7 @@ BLKID_TYPE
|
|
358
358
|
/dev/mapper/sys.vg-usr.lv: LABEL=\"/usr\" UUID=\"26ec33c5-d00b-4f88-a550-492def013bbc\" TYPE=\"ext4\"
|
359
359
|
/dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
|
360
360
|
/dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
|
361
|
-
BLKID_TYPE
|
361
|
+
BLKID_TYPE
|
362
362
|
allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
|
363
363
|
end
|
364
364
|
|
@@ -405,7 +405,7 @@ BLKID_TYPE
|
|
405
405
|
/dev/md0 /boot ext3 rw,noatime,errors=remount-ro,data=ordered 0 0
|
406
406
|
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
|
407
407
|
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
|
408
|
-
MOUNTS
|
408
|
+
MOUNTS
|
409
409
|
@counter = 0
|
410
410
|
allow(@double_file).to receive(:read_nonblock) do
|
411
411
|
@counter += 1
|
@@ -448,7 +448,7 @@ MOUNTS
|
|
448
448
|
/dev/mapper/sys.vg-home.lv 97605056 53563252 44041804 55% /home
|
449
449
|
/dev/mapper/sys.vg-home.lv 97605056 53563252 44041804 55% /home2
|
450
450
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /var/chroot
|
451
|
-
DF
|
451
|
+
DF
|
452
452
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
453
453
|
|
454
454
|
@inode_stdout = <<~DFI
|
@@ -460,7 +460,7 @@ DF
|
|
460
460
|
/dev/mapper/sys.vg-home.lv 60891136 4696030 56195106 8% /home
|
461
461
|
/dev/mapper/sys.vg-home.lv 60891136 4696030 56195106 8% /home2
|
462
462
|
/dev/mapper/sys.vg-root.lv 1310720 107407 1203313 9% /var/chroot
|
463
|
-
DFI
|
463
|
+
DFI
|
464
464
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
465
465
|
|
466
466
|
allow(plugin).to receive(:which).with("lsblk").and_return("/sbin/lsblk")
|
@@ -468,7 +468,7 @@ DFI
|
|
468
468
|
@stdout = <<~BLKID_TYPE
|
469
469
|
NAME=\"/dev/mapper/sys.vg-root.lv\" UUID=\"7742d14b-80a3-4e97-9a32-478be9ea9aea\" LABEL=\"/\" FSTYPE=\"ext4\"
|
470
470
|
NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
|
471
|
-
BLKID_TYPE
|
471
|
+
BLKID_TYPE
|
472
472
|
allow(plugin).to receive(:shell_out)
|
473
473
|
.with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60)
|
474
474
|
.and_return(mock_shell_out(0, @stdout, ""))
|
@@ -493,7 +493,7 @@ BLKID_TYPE
|
|
493
493
|
/dev/mapper/sys.vg-home.lv 97605056 53563252 44041804 55% /home
|
494
494
|
/dev/sdb1 97605056 53563252 44041804 55% /mnt
|
495
495
|
/dev/sdc1 4805760 378716 4182924 9% /mnt
|
496
|
-
DF
|
496
|
+
DF
|
497
497
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @dfstdout, ""))
|
498
498
|
|
499
499
|
@inode_stdout = <<~DFI
|
@@ -505,7 +505,7 @@ DF
|
|
505
505
|
/dev/mapper/sys.vg-home.lv 60891136 4696030 56195106 8% /home
|
506
506
|
/dev/sdb1 60891136 4696030 56195106 8% /mnt
|
507
507
|
/dev/sdc1 1310720 107407 1203313 9% /mnt
|
508
|
-
DFI
|
508
|
+
DFI
|
509
509
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
510
510
|
|
511
511
|
allow(plugin).to receive(:which).with("lsblk").and_return("/sbin/lsblk")
|
@@ -515,7 +515,7 @@ DFI
|
|
515
515
|
NAME=\"/dev/sdb1\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" LABEL=\"/mnt\" FSTYPE=\"ext4\"
|
516
516
|
NAME=\"/dev/sdc1\" UUID=\"7f1e51bf-3608-4351-b7cd-379e39cff36a\" LABEL=\"/mnt\" FSTYPE=\"ext4\"
|
517
517
|
NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
|
518
|
-
BLKID_TYPE
|
518
|
+
BLKID_TYPE
|
519
519
|
allow(plugin).to receive(:shell_out)
|
520
520
|
.with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60)
|
521
521
|
.and_return(mock_shell_out(0, @stdout, ""))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
-
# Copyright:: Copyright (c) 2016 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2016-2018 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,14 +16,13 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
require "openssl"
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin fips" do
|
23
23
|
let(:enabled) { "0" }
|
24
24
|
let(:plugin) { get_plugin("linux/fips") }
|
25
|
-
let(:
|
26
|
-
let(:openssl_test_mode) { true }
|
25
|
+
let(:openssl_test_mode) { false }
|
27
26
|
|
28
27
|
subject do
|
29
28
|
plugin.run
|
@@ -32,59 +31,28 @@ describe Ohai::System, "plugin fips" do
|
|
32
31
|
|
33
32
|
before(:each) do
|
34
33
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
35
|
-
allow(::File).to receive(:read).with(fips_path).and_return(enabled)
|
36
34
|
end
|
37
35
|
|
38
36
|
around do |ex|
|
39
|
-
begin
|
40
|
-
$FIPS_TEST_MODE = openssl_test_mode
|
41
|
-
ex.run
|
42
|
-
ensure
|
43
|
-
$FIPS_TEST_MODE = false
|
44
|
-
end
|
45
|
-
end
|
46
37
|
|
47
|
-
|
48
|
-
|
38
|
+
$FIPS_TEST_MODE = openssl_test_mode
|
39
|
+
ex.run
|
40
|
+
ensure
|
41
|
+
$FIPS_TEST_MODE = false
|
49
42
|
|
50
|
-
it "sets fips plugin" do
|
51
|
-
expect(subject).to be(true)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context "fips file does not contain 1" do
|
56
|
-
let(:enabled) { "0" }
|
57
|
-
|
58
|
-
it "does not set fips plugin" do
|
59
|
-
expect(subject).to be(false)
|
60
|
-
end
|
61
43
|
end
|
62
44
|
|
63
|
-
context "
|
64
|
-
before
|
65
|
-
allow(::File).to receive(:read).and_raise(Errno::ENOENT, "bibbleboop")
|
66
|
-
end
|
67
|
-
|
45
|
+
context "with OpenSSL.fips_mode == false" do
|
46
|
+
before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
|
68
47
|
it "does not set fips plugin" do
|
69
48
|
expect(subject).to be(false)
|
70
49
|
end
|
71
50
|
end
|
72
51
|
|
73
|
-
context "with
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
|
78
|
-
it "does not set fips plugin" do
|
79
|
-
expect(subject).to be(false)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "with OpenSSL.fips_mode == true" do
|
84
|
-
before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
|
85
|
-
it "sets fips plugin" do
|
86
|
-
expect(subject).to be(true)
|
87
|
-
end
|
52
|
+
context "with OpenSSL.fips_mode == true" do
|
53
|
+
before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
|
54
|
+
it "sets fips plugin" do
|
55
|
+
expect(subject).to be(true)
|
88
56
|
end
|
89
57
|
end
|
90
58
|
end
|