mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
feature: helper method to check if a default command exists
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
This commit is contained in:
parent
5d5b945933
commit
cb3e067a1f
2 changed files with 12 additions and 0 deletions
11
lib/resources/command.rb
Normal file
11
lib/resources/command.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2015 Vulcano Security GmbH. All rights reserved.
|
||||
module Serverspec::Type
|
||||
class Command < Base
|
||||
# Check if a given command (executable) exists
|
||||
# in the default path
|
||||
def exists?
|
||||
cmd = @name
|
||||
Command.new("type \"#{cmd}\" > /dev/null").exit_status == 0
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,6 +13,7 @@ require 'vulcano/rule'
|
|||
require 'vulcano/rspec_json_formatter'
|
||||
|
||||
require 'resources/audit_policy'
|
||||
require 'resources/command'
|
||||
require 'resources/file'
|
||||
require 'resources/group_policy'
|
||||
require 'resources/mysql_conf'
|
||||
|
|
Loading…
Reference in a new issue