Sha256: c7405484362695735a9de0da74a53cb4db2153c4b5b468db636971a1ffd8d6ab
Contents?: true
Size: 862 Bytes
Versions: 5
Compression:
Stored size: 862 Bytes
Contents
module Inspec::Resources class FileSystemResource < Inspec.resource(1) name 'filesystem' supports platform: 'linux' desc 'Use the filesystem InSpec resource to test file system' example " describe filesystem('/') do its('size') { should be >= 32000 } end " attr_reader :partition def initialize(partition) @partition = partition end def size @size ||= begin cmd = inspec.command("df #{partition} --output=size") raise Inspec::Exceptions::ResourceFailed, "Unable to get available space for partition #{partition}" if cmd.stdout.nil? || cmd.stdout.empty? || !cmd.exit_status.zero? value = cmd.stdout.gsub(/\dK-blocks[\r\n]/, '').strip value.to_i end end def to_s "Filesystem #{partition}" end end end
Version data entries
5 entries across 5 versions & 1 rubygems