summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2017-10-04 22:18:09 -0700
committerGitHub <noreply@github.com>2017-10-04 22:18:09 -0700
commit1dd9f211c5c18e8abb3a7b3547cfaab90c069732 (patch)
treea9572a55d3d725823843bcdb768215be9adbf413 /spec
parent978bcf908e9ac8321d79a1a55dd4d4c3e4c6666e (diff)
downloadohai-1dd9f211c5c18e8abb3a7b3547cfaab90c069732.tar.gz
Fix regression in #1047 (#1066)
PR #1047 allows a plugin to return partial data which may be incredibly dangerous. It's a totally reasonable thing to want, however, so we gate it behind a plugin config. However, the default behavior reverts to where it was. Signed-off-by: Phil Dibowitz <phil@ipom.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/linux/filesystem_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/unit/plugins/linux/filesystem_spec.rb b/spec/unit/plugins/linux/filesystem_spec.rb
index 13aeb248..451849be 100644
--- a/spec/unit/plugins/linux/filesystem_spec.rb
+++ b/spec/unit/plugins/linux/filesystem_spec.rb
@@ -533,8 +533,17 @@ BLKID_TYPE
end
%w{df mount}.each do |command|
- describe "when #{command} does not exist" do
+ describe "when :allow_partial_data set, #{command} does not exist" do
+ before do
+ Ohai.config[:plugin][:filesystem][:allow_partial_data] = true
+ end
+
+ after do
+ Ohai.config[:plugin][:filesystem][:allow_partial_data] = false
+ end
+
it "logs warning about #{command} missing" do
+ Ohai.config[:plugin][:filesystem][:allow_partial_data] = true
allow(plugin).to receive(:shell_out).with(/#{command}/).and_raise(Ohai::Exceptions::Exec)
expect(Ohai::Log).to receive(:warn).with("Plugin Filesystem: #{command} binary is not available. Some data will not be available.")
plugin.run