Sha256: 87386c0067fd64cf6af95ca05e12af815c3eb5cb7e1783b0e5a188a791e3a2c4

Contents?: true

Size: 722 Bytes

Versions: 32

Compression:

Stored size: 722 Bytes

Contents

module Serverspec
  class Filter
    def self.filter_subject example
      description_args = example.metadata[:example_group][:example_group][:description_args].join(' ')

      # Linux kernel parameters
      %w( abi crypto debug dev fs kernel net sunrpc vm ).each do |param|
        if description_args.match(/^#{param}\./)
          ret = backend(Serverspec::Commands::Base).run_command("/sbin/sysctl -q -n #{description_args}")
          val = ret[:stdout].strip
          val = val.to_i if val.match(/^\d+$/)
          subject = Serverspec::Subject.new
          subject.value(val)
          return subject
        end
      end

      example.metadata[:example_group][:description_args].join(' ')
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
serverspec-0.5.4 lib/serverspec/filter.rb
serverspec-0.5.3 lib/serverspec/filter.rb
serverspec-0.5.2 lib/serverspec/filter.rb
serverspec-0.5.1 lib/serverspec/filter.rb
serverspec-0.5.0 lib/serverspec/filter.rb
serverspec-0.4.14 lib/serverspec/filter.rb
serverspec-0.4.13 lib/serverspec/filter.rb
serverspec-0.4.12 lib/serverspec/filter.rb
serverspec-0.4.11 lib/serverspec/filter.rb
serverspec-0.4.10 lib/serverspec/filter.rb
serverspec-0.4.9 lib/serverspec/filter.rb
serverspec-0.4.8 lib/serverspec/filter.rb
serverspec-0.4.7 lib/serverspec/filter.rb
serverspec-0.4.6 lib/serverspec/filter.rb
serverspec-0.4.5 lib/serverspec/filter.rb
serverspec-0.4.4 lib/serverspec/filter.rb
serverspec-0.4.3 lib/serverspec/filter.rb
serverspec-0.4.2 lib/serverspec/filter.rb
serverspec-0.4.1 lib/serverspec/filter.rb
serverspec-0.4.0 lib/serverspec/filter.rb