mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Fix up platform on filesystem resource.
From linux to unix. This should work fine even on AIX, according to the man pages. Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
65c44d22e2
commit
df31f744f4
2 changed files with 4 additions and 12 deletions
|
@ -3,7 +3,7 @@ require "inspec/resources/command"
|
|||
module Inspec::Resources
|
||||
class FileSystemResource < Inspec.resource(1)
|
||||
name "filesystem"
|
||||
supports platform: "linux"
|
||||
supports platform: "unix"
|
||||
supports platform: "windows"
|
||||
desc "Use the filesystem InSpec resource to test file system"
|
||||
example <<~EXAMPLE
|
||||
|
@ -29,8 +29,8 @@ module Inspec::Resources
|
|||
@fsman = nil
|
||||
|
||||
os = inspec.os
|
||||
if os.linux?
|
||||
@fsman = LinuxFileSystemResource.new(inspec)
|
||||
if os.unix?
|
||||
@fsman = UnixFileSystemResource.new(inspec)
|
||||
elsif os.windows?
|
||||
@fsman = WindowsFileSystemResource.new(inspec)
|
||||
else
|
||||
|
@ -93,7 +93,7 @@ module Inspec::Resources
|
|||
end
|
||||
end
|
||||
|
||||
class LinuxFileSystemResource < FsManagement
|
||||
class UnixFileSystemResource < FsManagement
|
||||
def info(partition)
|
||||
cmd = inspec.command("df #{partition} -PT")
|
||||
if cmd.stdout.nil? || cmd.stdout.empty? || cmd.exit_status != 0
|
||||
|
|
|
@ -26,12 +26,4 @@ describe "Inspec::Resources::FileSystemResource" do
|
|||
_(resource.free_kb).must_equal 30000000
|
||||
_(resource.percent_free).must_equal 75
|
||||
end
|
||||
|
||||
# unsuported os
|
||||
describe "when loading filesystem in unsupported OS family" do
|
||||
it "fails on FreeBSD (unix-like)" do
|
||||
resource_fail = MockLoader.new(:freebsd10).load_resource("filesystem", "/")
|
||||
_(resource_fail.check_supports).must_equal false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue