Sha256: ec523e9b22f97f0ed493b809e5d7e5ecae7a57105411220ededf15d00018942d

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 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).do_check("/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

1 entries across 1 versions & 1 rubygems

Version Path
serverspec-0.2.19 lib/serverspec/filter.rb