Sha256: 1cbdd94ac19af2993d2d7e1677107750c5c21589b1bc0db4ab55e27720d39a4f

Contents?: true

Size: 861 Bytes

Versions: 5

Compression:

Stored size: 861 Bytes

Contents

# encoding: utf-8

require 'resources/platform'

module Inspec::Resources
  class OSResource < PlatformResource
    name 'os'
    supports platform: 'unix'
    supports platform: 'windows'
    desc 'Use the os InSpec audit resource to test the platform on which the system is running.'
    example "
      describe os[:family] do
        it { should eq 'redhat' }
      end

      describe os.redhat? do
        it { should eq true }
      end

      describe os.linux? do
        it { should eq true }
      end
    "

    # reuse helper methods from backend
    %w{aix? redhat? debian? suse? bsd? solaris? linux? unix? windows? hpux? darwin?}.each do |os_family|
      define_method(os_family.to_sym) do
        @platform.send(os_family)
      end
    end

    def to_s
      'Operating System Detection'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/resources/os.rb
inspec-2.1.21 lib/resources/os.rb
inspec-2.1.10 lib/resources/os.rb
inspec-2.0.32 lib/resources/os.rb
inspec-2.0.17 lib/resources/os.rb