mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Merge pull request #4637 from inspec/mj/3921
Fix filesystem resource when device has long name
This commit is contained in:
commit
44579ab4b3
4 changed files with 6 additions and 4 deletions
|
@ -95,7 +95,7 @@ module Inspec::Resources
|
|||
|
||||
class LinuxFileSystemResource < FsManagement
|
||||
def info(partition)
|
||||
cmd = inspec.command("df #{partition} -T")
|
||||
cmd = inspec.command("df #{partition} -PT")
|
||||
if cmd.stdout.nil? || cmd.stdout.empty? || cmd.exit_status != 0
|
||||
raise Inspec::Exceptions::ResourceFailed,
|
||||
"Unable to get available space for partition #{partition}"
|
||||
|
|
|
@ -404,7 +404,7 @@ class MockLoader
|
|||
"/sbin/zpool get -Hp all tank" => cmd.call("zpool-get-all-tank"),
|
||||
# docker
|
||||
"4f8e24022ea8b7d3b117041ec32e55d9bf08f11f4065c700e7c1dc606c84fd17" => cmd.call("docker-ps-a"),
|
||||
"b40ed61c006b54f155b28a85dc944dc0352b30222087b47c6279568ec0e59d05" => cmd.call("df-t"),
|
||||
"b40ed61c006b54f155b28a85dc944dc0352b30222087b47c6279568ec0e59d05" => cmd.call("df-PT"),
|
||||
"docker version --format '{{ json . }}'" => cmd.call("docker-version"),
|
||||
"docker info --format '{{ json . }}'" => cmd.call("docker-info"),
|
||||
"docker inspect 71b5df59442b" => cmd.call("docker-inspec"),
|
||||
|
|
|
@ -3,9 +3,11 @@ require "inspec/resource"
|
|||
require "inspec/resources/filesystem"
|
||||
|
||||
describe "Inspec::Resources::FileSystemResource" do
|
||||
# arch linux
|
||||
it "verify filesystem on linux" do
|
||||
resource = MockLoader.new(:ubuntu1404).load_resource("filesystem", "/")
|
||||
resource = quick_resource(:filesystem, :linux, "/") do |cmd|
|
||||
stdout_file "test/unit/mock/cmd/df-PT"
|
||||
end
|
||||
|
||||
_(resource.size_kb).must_equal 30428648
|
||||
_(resource.size).must_equal 30428648
|
||||
_(resource.name).must_equal "/"
|
||||
|
|
Loading…
Add table
Reference in a new issue