Sha256: ce3bfea82e38b791609f8365d4a5123a01c5c8842e5fb81b80e3101da121211d

Contents?: true

Size: 999 Bytes

Versions: 13

Compression:

Stored size: 999 Bytes

Contents

require "inspec/resources/sybase_session"

module Inspec::Resources
  class SybaseConf < Inspec.resource(1)
    name "sybase_conf"
    supports platform: "unix"
    # supports platform: "windows" # TODO
    desc "Use the sybase_conf InSpec resource to test Sybase config settings"
    example <<~EXAMPLE
      describe sybase_conf("max memory", password: 'password', server: 'SYBASE') do
        its("run_value") { should cmp 180224 }
      end
    EXAMPLE

    attr_reader :conf_param, :sql_query
    def initialize(conf_param_name, opts = {})
      @conf_param = conf_param_name
      opts[:username] ||= "sa"
      opts[:database] ||= "master"
      sql_session = inspec.sybase_session(opts)
      @sql_query = sql_session.query("sp_configure \"#{conf_param}\"")
    end

    def run_value
      sql_query.row(0).column("Run Value").value
    end

    def config_value
      sql_query.row(0).column("Config Value").value
    end

    def to_s
      "Sybase Conf #{conf_param}"
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
inspec-core-4.56.58 lib/inspec/resources/sybase_conf.rb
inspec-core-5.17.4 lib/inspec/resources/sybase_conf.rb
inspec-core-5.14.0 lib/inspec/resources/sybase_conf.rb
inspec-core-4.56.20 lib/inspec/resources/sybase_conf.rb
inspec-core-5.12.2 lib/inspec/resources/sybase_conf.rb
inspec-core-5.10.5 lib/inspec/resources/sybase_conf.rb
inspec-core-4.56.19 lib/inspec/resources/sybase_conf.rb
inspec-core-5.7.9 lib/inspec/resources/sybase_conf.rb
inspec-core-4.56.17 lib/inspec/resources/sybase_conf.rb
inspec-core-4.52.9 lib/inspec/resources/sybase_conf.rb
inspec-core-4.50.3 lib/inspec/resources/sybase_conf.rb
inspec-core-4.49.0 lib/inspec/resources/sybase_conf.rb
inspec-core-4.46.13 lib/inspec/resources/sybase_conf.rb