Sha256: bdf68cb9da46d6377c3ed7c934613e659618ca7e26c295e71897b02f1e2001a1

Contents?: true

Size: 840 Bytes

Versions: 12

Compression:

Stored size: 840 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 <<~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
    EXAMPLE

    # 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

12 entries across 12 versions & 2 rubygems

Version Path
inspec-core-4.3.2 lib/resources/os.rb
inspec-4.3.2 lib/resources/os.rb
inspec-core-4.2.0.preview lib/resources/os.rb
inspec-4.2.0.preview lib/resources/os.rb
inspec-core-4.1.4.preview lib/resources/os.rb
inspec-4.1.4.preview lib/resources/os.rb
inspec-core-3.9.3 lib/resources/os.rb
inspec-3.9.3 lib/resources/os.rb
inspec-core-3.9.0 lib/resources/os.rb
inspec-3.9.0 lib/resources/os.rb
inspec-core-3.7.11 lib/resources/os.rb
inspec-3.7.11 lib/resources/os.rb