mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
7b23fa479c
* Add correct `supports platform` to resources. Signed-off-by: Miah Johnson <miah@chia-pet.org> * Remove 'os_family' and update platforms to specify what they did. Signed-off-by: Miah Johnson <miah@chia-pet.org> * Add esx and cisco to generic resources. Signed-off-by: Jared Quick <jquick@chef.io>
36 lines
825 B
Ruby
36 lines
825 B
Ruby
# 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
|